Merge lp:~mandel/ubuntuone-windows-installer/implement_notify_presenter into lp:ubuntuone-windows-installer/beta

Proposed by Manuel de la Peña
Status: Merged
Approved by: Vincenzo Di Somma
Approved revision: 76
Merged at revision: 51
Proposed branch: lp:~mandel/ubuntuone-windows-installer/implement_notify_presenter
Merge into: lp:ubuntuone-windows-installer/beta
Prerequisite: lp:~mandel/ubuntuone-windows-installer/split_objects_definition
Diff against target: 2182 lines (+1372/-203)
44 files modified
build.number (+1/-1)
src/Canonical.UbuntuOne.Client.Test/Canonical.UbuntuOne.Client.Test.csproj (+13/-0)
src/Canonical.UbuntuOne.Client.Test/Notification/NotificationPresenterFixture.cs (+294/-0)
src/Canonical.UbuntuOne.Client.Test/Notification/OperationCompletenessEventArgsFixture.cs (+6/-5)
src/Canonical.UbuntuOne.Client.Views/NotifyIcon.xaml.cs (+31/-2)
src/Canonical.UbuntuOne.Client/Canonical.UbuntuOne.Client.csproj (+19/-1)
src/Canonical.UbuntuOne.Client/Notification/INotificationIconPresenter.cs (+0/-22)
src/Canonical.UbuntuOne.Client/Notification/INotificationIconView.cs (+9/-0)
src/Canonical.UbuntuOne.Client/Notification/IStateMapper.cs (+41/-0)
src/Canonical.UbuntuOne.Client/Notification/ISyncDaemonClientNotifier.cs (+50/-0)
src/Canonical.UbuntuOne.Client/Notification/NotificationIconPresenter.cs (+171/-23)
src/Canonical.UbuntuOne.Client/Notification/NotificationResources.Designer.cs (+117/-0)
src/Canonical.UbuntuOne.Client/Notification/NotificationResources.resx (+138/-0)
src/Canonical.UbuntuOne.Client/Notification/OperationCompletenessEventArgs.cs (+12/-5)
src/Canonical.UbuntuOne.Client/Preferences/IPreferencesDialog.cs (+0/-30)
src/Canonical.UbuntuOne.Client/Preferences/IPreferencesDialogPresenter.cs (+30/-0)
src/Canonical.UbuntuOne.Client/Properties/AssemblyInfo.cs (+1/-0)
src/Canonical.UbuntuOne.Client/SyncDaemonClient.cs (+30/-8)
src/Canonical.UbuntuOne.Common/Canonical.UbuntuOne.Common.csproj (+10/-0)
src/Canonical.UbuntuOne.Common/OperationContracts/ISyncConfiguration.cs (+7/-0)
src/Canonical.UbuntuOne.Common/OperationContracts/ISyncDaemon.cs (+7/-0)
src/Canonical.UbuntuOne.Common/OperationContracts/ISyncFileManager.cs (+11/-0)
src/Canonical.UbuntuOne.Common/OperationContracts/ISyncFolders.cs (+7/-0)
src/Canonical.UbuntuOne.Common/OperationContracts/ISyncShares.cs (+7/-0)
src/Canonical.UbuntuOne.Common/Utils/ApplicationWrapper.cs (+63/-0)
src/Canonical.UbuntuOne.Common/Utils/Explorer.cs (+46/-0)
src/Canonical.UbuntuOne.Common/Utils/ExplorerException.cs (+43/-0)
src/Canonical.UbuntuOne.Common/Utils/IApplication.cs (+45/-0)
src/Canonical.UbuntuOne.Common/Utils/IExplorer.cs (+29/-0)
src/Canonical.UbuntuOne.Common/Utils/IWebbrowser.cs (+29/-0)
src/Canonical.UbuntuOne.Common/Utils/Webbrowser.cs (+32/-0)
src/Canonical.UbuntuOne.Common/objects.xml (+13/-2)
src/Canonical.UbuntuOne.ProcessDispatcher/SyncConfigurationService.cs (+9/-0)
src/Canonical.UbuntuOne.ProcessDispatcher/SyncDaemonService.cs (+10/-0)
src/Canonical.UbuntuOne.ProcessDispatcher/SyncFileManagerService.cs (+9/-0)
src/Canonical.UbuntuOne.ProcessDispatcher/SyncFoldersService.cs (+9/-0)
src/Canonical.UbuntuOne.ProcessDispatcher/SyncSharesService.cs (+9/-0)
src/UbuntuOneClient.Tests/ProgramFixture.cs (+7/-3)
src/UbuntuOneClient.Tests/UbuntuOneClient.Tests.csproj (+3/-0)
src/UbuntuOneClient/ApplicationWrapper.cs (+0/-55)
src/UbuntuOneClient/IApplication.cs (+0/-41)
src/UbuntuOneClient/Program.cs (+2/-1)
src/UbuntuOneClient/UbuntuOneClient.csproj (+0/-2)
src/Version.cs (+2/-2)
To merge this branch: bzr merge lp:~mandel/ubuntuone-windows-installer/implement_notify_presenter
Reviewer Review Type Date Requested Status
John Lenton (community) Approve
Review via email: mp+31624@code.launchpad.net

Description of the change

Provides the implementation of the notification icon presenter.

To post a comment you must log in.
74. By Manuel de la Peña

Merge with parent

Revision history for this message
John Lenton (chipaca) :
review: Approve
75. By Manuel de la Peña

Merge with parent.

76. By Manuel de la Peña

Fixed errors related to merge issues.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'build.number'
--- build.number 2010-08-04 14:20:36 +0000
+++ build.number 2010-08-09 16:14:47 +0000
@@ -1,1 +1,1 @@
11.0.404.5869
2\ No newline at end of file1\ No newline at end of file
21.0.409.6549
3\ No newline at end of file3\ No newline at end of file
44
=== modified file 'src/Canonical.UbuntuOne.Client.Test/Canonical.UbuntuOne.Client.Test.csproj'
--- src/Canonical.UbuntuOne.Client.Test/Canonical.UbuntuOne.Client.Test.csproj 2010-07-30 09:33:20 +0000
+++ src/Canonical.UbuntuOne.Client.Test/Canonical.UbuntuOne.Client.Test.csproj 2010-08-09 16:14:47 +0000
@@ -31,10 +31,18 @@
31 <WarningLevel>4</WarningLevel>31 <WarningLevel>4</WarningLevel>
32 </PropertyGroup>32 </PropertyGroup>
33 <ItemGroup>33 <ItemGroup>
34 <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
35 <SpecificVersion>False</SpecificVersion>
36 <HintPath>..\..\lib\log4net\log4net.dll</HintPath>
37 </Reference>
34 <Reference Include="nunit.framework, Version=2.5.5.10112, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">38 <Reference Include="nunit.framework, Version=2.5.5.10112, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
35 <SpecificVersion>False</SpecificVersion>39 <SpecificVersion>False</SpecificVersion>
36 <HintPath>..\..\lib\Nunit\nunit.framework.dll</HintPath>40 <HintPath>..\..\lib\Nunit\nunit.framework.dll</HintPath>
37 </Reference>41 </Reference>
42 <Reference Include="Rhino.Mocks, Version=3.6.0.0, Culture=neutral, PublicKeyToken=0b3305902db7183f, processorArchitecture=MSIL">
43 <SpecificVersion>False</SpecificVersion>
44 <HintPath>..\..\lib\RhinoMocks\Rhino.Mocks.dll</HintPath>
45 </Reference>
38 <Reference Include="System" />46 <Reference Include="System" />
39 <Reference Include="System.Core">47 <Reference Include="System.Core">
40 <RequiredTargetFramework>3.5</RequiredTargetFramework>48 <RequiredTargetFramework>3.5</RequiredTargetFramework>
@@ -53,6 +61,7 @@
53 <Link>Properties\Version.cs</Link>61 <Link>Properties\Version.cs</Link>
54 </Compile>62 </Compile>
55 <Compile Include="Notification\NotificationEventArgsFixture.cs" />63 <Compile Include="Notification\NotificationEventArgsFixture.cs" />
64 <Compile Include="Notification\NotificationPresenterFixture.cs" />
56 <Compile Include="Notification\OperationCompletenessEventArgsFixture.cs" />65 <Compile Include="Notification\OperationCompletenessEventArgsFixture.cs" />
57 <Compile Include="Notification\RecentlyModifiedEventArgsFixture.cs" />66 <Compile Include="Notification\RecentlyModifiedEventArgsFixture.cs" />
58 <Compile Include="Notification\StateEventArgsFixture.cs" />67 <Compile Include="Notification\StateEventArgsFixture.cs" />
@@ -63,6 +72,10 @@
63 <Project>{7467483A-D6D5-4362-8DF4-57A7254EB569}</Project>72 <Project>{7467483A-D6D5-4362-8DF4-57A7254EB569}</Project>
64 <Name>Canonical.UbuntuOne.Client</Name>73 <Name>Canonical.UbuntuOne.Client</Name>
65 </ProjectReference>74 </ProjectReference>
75 <ProjectReference Include="..\Canonical.UbuntuOne.Common\Canonical.UbuntuOne.Common.csproj">
76 <Project>{11353FF8-8E5A-488E-9CB1-873DADD232B9}</Project>
77 <Name>Canonical.UbuntuOne.Common</Name>
78 </ProjectReference>
66 </ItemGroup>79 </ItemGroup>
67 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />80 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
68 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 81 <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
6982
=== added file 'src/Canonical.UbuntuOne.Client.Test/Notification/NotificationPresenterFixture.cs'
--- src/Canonical.UbuntuOne.Client.Test/Notification/NotificationPresenterFixture.cs 1970-01-01 00:00:00 +0000
+++ src/Canonical.UbuntuOne.Client.Test/Notification/NotificationPresenterFixture.cs 2010-08-09 16:14:47 +0000
@@ -0,0 +1,294 @@
1/**
2 * Copyright 2010 Canonical Ltd.
3 *
4 * This file is part of UbuntuOne on Windows.
5 *
6 * UbuntuOne on Windows is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License version
8 * as published by the Free Software Foundation.
9 *
10 * Ubuntu One on Windows is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with UbuntuOne for Windows. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * Authors: Manuel de la Peña <manuel.delapena@canonical.com>
19 */
20using System;
21using System.Collections.Generic;
22using Canonical.UbuntuOne.Client.Notification;
23using Canonical.UbuntuOne.Client.Preferences;
24using Canonical.UbuntuOne.Common.Utils;
25using log4net;
26using NUnit.Framework;
27using Rhino.Mocks;
28using Rhino.Mocks.Interfaces;
29
30namespace Canonical.UbuntuOne.Client.Test.Notification
31{
32 [TestFixture]
33 public class NotificationPresenterFixture
34 {
35
36 #region Variables
37
38 private MockRepository _mocks;
39 private IApplication _app;
40 private IExplorer _explorer;
41 private IWebbrowser _browser;
42 private IStateMapper _mapper;
43 private IPreferencesDialogPresenter _preferences;
44 private INotificationIconView _view;
45 private ISyncDaemonClientNotifier _notifier;
46 private NotificationIconPresenter _presenter;
47 private ILog _logger;
48
49 #endregion
50
51 #region Setup
52
53 [SetUp]
54 public void Setup()
55 {
56 _mocks = new MockRepository();
57 _app = _mocks.StrictMock<IApplication>();
58 _explorer = _mocks.StrictMock<IExplorer>();
59 _browser = _mocks.StrictMock<IWebbrowser>();
60 _mapper = _mocks.StrictMock<IStateMapper>();
61 _preferences = _mocks.StrictMock<IPreferencesDialogPresenter>();
62 _view = _mocks.StrictMock<INotificationIconView>();
63 _notifier = _mocks.DynamicMock<ISyncDaemonClientNotifier>();
64 _logger = _mocks.StrictMock<ILog>();
65 _presenter = new NotificationIconPresenter
66 {
67 Application = _app,
68 Explorer = _explorer,
69 Webbrowser = _browser,
70 StateMapper = _mapper,
71 PreferencesDialogPresenter = _preferences,
72 NotificationIconView = _view,
73 Logger = _logger
74 };
75 _mocks.BackToRecordAll();
76 }
77
78 #endregion
79
80 #region Tests
81
82 [Test]
83 public void OnStateChange()
84 {
85 IEventRaiser onStateRaiser;
86 var args = new StateEventArgs(StateEventArgs.StateEnum.OUT_OF_SYNC);
87 using (_mocks.Record())
88 {
89 _notifier.OnStateChanged += null;
90 onStateRaiser = LastCall.IgnoreArguments().GetEventRaiser();
91
92 Expect.Call(_mapper.ToString(args.State))
93 .Return("")
94 .Repeat.Once();
95 _view.State = "new state";
96
97 LastCall.IgnoreArguments();
98 }
99 using(_mocks.Playback())
100 {
101 _presenter.SyncDaemonClientNotifier = _notifier;
102 onStateRaiser.Raise(this, args);
103 }
104 }
105
106 [Test]
107 public void OnRecentlyModifiedTest()
108 {
109 IEventRaiser onRecentlyModifiedRaiser;
110 var args = new RecentlyModifiedEventArgs(new List<string>());
111 using(_mocks.Record())
112 {
113 _notifier.OnRecentlyModifiedChanged += null;
114 onRecentlyModifiedRaiser = LastCall.IgnoreArguments().GetEventRaiser();
115 _view.RecentlyModifiedFiles = new List<string>();
116 LastCall.IgnoreArguments();
117 }
118 using(_mocks.Playback())
119 {
120 _presenter.SyncDaemonClientNotifier = _notifier;
121 onRecentlyModifiedRaiser.Raise(this, args);
122 }
123 }
124
125 [Test]
126 public void OnOperationCompletnessTest()
127 {
128 IEventRaiser onOperationCompletnessRaiser;
129 var args = new OperationCompletenessEventArgs("dowload", 45, 23.4,
130 OperationCompletenessEventArgs.SpeedUnitsEnum.KB);
131 using(_mocks.Record())
132 {
133 _notifier.OnOperationCompletness += null;
134 onOperationCompletnessRaiser = LastCall.IgnoreArguments().GetEventRaiser();
135 _view.CurrentOperation = "";
136 LastCall.IgnoreArguments();
137 }
138 using(_mocks.Playback())
139 {
140 _presenter.SyncDaemonClientNotifier = _notifier;
141 onOperationCompletnessRaiser.Raise(this, args);
142 }
143 }
144
145 [Test]
146 public void OnNotificationTest()
147 {
148 IEventRaiser onNotificationRaiser;
149 var notification = "mensagge";
150 var args = new NotificationEventArgs(notification);
151 using (_mocks.Record())
152 {
153 _notifier.OnNotification += null;
154 onNotificationRaiser = LastCall.IgnoreArguments().GetEventRaiser();
155 _view.Notification = notification;
156 }
157 using(_mocks.Playback())
158 {
159 _presenter.SyncDaemonClientNotifier = _notifier;
160 onNotificationRaiser.Raise(this, args);
161 }
162 }
163
164 [Test]
165 public void OpenPreferencesTest()
166 {
167 using(_mocks.Record())
168 {
169 Expect.Call(() => _preferences.Show())
170 .Repeat.Once();
171 }
172 using(_mocks.Playback())
173 {
174 _presenter.OpenUbuntuOnePreferences();
175 }
176 }
177
178 [Test]
179 public void OpenShareLocationTest()
180 {
181 using(_mocks.Record())
182 {
183 Expect.Call(() => _explorer.OpenFolder(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)))
184 .Repeat.Once();
185 }
186 using(_mocks.Playback())
187 {
188 _presenter.OpenSharesLocation();
189 }
190
191 }
192
193 [Test]
194 [ExpectedException(typeof(ExplorerException))]
195 public void OpenShareLocationExceptionTest()
196 {
197 using (_mocks.Record())
198 {
199 Expect.Call(() => _explorer.OpenFolder(""))
200 .IgnoreArguments()
201 .Throw(new ExplorerException());
202 Expect.Call(() => _logger.WarnFormat("(0)", new ExplorerException()))
203 .IgnoreArguments()
204 .Repeat.Once();
205 _view.Notification = "error msg";
206 LastCall.IgnoreArguments();
207 }
208 using (_mocks.Playback())
209 {
210 _presenter.OpenSharesLocation();
211 }
212 }
213
214 [Test]
215 public void OpenSyncsLocationTest()
216 {
217 using (_mocks.Record())
218 {
219 Expect.Call(() => _explorer.OpenFolder(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)))
220 .Repeat.Once();
221 }
222 using (_mocks.Playback())
223 {
224 _presenter.OpenSyncsLocation();
225 }
226 }
227
228 [Test]
229 [ExpectedException(typeof(ExplorerException))]
230 public void OpenSyncsLocationExceptionTest()
231 {
232 using (_mocks.Record())
233 {
234 Expect.Call(() => _explorer.OpenFolder(""))
235 .IgnoreArguments()
236 .Throw(new ExplorerException());
237 Expect.Call(() => _logger.WarnFormat("(0)", new ExplorerException()))
238 .IgnoreArguments()
239 .Repeat.Once();
240 _view.Notification = "error msg";
241 LastCall.IgnoreArguments();
242 }
243 using (_mocks.Playback())
244 {
245 _presenter.OpenSyncsLocation();
246 }
247 }
248
249 [Test]
250 public void OpenHelpTest()
251 {
252 using (_mocks.Record())
253 {
254 Expect.Call(() => _browser.LauncWebpage(NotificationIconPresenter.HelpUrl))
255 .Repeat.Once();
256 }
257 using (_mocks.Playback())
258 {
259 _presenter.OpenHelp();
260 }
261 }
262
263 [Test]
264 public void OpenUpgradeOptionTest()
265 {
266 using (_mocks.Record())
267 {
268 Expect.Call(() => _browser.LauncWebpage(NotificationIconPresenter.UpgradeUrl))
269 .Repeat.Once();
270 }
271 using (_mocks.Playback())
272 {
273 _presenter.OpenUpgradeOption();
274 }
275 }
276
277 [Test]
278 public void ExitApplicationTest()
279 {
280 using (_mocks.Record())
281 {
282 Expect.Call(() => _app.Exit())
283 .Repeat.Once();
284 }
285 using (_mocks.Playback())
286 {
287 _presenter.Exit();
288 }
289 }
290
291 #endregion
292
293 }
294}
0295
=== modified file 'src/Canonical.UbuntuOne.Client.Test/Notification/OperationCompletenessEventArgsFixture.cs'
--- src/Canonical.UbuntuOne.Client.Test/Notification/OperationCompletenessEventArgsFixture.cs 2010-07-27 11:57:29 +0000
+++ src/Canonical.UbuntuOne.Client.Test/Notification/OperationCompletenessEventArgsFixture.cs 2010-08-09 16:14:47 +0000
@@ -37,12 +37,13 @@
37 Assert.AreEqual(OperationCompletenessEventArgs.SpeedUnitsEnum.MB, args.SpeedUnits);37 Assert.AreEqual(OperationCompletenessEventArgs.SpeedUnitsEnum.MB, args.SpeedUnits);
38 }38 }
3939
40 [TestCase(1, 3.4, OperationCompletenessEventArgs.SpeedUnitsEnum.MB)]40 [TestCase("work", 1, 3.4, OperationCompletenessEventArgs.SpeedUnitsEnum.MB)]
41 [TestCase(2323, 0.0, OperationCompletenessEventArgs.SpeedUnitsEnum.MB)]41 [TestCase("dance", 2323, 0.0, OperationCompletenessEventArgs.SpeedUnitsEnum.MB)]
42 [TestCase(45, 23.4, OperationCompletenessEventArgs.SpeedUnitsEnum.KB)]42 [TestCase("dowload", 45, 23.4, OperationCompletenessEventArgs.SpeedUnitsEnum.KB)]
43 public void ParametersConstructorTest(int percentage, double speed, OperationCompletenessEventArgs.SpeedUnitsEnum unitsEnum)43 public void ParametersConstructorTest(string operation, int percentage, double speed, OperationCompletenessEventArgs.SpeedUnitsEnum unitsEnum)
44 {44 {
45 var args = new OperationCompletenessEventArgs(percentage, speed, unitsEnum);45 var args = new OperationCompletenessEventArgs(operation, percentage, speed, unitsEnum);
46 Assert.AreEqual(operation, args.Operation);
46 Assert.AreEqual(percentage, args.Percentage);47 Assert.AreEqual(percentage, args.Percentage);
47 Assert.AreEqual(speed, args.Speed);48 Assert.AreEqual(speed, args.Speed);
48 Assert.AreEqual(unitsEnum, args.SpeedUnits);49 Assert.AreEqual(unitsEnum, args.SpeedUnits);
4950
=== modified file 'src/Canonical.UbuntuOne.Client.Views/NotifyIcon.xaml.cs'
--- src/Canonical.UbuntuOne.Client.Views/NotifyIcon.xaml.cs 2010-07-28 11:06:07 +0000
+++ src/Canonical.UbuntuOne.Client.Views/NotifyIcon.xaml.cs 2010-08-09 16:14:47 +0000
@@ -17,7 +17,8 @@
17 * 17 *
18 * Authors: Manuel de la Peña <manuel.delapena@canonical.com>18 * Authors: Manuel de la Peña <manuel.delapena@canonical.com>
19 */19 */
20using System.Windows;20using System;
21using System.Collections.Generic;
21using Canonical.UbuntuOne.Client.Notification;22using Canonical.UbuntuOne.Client.Notification;
2223
23namespace Canonical.UbuntuOne.Client.Views24namespace Canonical.UbuntuOne.Client.Views
@@ -25,11 +26,39 @@
25 /// <summary>26 /// <summary>
26 /// Interaction logic for UbuntuOneNotifyIcon.xaml27 /// Interaction logic for UbuntuOneNotifyIcon.xaml
27 /// </summary>28 /// </summary>
28 public partial class UbuntuOneNotifyIcon : Window, INotificationIconView29 public partial class UbuntuOneNotifyIcon : INotificationIconView
29 {30 {
30 public UbuntuOneNotifyIcon()31 public UbuntuOneNotifyIcon()
31 {32 {
32 InitializeComponent();33 InitializeComponent();
33 }34 }
35
36 #region Implementation of INotificationIconView
37
38 public string Notification
39 {
40 get { throw new NotImplementedException(); }
41 set { throw new NotImplementedException(); }
42 }
43
44 public IList<string> RecentlyModifiedFiles
45 {
46 get { throw new NotImplementedException(); }
47 set { throw new NotImplementedException(); }
48 }
49
50 public string State
51 {
52 get { throw new NotImplementedException(); }
53 set { throw new NotImplementedException(); }
54 }
55
56 public string CurrentOperation
57 {
58 get { throw new NotImplementedException(); }
59 set { throw new NotImplementedException(); }
60 }
61
62 #endregion
34 }63 }
35}64}
3665
=== modified file 'src/Canonical.UbuntuOne.Client/Canonical.UbuntuOne.Client.csproj'
--- src/Canonical.UbuntuOne.Client/Canonical.UbuntuOne.Client.csproj 2010-08-02 17:57:48 +0000
+++ src/Canonical.UbuntuOne.Client/Canonical.UbuntuOne.Client.csproj 2010-08-09 16:14:47 +0000
@@ -36,13 +36,20 @@
36 <Link>Properties\Version.cs</Link>36 <Link>Properties\Version.cs</Link>
37 </Compile>37 </Compile>
38 <Compile Include="Notification\INotificationIconView.cs" />38 <Compile Include="Notification\INotificationIconView.cs" />
39 <Compile Include="Notification\IStateMapper.cs" />
40 <Compile Include="Notification\ISyncDaemonClientNotifier.cs" />
39 <Compile Include="Notification\NotificationIconPresenter.cs" />41 <Compile Include="Notification\NotificationIconPresenter.cs" />
42 <Compile Include="Notification\NotificationResources.Designer.cs">
43 <AutoGen>True</AutoGen>
44 <DesignTime>True</DesignTime>
45 <DependentUpon>NotificationResources.resx</DependentUpon>
46 </Compile>
40 <Compile Include="Notification\OperationCompletenessEventArgs.cs" />47 <Compile Include="Notification\OperationCompletenessEventArgs.cs" />
41 <Compile Include="Notification\RecentlyModifiedEventArgs.cs" />48 <Compile Include="Notification\RecentlyModifiedEventArgs.cs" />
42 <Compile Include="Notification\StateEventArgs.cs" />49 <Compile Include="Notification\StateEventArgs.cs" />
43 <Compile Include="Notification\INotificationIconPresenter.cs" />50 <Compile Include="Notification\INotificationIconPresenter.cs" />
44 <Compile Include="Notification\NotificationEventArgs.cs" />51 <Compile Include="Notification\NotificationEventArgs.cs" />
45 <Compile Include="Preferences\IPreferencesDialog.cs" />52 <Compile Include="Preferences\IPreferencesDialogPresenter.cs" />
46 <Compile Include="Properties\AssemblyInfo.cs" />53 <Compile Include="Properties\AssemblyInfo.cs" />
47 <Compile Include="SyncDaemonClient.cs" />54 <Compile Include="SyncDaemonClient.cs" />
48 </ItemGroup>55 </ItemGroup>
@@ -53,6 +60,10 @@
53 </ProjectReference>60 </ProjectReference>
54 </ItemGroup>61 </ItemGroup>
55 <ItemGroup>62 <ItemGroup>
63 <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
64 <SpecificVersion>False</SpecificVersion>
65 <HintPath>..\..\lib\log4net\log4net.dll</HintPath>
66 </Reference>
56 <Reference Include="PresentationFramework">67 <Reference Include="PresentationFramework">
57 <RequiredTargetFramework>3.0</RequiredTargetFramework>68 <RequiredTargetFramework>3.0</RequiredTargetFramework>
58 </Reference>69 </Reference>
@@ -63,5 +74,12 @@
63 <RequiredTargetFramework>3.0</RequiredTargetFramework>74 <RequiredTargetFramework>3.0</RequiredTargetFramework>
64 </Reference>75 </Reference>
65 </ItemGroup>76 </ItemGroup>
77 <ItemGroup>
78 <EmbeddedResource Include="Notification\NotificationResources.resx">
79 <Generator>ResXFileCodeGenerator</Generator>
80 <LastGenOutput>NotificationResources.Designer.cs</LastGenOutput>
81 <SubType>Designer</SubType>
82 </EmbeddedResource>
83 </ItemGroup>
66 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />84 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
67</Project>85</Project>
68\ No newline at end of file86\ No newline at end of file
6987
=== modified file 'src/Canonical.UbuntuOne.Client/Notification/INotificationIconPresenter.cs'
--- src/Canonical.UbuntuOne.Client/Notification/INotificationIconPresenter.cs 2010-07-27 11:58:32 +0000
+++ src/Canonical.UbuntuOne.Client/Notification/INotificationIconPresenter.cs 2010-08-09 16:14:47 +0000
@@ -17,8 +17,6 @@
17 * 17 *
18 * Authors: Manuel de la Peña <manuel.delapena@canonical.com>18 * Authors: Manuel de la Peña <manuel.delapena@canonical.com>
19 */19 */
20using System;
21
22namespace Canonical.UbuntuOne.Client.Notification20namespace Canonical.UbuntuOne.Client.Notification
23{21{
24 /// <summary>22 /// <summary>
@@ -28,26 +26,6 @@
28 public interface INotificationIconPresenter26 public interface INotificationIconPresenter
29 {27 {
30 /// <summary>28 /// <summary>
31 /// Event to be raised when there is a notification to display to the user.
32 /// </summary>
33 event EventHandler<NotificationEventArgs> OnNotificationChanged;
34
35 /// <summary>
36 /// Event to be raised when there status of the daemon has changed.
37 /// </summary>
38 event EventHandler<StateEventArgs> OnStateChanged;
39
40 /// <summary>
41 /// Event to be raised when the completness of the current operation has changed.
42 /// </summary>
43 event EventHandler<OperationCompletenessEventArgs> OnCompletenessChanged;
44
45 /// <summary>
46 /// Event to be raised when the recently modified files have been changed.
47 /// </summary>
48 event EventHandler<RecentlyModifiedEventArgs> OnRecentlyModifiedChanged;
49
50 /// <summary>
51 /// When implemented this method should open the Preferences window of Ubuntu One.29 /// When implemented this method should open the Preferences window of Ubuntu One.
52 /// </summary>30 /// </summary>
53 void OpenUbuntuOnePreferences();31 void OpenUbuntuOnePreferences();
5432
=== modified file 'src/Canonical.UbuntuOne.Client/Notification/INotificationIconView.cs'
--- src/Canonical.UbuntuOne.Client/Notification/INotificationIconView.cs 2010-07-28 11:05:41 +0000
+++ src/Canonical.UbuntuOne.Client/Notification/INotificationIconView.cs 2010-08-09 16:14:47 +0000
@@ -17,9 +17,18 @@
17 * 17 *
18 * Authors: Manuel de la Peña <manuel.delapena@canonical.com>18 * Authors: Manuel de la Peña <manuel.delapena@canonical.com>
19 */19 */
20using System.Collections.Generic;
21
20namespace Canonical.UbuntuOne.Client.Notification22namespace Canonical.UbuntuOne.Client.Notification
21{23{
22 public interface INotificationIconView24 public interface INotificationIconView
23 {25 {
26 string Notification { get; set; }
27
28 IList<string> RecentlyModifiedFiles { get; set; }
29
30 string State { get; set; }
31
32 string CurrentOperation { get; set; }
24 }33 }
25}34}
2635
=== added file 'src/Canonical.UbuntuOne.Client/Notification/IStateMapper.cs'
--- src/Canonical.UbuntuOne.Client/Notification/IStateMapper.cs 1970-01-01 00:00:00 +0000
+++ src/Canonical.UbuntuOne.Client/Notification/IStateMapper.cs 2010-08-09 16:14:47 +0000
@@ -0,0 +1,41 @@
1/**
2 * Copyright 2010 Canonical Ltd.
3 *
4 * This file is part of UbuntuOne on Windows.
5 *
6 * UbuntuOne on Windows is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License version
8 * as published by the Free Software Foundation.
9 *
10 * Ubuntu One on Windows is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with UbuntuOne for Windows. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * Authors: Manuel de la Peña <manuel.delapena@canonical.com>
19 */
20namespace Canonical.UbuntuOne.Client.Notification
21{
22 /// <summary>
23 /// Interface to be implemented by the
24 /// </summary>
25 public interface IStateMapper
26 {
27 /// <summary>
28 /// Converts a state enum to a string that can be displayed to the user.
29 /// </summary>
30 /// <param name="state">The state to be converted.</param>
31 /// <returns>A string that represents the sate.</returns>
32 string ToString(StateEventArgs.StateEnum state);
33
34 /// <summary>
35 /// Converst a string to the state enum
36 /// </summary>
37 /// <param name="state">The string to be parsed and converted to the enum.</param>
38 /// <returns>An enum with the state.</returns>
39 StateEventArgs.StateEnum FromString(string state);
40 }
41}
042
=== added file 'src/Canonical.UbuntuOne.Client/Notification/ISyncDaemonClientNotifier.cs'
--- src/Canonical.UbuntuOne.Client/Notification/ISyncDaemonClientNotifier.cs 1970-01-01 00:00:00 +0000
+++ src/Canonical.UbuntuOne.Client/Notification/ISyncDaemonClientNotifier.cs 2010-08-09 16:14:47 +0000
@@ -0,0 +1,50 @@
1/**
2 * Copyright 2010 Canonical Ltd.
3 *
4 * This file is part of UbuntuOne on Windows.
5 *
6 * UbuntuOne on Windows is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License version
8 * as published by the Free Software Foundation.
9 *
10 * Ubuntu One on Windows is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with UbuntuOne for Windows. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * Authors: Manuel de la Peña <manuel.delapena@canonical.com>
19 */
20using System;
21
22namespace Canonical.UbuntuOne.Client.Notification
23{
24 /// <summary>
25 /// Interface to be implemented by a sync daemon client that will contain the required events that will be used to notify the
26 /// NotificationIconPresenter about the different operations that have occurred in the sync daemon client.
27 /// </summary>
28 public interface ISyncDaemonClientNotifier
29 {
30 /// <summary>
31 /// Event raised when there are notifications to be provided to the notification icon.
32 /// </summary>
33 event EventHandler<NotificationEventArgs> OnNotification;
34
35 /// <summary>
36 /// Event raised when there are changes in the completness of the current opertaion.
37 /// </summary>
38 event EventHandler<OperationCompletenessEventArgs> OnOperationCompletness;
39
40 /// <summary>
41 /// Event raised when there are changed in teh recetly modififed items.
42 /// </summary>
43 event EventHandler<RecentlyModifiedEventArgs> OnRecentlyModifiedChanged;
44
45 /// <summary>
46 /// Event raised when there are changes in the state.
47 /// </summary>
48 event EventHandler<StateEventArgs> OnStateChanged;
49 }
50}
051
=== modified file 'src/Canonical.UbuntuOne.Client/Notification/NotificationIconPresenter.cs'
--- src/Canonical.UbuntuOne.Client/Notification/NotificationIconPresenter.cs 2010-07-27 15:02:26 +0000
+++ src/Canonical.UbuntuOne.Client/Notification/NotificationIconPresenter.cs 2010-08-09 16:14:47 +0000
@@ -18,9 +18,10 @@
18 * Authors: Manuel de la Peña <manuel.delapena@canonical.com>18 * Authors: Manuel de la Peña <manuel.delapena@canonical.com>
19 */19 */
20using System;20using System;
21using System.Windows;
22using System.Diagnostics;
23using Canonical.UbuntuOne.Client.Preferences;21using Canonical.UbuntuOne.Client.Preferences;
22using Canonical.UbuntuOne.Common.Aop;
23using Canonical.UbuntuOne.Common.Utils;
24using log4net;
2425
25namespace Canonical.UbuntuOne.Client.Notification26namespace Canonical.UbuntuOne.Client.Notification
26{27{
@@ -28,9 +29,13 @@
28 {29 {
29 #region Variables30 #region Variables
3031
31 private const string UpgradeUrl = "https://one.ubuntu.com/upgrade";32 public const string UpgradeUrl = "https://one.ubuntu.com/upgrade";
3233 public const string HelpUrl = "https://one.ubuntu.com/support/";
33 private const string HelpUrl = "https://one.ubuntu.com/support/";34 private static readonly string SharesLocation = "";
35 private static readonly string SyncsLocation = "";
36 private ISyncDaemonClientNotifier _clientNotifier;
37 private ILog _logger;
38 private readonly object _loggerLock = new object();
3439
35 #endregion40 #endregion
3641
@@ -39,49 +44,192 @@
39 /// <summary>44 /// <summary>
40 /// Gets and sets the dialog used to show the preferences.45 /// Gets and sets the dialog used to show the preferences.
41 /// </summary>46 /// </summary>
42 public IPreferencesDialog PreferencesDialog { get; set; }47 public IPreferencesDialogPresenter PreferencesDialogPresenter { get; set; }
4348
44 #endregion49 /// <summary>
50 /// Gets and sets the views that will be used to show the user the information.
51 /// </summary>
52 public INotificationIconView NotificationIconView { get; set; }
53
54 /// <summary>
55 /// Gets and sets the mapper used to convert from the state enum to a string.
56 /// </summary>
57 public IStateMapper StateMapper { get; set; }
58
59 /// <summary>
60 /// Gets and sets the webbrowser to be used to show pages to the user.
61 /// </summary>
62 public IWebbrowser Webbrowser { get; set; }
63
64 /// <summary>
65 /// Get and sets the eplorer that will be used to open folder in the client
66 /// machine.
67 /// </summary>
68 public IExplorer Explorer { get; set; }
69
70 /// <summary>
71 /// Gets and sets the application that is running the notify presenter.
72 /// </summary>
73 public IApplication Application { get; set; }
74
75 /// <summary>
76 /// Gets and sets the notifier that will ensure that the presenter know about changes in the
77 /// sync daemon.
78 /// </summary>
79 public ISyncDaemonClientNotifier SyncDaemonClientNotifier
80 {
81 get { return _clientNotifier; }
82 set
83 {
84 if (value == null) return;
85 _clientNotifier = value;
86 // register to the different events raised by the client
87 _clientNotifier.OnNotification += OnNotificationHandler;
88 _clientNotifier.OnOperationCompletness += OnOperationCompletnessHandler;
89 _clientNotifier.OnRecentlyModifiedChanged += OnRecentlyModifiedChangedHandler;
90 _clientNotifier.OnStateChanged += OnStateChangedHandler;
91 }
92 }
93
94 #endregion
95
96 #region Properties
97
98 /// <summary>
99 /// Gets and sets the logger used by the class.
100 /// </summary>
101 internal ILog Logger
102 {
103 get
104 {
105 if(_logger == null)
106 {
107 lock (_loggerLock)
108 {
109 _logger = LogManager.GetLogger(typeof (NotificationIconPresenter));
110 }
111 }
112 return _logger;
113 }
114 set { _logger = value; }
115 }
116
117 #endregion
118
119 #region Constructors
120
121 static NotificationIconPresenter()
122 {
123 SharesLocation = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
124 SyncsLocation = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
125 }
126
127 #endregion
128
129 #region Helper methods
130
131 /// <summary>
132 /// Helper method that will ensure that when the state of the sync daemon changes this change
133 /// is correctly reflected in the View.
134 /// </summary>
135 /// <param name="sender">The object that sent the event.</param>
136 /// <param name="e">The arguments that describe the state change.</param>
137 [DebugLogged]
138 private void OnStateChangedHandler(object sender, StateEventArgs e)
139 {
140 NotificationIconView.State = StateMapper.ToString(e.State);
141 }
142
143 /// <summary>
144 /// Helper method that will ensure that when the recently changed files are updated by the daemon that
145 /// such a change is correcty displayed in the view.
146 /// </summary>
147 /// <param name="sender">The object that sent the event.</param>
148 /// <param name="e">The arguments that describe the changes in the recently changed list.</param>
149 [DebugLogged]
150 private void OnRecentlyModifiedChangedHandler(object sender, RecentlyModifiedEventArgs e)
151 {
152 NotificationIconView.RecentlyModifiedFiles = e.RecentlyModifiedFiles;
153 }
154
155 /// <summary>
156 /// Helper method that will ensure that when the status of an operation that is being performed by the daemon
157 /// changes that such a changed ins correctly reflected in the UI.
158 /// </summary>
159 /// <param name="sender">The object that sent the event.</param>
160 /// <param name="e">The argumets that describe the new updated operation state.</param>
161 [DebugLogged]
162 private void OnOperationCompletnessHandler(object sender, OperationCompletenessEventArgs e)
163 {
164 NotificationIconView.CurrentOperation = String.Format(NotificationResources.OperationStateNotification,
165 e.Operation, e.Percentage, e.Speed, e.SpeedUnits);
166 }
167
168 /// <summary>
169 /// Helper method that will ensure that when a notification is sent by the daemon that it is correctly displayed in the UI.
170 /// </summary>
171 /// <param name="sender">The object that sent the event.</param>
172 /// <param name="e">The arguments that contains the notification to display.</param>
173 [DebugLogged]
174 private void OnNotificationHandler(object sender, NotificationEventArgs e)
175 {
176 NotificationIconView.Notification = e.Message;
177 }
178
179 #endregion
45180
46 #region Implementation of INotificationIconPresenter181 #region Implementation of INotificationIconPresenter
47182
48 #region events
49
50 public event EventHandler<NotificationEventArgs> OnNotificationChanged;
51 public event EventHandler<StateEventArgs> OnStateChanged;
52 public event EventHandler<OperationCompletenessEventArgs> OnCompletenessChanged;
53 public event EventHandler<RecentlyModifiedEventArgs> OnRecentlyModifiedChanged;
54
55 #endregion
56
57 public void OpenUbuntuOnePreferences()183 public void OpenUbuntuOnePreferences()
58 {184 {
59 PreferencesDialog.Show();185 PreferencesDialogPresenter.Show();
60 }186 }
61187
62 public void OpenSharesLocation()188 public void OpenSharesLocation()
63 {189 {
64 throw new NotImplementedException();190 try
191 {
192 Explorer.OpenFolder(SharesLocation);
193 }
194 catch(ExplorerException exception)
195 {
196 Logger.WarnFormat("There was an error operning the SharesLocation, {0}", exception);
197 // use the view to notify the error
198 NotificationIconView.Notification = String.Format(NotificationResources.ErrorOpeningFolder,
199 Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));
200 throw;
201 }
65 }202 }
66203
67 public void OpenSyncsLocation()204 public void OpenSyncsLocation()
68 {205 {
69 throw new NotImplementedException();206 try
207 {
208 Explorer.OpenFolder(SyncsLocation);
209 }
210 catch (ExplorerException exception)
211 {
212 Logger.WarnFormat("There was an error operning the SharesLocation, {0}", exception);
213 // use the view to notify the error
214 NotificationIconView.Notification = String.Format(NotificationResources.ErrorOpeningFolder,
215 Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));
216 throw;
217 }
70 }218 }
71219
72 public void OpenHelp()220 public void OpenHelp()
73 {221 {
74 Process.Start(HelpUrl);222 Webbrowser.LauncWebpage(HelpUrl);
75 }223 }
76224
77 public void OpenUpgradeOption()225 public void OpenUpgradeOption()
78 {226 {
79 Process.Start(UpgradeUrl);227 Webbrowser.LauncWebpage(UpgradeUrl);
80 }228 }
81229
82 public void Exit()230 public void Exit()
83 {231 {
84 Application.Current.Shutdown();232 Application.Exit();
85 }233 }
86234
87 #endregion235 #endregion
88236
=== added file 'src/Canonical.UbuntuOne.Client/Notification/NotificationResources.Designer.cs'
--- src/Canonical.UbuntuOne.Client/Notification/NotificationResources.Designer.cs 1970-01-01 00:00:00 +0000
+++ src/Canonical.UbuntuOne.Client/Notification/NotificationResources.Designer.cs 2010-08-09 16:14:47 +0000
@@ -0,0 +1,117 @@
1//------------------------------------------------------------------------------
2// <auto-generated>
3// This code was generated by a tool.
4// Runtime Version:2.0.50727.4927
5//
6// Changes to this file may cause incorrect behavior and will be lost if
7// the code is regenerated.
8// </auto-generated>
9//------------------------------------------------------------------------------
10
11namespace Canonical.UbuntuOne.Client.Notification {
12 using System;
13
14
15 /// <summary>
16 /// A strongly-typed resource class, for looking up localized strings, etc.
17 /// </summary>
18 // This class was auto-generated by the StronglyTypedResourceBuilder
19 // class via a tool like ResGen or Visual Studio.
20 // To add or remove a member, edit your .ResX file then rerun ResGen
21 // with the /str option, or rebuild your VS project.
22 [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
23 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 internal class NotificationResources {
26
27 private static global::System.Resources.ResourceManager resourceMan;
28
29 private static global::System.Globalization.CultureInfo resourceCulture;
30
31 [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 internal NotificationResources() {
33 }
34
35 /// <summary>
36 /// Returns the cached ResourceManager instance used by this class.
37 /// </summary>
38 [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 internal static global::System.Resources.ResourceManager ResourceManager {
40 get {
41 if (object.ReferenceEquals(resourceMan, null)) {
42 global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Canonical.UbuntuOne.Client.Notification.NotificationResources", typeof(NotificationResources).Assembly);
43 resourceMan = temp;
44 }
45 return resourceMan;
46 }
47 }
48
49 /// <summary>
50 /// Overrides the current thread's CurrentUICulture property for all
51 /// resource lookups using this strongly typed resource class.
52 /// </summary>
53 [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 internal static global::System.Globalization.CultureInfo Culture {
55 get {
56 return resourceCulture;
57 }
58 set {
59 resourceCulture = value;
60 }
61 }
62
63 /// <summary>
64 /// Looks up a localized string similar to Download finished for {0}.
65 /// </summary>
66 internal static string DownloadFinishedNotification {
67 get {
68 return ResourceManager.GetString("DownloadFinishedNotification", resourceCulture);
69 }
70 }
71
72 /// <summary>
73 /// Looks up a localized string similar to Download started for {0}.
74 /// </summary>
75 internal static string DownloadStartedNotitication {
76 get {
77 return ResourceManager.GetString("DownloadStartedNotitication", resourceCulture);
78 }
79 }
80
81 /// <summary>
82 /// Looks up a localized string similar to There was an error opening {0}.
83 /// </summary>
84 internal static string ErrorOpeningFolder {
85 get {
86 return ResourceManager.GetString("ErrorOpeningFolder", resourceCulture);
87 }
88 }
89
90 /// <summary>
91 /// Looks up a localized string similar to {0} , Completed {1}% at {2} {3}.
92 /// </summary>
93 internal static string OperationStateNotification {
94 get {
95 return ResourceManager.GetString("OperationStateNotification", resourceCulture);
96 }
97 }
98
99 /// <summary>
100 /// Looks up a localized string similar to Upload finished for {0}.
101 /// </summary>
102 internal static string UploadFinishedNotification {
103 get {
104 return ResourceManager.GetString("UploadFinishedNotification", resourceCulture);
105 }
106 }
107
108 /// <summary>
109 /// Looks up a localized string similar to Upload started for {0}.
110 /// </summary>
111 internal static string UploadStartedNotification {
112 get {
113 return ResourceManager.GetString("UploadStartedNotification", resourceCulture);
114 }
115 }
116 }
117}
0118
=== added file 'src/Canonical.UbuntuOne.Client/Notification/NotificationResources.resx'
--- src/Canonical.UbuntuOne.Client/Notification/NotificationResources.resx 1970-01-01 00:00:00 +0000
+++ src/Canonical.UbuntuOne.Client/Notification/NotificationResources.resx 2010-08-09 16:14:47 +0000
@@ -0,0 +1,138 @@
1<?xml version="1.0" encoding="utf-8"?>
2<root>
3 <!--
4 Microsoft ResX Schema
5
6 Version 2.0
7
8 The primary goals of this format is to allow a simple XML format
9 that is mostly human readable. The generation and parsing of the
10 various data types are done through the TypeConverter classes
11 associated with the data types.
12
13 Example:
14
15 ... ado.net/XML headers & schema ...
16 <resheader name="resmimetype">text/microsoft-resx</resheader>
17 <resheader name="version">2.0</resheader>
18 <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19 <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20 <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21 <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22 <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23 <value>[base64 mime encoded serialized .NET Framework object]</value>
24 </data>
25 <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26 <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27 <comment>This is a comment</comment>
28 </data>
29
30 There are any number of "resheader" rows that contain simple
31 name/value pairs.
32
33 Each data row contains a name, and value. The row also contains a
34 type or mimetype. Type corresponds to a .NET class that support
35 text/value conversion through the TypeConverter architecture.
36 Classes that don't support this are serialized and stored with the
37 mimetype set.
38
39 The mimetype is used for serialized objects, and tells the
40 ResXResourceReader how to depersist the object. This is currently not
41 extensible. For a given mimetype the value must be set accordingly:
42
43 Note - application/x-microsoft.net.object.binary.base64 is the format
44 that the ResXResourceWriter will generate, however the reader can
45 read any of the formats listed below.
46
47 mimetype: application/x-microsoft.net.object.binary.base64
48 value : The object must be serialized with
49 : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50 : and then encoded with base64 encoding.
51
52 mimetype: application/x-microsoft.net.object.soap.base64
53 value : The object must be serialized with
54 : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55 : and then encoded with base64 encoding.
56
57 mimetype: application/x-microsoft.net.object.bytearray.base64
58 value : The object must be serialized into a byte array
59 : using a System.ComponentModel.TypeConverter
60 : and then encoded with base64 encoding.
61 -->
62 <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63 <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64 <xsd:element name="root" msdata:IsDataSet="true">
65 <xsd:complexType>
66 <xsd:choice maxOccurs="unbounded">
67 <xsd:element name="metadata">
68 <xsd:complexType>
69 <xsd:sequence>
70 <xsd:element name="value" type="xsd:string" minOccurs="0" />
71 </xsd:sequence>
72 <xsd:attribute name="name" use="required" type="xsd:string" />
73 <xsd:attribute name="type" type="xsd:string" />
74 <xsd:attribute name="mimetype" type="xsd:string" />
75 <xsd:attribute ref="xml:space" />
76 </xsd:complexType>
77 </xsd:element>
78 <xsd:element name="assembly">
79 <xsd:complexType>
80 <xsd:attribute name="alias" type="xsd:string" />
81 <xsd:attribute name="name" type="xsd:string" />
82 </xsd:complexType>
83 </xsd:element>
84 <xsd:element name="data">
85 <xsd:complexType>
86 <xsd:sequence>
87 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88 <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89 </xsd:sequence>
90 <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91 <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92 <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93 <xsd:attribute ref="xml:space" />
94 </xsd:complexType>
95 </xsd:element>
96 <xsd:element name="resheader">
97 <xsd:complexType>
98 <xsd:sequence>
99 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100 </xsd:sequence>
101 <xsd:attribute name="name" type="xsd:string" use="required" />
102 </xsd:complexType>
103 </xsd:element>
104 </xsd:choice>
105 </xsd:complexType>
106 </xsd:element>
107 </xsd:schema>
108 <resheader name="resmimetype">
109 <value>text/microsoft-resx</value>
110 </resheader>
111 <resheader name="version">
112 <value>2.0</value>
113 </resheader>
114 <resheader name="reader">
115 <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116 </resheader>
117 <resheader name="writer">
118 <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119 </resheader>
120 <data name="DownloadFinishedNotification" xml:space="preserve">
121 <value>Download finished for {0}</value>
122 </data>
123 <data name="DownloadStartedNotitication" xml:space="preserve">
124 <value>Download started for {0}</value>
125 </data>
126 <data name="ErrorOpeningFolder" xml:space="preserve">
127 <value>There was an error opening {0}</value>
128 </data>
129 <data name="OperationStateNotification" xml:space="preserve">
130 <value>{0} , Completed {1}% at {2} {3}</value>
131 </data>
132 <data name="UploadFinishedNotification" xml:space="preserve">
133 <value>Upload finished for {0}</value>
134 </data>
135 <data name="UploadStartedNotification" xml:space="preserve">
136 <value>Upload started for {0}</value>
137 </data>
138</root>
0\ No newline at end of file139\ No newline at end of file
1140
=== modified file 'src/Canonical.UbuntuOne.Client/Notification/OperationCompletenessEventArgs.cs'
--- src/Canonical.UbuntuOne.Client/Notification/OperationCompletenessEventArgs.cs 2010-07-27 11:58:32 +0000
+++ src/Canonical.UbuntuOne.Client/Notification/OperationCompletenessEventArgs.cs 2010-08-09 16:14:47 +0000
@@ -34,25 +34,30 @@
34 }34 }
3535
36 /// <summary>36 /// <summary>
37 /// 37 /// The percentage of the operation that has been done.
38 /// </summary>38 /// </summary>
39 public int Percentage { get; set; }39 public int Percentage { get; set; }
4040
41 /// <summary>41 /// <summary>
42 /// 42 /// The speed in which the operation is being done.
43 /// </summary>43 /// </summary>
44 public double Speed { get; set; }44 public double Speed { get; set; }
4545
46 /// <summary>46 /// <summary>
47 /// 47 /// The unit used in the speed.
48 /// </summary>48 /// </summary>
49 public SpeedUnitsEnum SpeedUnits { get; set; }49 public SpeedUnitsEnum SpeedUnits { get; set; }
5050
51 /// <summary>51 /// <summary>
52 /// A string with the operation that is being performed.
53 /// </summary>
54 public string Operation { get; set; }
55
56 /// <summary>
52 /// Creates a new event arge with all its data init to the default values.57 /// Creates a new event arge with all its data init to the default values.
53 /// </summary>58 /// </summary>
54 public OperationCompletenessEventArgs()59 public OperationCompletenessEventArgs()
55 : this(0, 0, SpeedUnitsEnum.MB)60 : this("", 0, 0, SpeedUnitsEnum.MB)
56 {61 {
57 62
58 }63 }
@@ -60,11 +65,13 @@
60 /// <summary>65 /// <summary>
61 /// Creates a new event arg that can be used to state the current completness of an operation.66 /// Creates a new event arg that can be used to state the current completness of an operation.
62 /// </summary>67 /// </summary>
68 /// <param name="operation">A string with the operation that is being performed.</param>
63 /// <param name="percentage">The percentage of the operation that has been done.</param>69 /// <param name="percentage">The percentage of the operation that has been done.</param>
64 /// <param name="speed">The speed in which the operation is done.</param>70 /// <param name="speed">The speed in which the operation is done.</param>
65 /// <param name="units">The units used in the speed.</param>71 /// <param name="units">The units used in the speed.</param>
66 public OperationCompletenessEventArgs(int percentage, double speed, SpeedUnitsEnum units)72 public OperationCompletenessEventArgs(string operation, int percentage, double speed, SpeedUnitsEnum units)
67 {73 {
74 Operation = operation;
68 Percentage = percentage;75 Percentage = percentage;
69 Speed = speed;76 Speed = speed;
70 SpeedUnits = units;77 SpeedUnits = units;
7178
=== removed file 'src/Canonical.UbuntuOne.Client/Preferences/IPreferencesDialog.cs'
--- src/Canonical.UbuntuOne.Client/Preferences/IPreferencesDialog.cs 2010-07-27 15:36:33 +0000
+++ src/Canonical.UbuntuOne.Client/Preferences/IPreferencesDialog.cs 1970-01-01 00:00:00 +0000
@@ -1,30 +0,0 @@
1/**
2 * Copyright 2010 Canonical Ltd.
3 *
4 * This file is part of UbuntuOne on Windows.
5 *
6 * UbuntuOne on Windows is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License version
8 * as published by the Free Software Foundation.
9 *
10 * Ubuntu One on Windows is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with UbuntuOne for Windows. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * Authors: Manuel de la Peña <manuel.delapena@canonical.com>
19 */
20
21namespace Canonical.UbuntuOne.Client.Preferences
22{
23 /// <summary>
24 /// Interface to be implemented by those dialogs used tod isaply preferences.
25 /// </summary>
26 public interface IPreferencesDialog
27 {
28 void Show();
29 }
30}
310
=== added file 'src/Canonical.UbuntuOne.Client/Preferences/IPreferencesDialogPresenter.cs'
--- src/Canonical.UbuntuOne.Client/Preferences/IPreferencesDialogPresenter.cs 1970-01-01 00:00:00 +0000
+++ src/Canonical.UbuntuOne.Client/Preferences/IPreferencesDialogPresenter.cs 2010-08-09 16:14:47 +0000
@@ -0,0 +1,30 @@
1/**
2 * Copyright 2010 Canonical Ltd.
3 *
4 * This file is part of UbuntuOne on Windows.
5 *
6 * UbuntuOne on Windows is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License version
8 * as published by the Free Software Foundation.
9 *
10 * Ubuntu One on Windows is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with UbuntuOne for Windows. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * Authors: Manuel de la Peña <manuel.delapena@canonical.com>
19 */
20
21namespace Canonical.UbuntuOne.Client.Preferences
22{
23 /// <summary>
24 /// Interface to be implemented by those dialogs used tod isaply preferences.
25 /// </summary>
26 public interface IPreferencesDialogPresenter
27 {
28 void Show();
29 }
30}
031
=== modified file 'src/Canonical.UbuntuOne.Client/Properties/AssemblyInfo.cs'
--- src/Canonical.UbuntuOne.Client/Properties/AssemblyInfo.cs 2010-07-30 09:33:20 +0000
+++ src/Canonical.UbuntuOne.Client/Properties/AssemblyInfo.cs 2010-08-09 16:14:47 +0000
@@ -21,4 +21,5 @@
2121
22// The following GUID is for the ID of the typelib if this project is exposed to COM22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("3c7586a6-40ca-463b-b12c-b0aed0f4cb92")]23[assembly: Guid("3c7586a6-40ca-463b-b12c-b0aed0f4cb92")]
24[assembly: InternalsVisibleTo("Canonical.UbuntuOne.Client.Test")]
2425
2526
=== modified file 'src/Canonical.UbuntuOne.Client/SyncDaemonClient.cs'
--- src/Canonical.UbuntuOne.Client/SyncDaemonClient.cs 2010-07-27 15:02:26 +0000
+++ src/Canonical.UbuntuOne.Client/SyncDaemonClient.cs 2010-08-09 16:14:47 +0000
@@ -18,13 +18,35 @@
18 * Authors: Manuel de la Peña <manuel.delapena@canonical.com>18 * Authors: Manuel de la Peña <manuel.delapena@canonical.com>
19 */19 */
20using System;20using System;
21using Canonical.UbuntuOne.Client.Notification;
21using Canonical.UbuntuOne.Common;22using Canonical.UbuntuOne.Common;
22using Canonical.UbuntuOne.Common.Validation;23using Canonical.UbuntuOne.Common.Validation;
2324
24namespace Canonical.UbuntuOne.Client25namespace Canonical.UbuntuOne.Client
25{26{
26 class SyncDaemonClient : ISyncDaemonClient27 class SyncDaemonClient : ISyncDaemonClient, ISyncDaemonClientNotifier
27 {28 {
29 #region ISyncDaemonClientNotifier implementation
30
31 public event EventHandler<NotificationEventArgs> OnNotification;
32 public event EventHandler<OperationCompletenessEventArgs> OnOperationCompletness;
33 public event EventHandler<RecentlyModifiedEventArgs> OnRecentlyModifiedChanged;
34 public event EventHandler<StateEventArgs> OnStateChanged;
35
36 #endregion
37
38 #region Helper methods
39
40 private void NotifyAction(string message)
41 {
42 if (OnNotification == null) return;
43 var args = new NotificationEventArgs(message);
44 OnNotification(this, args);
45 }
46 #endregion
47
48 #region ISyncDaemonClient implementation
49
28 /// <summary>50 /// <summary>
29 /// Callback performed when a download starts.51 /// Callback performed when a download starts.
30 /// </summary>52 /// </summary>
@@ -34,8 +56,7 @@
34 ValidateArgs.Begin()56 ValidateArgs.Begin()
35 .IsNotNull(data, "data")57 .IsNotNull(data, "data")
36 .Check();58 .Check();
3759 NotifyAction(String.Format(NotificationResources.DownloadStartedNotitication, data.Path));
38 throw new NotImplementedException();
39 }60 }
4061
41 /// <summary>62 /// <summary>
@@ -47,8 +68,7 @@
47 ValidateArgs.Begin()68 ValidateArgs.Begin()
48 .IsNotNull(data)69 .IsNotNull(data)
49 .Check();70 .Check();
5071 NotifyAction(String.Format(NotificationResources.DownloadFinishedNotification, data.Path));
51 throw new NotImplementedException();
52 }72 }
5373
54 /// <summary>74 /// <summary>
@@ -61,7 +81,7 @@
61 .IsNotNull(data)81 .IsNotNull(data)
62 .Check();82 .Check();
6383
64 throw new NotImplementedException();84 NotifyAction(String.Format(NotificationResources.UploadStartedNotification, data.Path));
65 }85 }
6686
67 /// <summary>87 /// <summary>
@@ -73,7 +93,7 @@
73 ValidateArgs.Begin()93 ValidateArgs.Begin()
74 .IsNotNull(data, "data")94 .IsNotNull(data, "data")
75 .Check();95 .Check();
76 throw new NotImplementedException();96 NotifyAction(String.Format(NotificationResources.UploadFinishedNotification, data.Path));
77 }97 }
7898
79 /// <summary>99 /// <summary>
@@ -85,7 +105,7 @@
85 ValidateArgs.Begin()105 ValidateArgs.Begin()
86 .IsNotNull(data, "data")106 .IsNotNull(data, "data")
87 .Check();107 .Check();
88 throw new NotImplementedException();108
89 }109 }
90110
91 /// <summary>111 /// <summary>
@@ -233,5 +253,7 @@
233 .Check();253 .Check();
234 throw new NotImplementedException();254 throw new NotImplementedException();
235 }255 }
256
257 #endregion
236 }258 }
237}259}
238260
=== modified file 'src/Canonical.UbuntuOne.Common/Canonical.UbuntuOne.Common.csproj'
--- src/Canonical.UbuntuOne.Common/Canonical.UbuntuOne.Common.csproj 2010-08-04 14:23:27 +0000
+++ src/Canonical.UbuntuOne.Common/Canonical.UbuntuOne.Common.csproj 2010-08-09 16:14:47 +0000
@@ -57,9 +57,15 @@
57 <Compile Include="Container\SpringContainer.cs" />57 <Compile Include="Container\SpringContainer.cs" />
58 <Compile Include="Container\UnsatisfiedDependencyException.cs" />58 <Compile Include="Container\UnsatisfiedDependencyException.cs" />
59 <Compile Include="IAuthentication.cs" />59 <Compile Include="IAuthentication.cs" />
60 <Compile Include="Utils\ApplicationWrapper.cs" />
61 <Compile Include="Utils\Explorer.cs" />
62 <Compile Include="Utils\ExplorerException.cs" />
63 <Compile Include="Utils\IApplication.cs" />
64 <Compile Include="Utils\IExplorer.cs" />
60 <Compile Include="IMessageBox.cs" />65 <Compile Include="IMessageBox.cs" />
61 <Compile Include="IProcessManager.cs" />66 <Compile Include="IProcessManager.cs" />
62 <Compile Include="IProcessManagerFactory.cs" />67 <Compile Include="IProcessManagerFactory.cs" />
68 <Compile Include="Utils\IWebbrowser.cs" />
63 <Compile Include="ProcessManagementException.cs" />69 <Compile Include="ProcessManagementException.cs" />
64 <Compile Include="ProcessManager.cs" />70 <Compile Include="ProcessManager.cs" />
65 <Compile Include="SyncDaemonAuthentication.cs" />71 <Compile Include="SyncDaemonAuthentication.cs" />
@@ -106,6 +112,7 @@
106 <Compile Include="Validation\ValidateArgs.cs" />112 <Compile Include="Validation\ValidateArgs.cs" />
107 <Compile Include="Validation\ValidationException.cs" />113 <Compile Include="Validation\ValidationException.cs" />
108 <Compile Include="Validation\ValidationExtensions.cs" />114 <Compile Include="Validation\ValidationExtensions.cs" />
115 <Compile Include="Utils\Webbrowser.cs" />
109 </ItemGroup>116 </ItemGroup>
110 <ItemGroup>117 <ItemGroup>
111 <Reference Include="DotUpdater, Version=0.2.0.4, Culture=neutral, processorArchitecture=MSIL">118 <Reference Include="DotUpdater, Version=0.2.0.4, Culture=neutral, processorArchitecture=MSIL">
@@ -120,6 +127,9 @@
120 <SpecificVersion>False</SpecificVersion>127 <SpecificVersion>False</SpecificVersion>
121 <HintPath>..\..\lib\log4net\log4net.dll</HintPath>128 <HintPath>..\..\lib\log4net\log4net.dll</HintPath>
122 </Reference>129 </Reference>
130 <Reference Include="PresentationCore">
131 <RequiredTargetFramework>3.0</RequiredTargetFramework>
132 </Reference>
123 <Reference Include="PresentationFramework">133 <Reference Include="PresentationFramework">
124 <RequiredTargetFramework>3.0</RequiredTargetFramework>134 <RequiredTargetFramework>3.0</RequiredTargetFramework>
125 </Reference>135 </Reference>
126136
=== modified file 'src/Canonical.UbuntuOne.Common/OperationContracts/ISyncConfiguration.cs'
--- src/Canonical.UbuntuOne.Common/OperationContracts/ISyncConfiguration.cs 2010-07-07 10:41:49 +0000
+++ src/Canonical.UbuntuOne.Common/OperationContracts/ISyncConfiguration.cs 2010-08-09 16:14:47 +0000
@@ -29,6 +29,13 @@
29 public interface ISyncConfiguration29 public interface ISyncConfiguration
30 {30 {
31 /// <summary>31 /// <summary>
32 /// Provides a way that the client can use to register itself to be notified about events
33 /// through callbacks. The client should implemented the ISyncDaemonClient interface.
34 /// </summary>
35 [OperationContract(IsOneWay = true)]
36 void RegisterClient();
37
38 /// <summary>
32 /// Returns the throttling limits that have been set up for the daemon.39 /// Returns the throttling limits that have been set up for the daemon.
33 /// </summary>40 /// </summary>
34 /// <returns>The upload and downloads limits that the daemon has.</returns>41 /// <returns>The upload and downloads limits that the daemon has.</returns>
3542
=== modified file 'src/Canonical.UbuntuOne.Common/OperationContracts/ISyncDaemon.cs'
--- src/Canonical.UbuntuOne.Common/OperationContracts/ISyncDaemon.cs 2010-07-07 10:41:49 +0000
+++ src/Canonical.UbuntuOne.Common/OperationContracts/ISyncDaemon.cs 2010-08-09 16:14:47 +0000
@@ -33,6 +33,13 @@
33 SessionMode = SessionMode.Required)]33 SessionMode = SessionMode.Required)]
34 public interface ISyncDaemon34 public interface ISyncDaemon
35 {35 {
36 /// <summary>
37 /// Provides a way that the client can use to register itself to be notified about events
38 /// through callbacks. The client should implemented the ISyncDaemonClient interface.
39 /// </summary>
40 [OperationContract(IsOneWay = true)]
41 void RegisterClient();
42
36 /// <summary>43 /// <summary>
37 /// Allows to start the daemon by a client.44 /// Allows to start the daemon by a client.
38 /// </summary>45 /// </summary>
3946
=== modified file 'src/Canonical.UbuntuOne.Common/OperationContracts/ISyncFileManager.cs'
--- src/Canonical.UbuntuOne.Common/OperationContracts/ISyncFileManager.cs 2010-07-07 10:41:49 +0000
+++ src/Canonical.UbuntuOne.Common/OperationContracts/ISyncFileManager.cs 2010-08-09 16:14:47 +0000
@@ -32,7 +32,18 @@
32 SessionMode = SessionMode.Required)]32 SessionMode = SessionMode.Required)]
33 public interface ISyncFileManager33 public interface ISyncFileManager
34 {34 {
35 /// <summary>
36 /// Provides a way that the client can use to register itself to be notified about events
37 /// through callbacks. The client should implemented the ISyncDaemonClient interface.
38 /// </summary>
39 [OperationContract(IsOneWay = true)]
40 void RegisterClient();
3541
42 /// <summary>
43 /// Returns the metadata
44 /// </summary>
45 /// <param name="path"></param>
46 /// <returns></returns>
36 [OperationContract]47 [OperationContract]
37 IDictionary<string, string> GetMetadata(string path);48 IDictionary<string, string> GetMetadata(string path);
38 }49 }
3950
=== modified file 'src/Canonical.UbuntuOne.Common/OperationContracts/ISyncFolders.cs'
--- src/Canonical.UbuntuOne.Common/OperationContracts/ISyncFolders.cs 2010-07-07 10:41:49 +0000
+++ src/Canonical.UbuntuOne.Common/OperationContracts/ISyncFolders.cs 2010-08-09 16:14:47 +0000
@@ -30,6 +30,13 @@
30 public interface ISyncFolders30 public interface ISyncFolders
31 {31 {
32 /// <summary>32 /// <summary>
33 /// Provides a way that the client can use to register itself to be notified about events
34 /// through callbacks. The client should implemented the ISyncDaemonClient interface.
35 /// </summary>
36 [OperationContract(IsOneWay = true)]
37 void RegisterClient();
38
39 /// <summary>
33 /// Creates a new udf for the given path.40 /// Creates a new udf for the given path.
34 /// </summary>41 /// </summary>
35 /// <param name="path">The path to which the Udf will be created.</param>42 /// <param name="path">The path to which the Udf will be created.</param>
3643
=== modified file 'src/Canonical.UbuntuOne.Common/OperationContracts/ISyncShares.cs'
--- src/Canonical.UbuntuOne.Common/OperationContracts/ISyncShares.cs 2010-07-07 10:41:49 +0000
+++ src/Canonical.UbuntuOne.Common/OperationContracts/ISyncShares.cs 2010-08-09 16:14:47 +0000
@@ -30,6 +30,13 @@
30 public interface ISyncShares30 public interface ISyncShares
31 {31 {
32 /// <summary>32 /// <summary>
33 /// Provides a way that the client can use to register itself to be notified about events
34 /// through callbacks. The client should implemented the ISyncDaemonClient interface.
35 /// </summary>
36 [OperationContract(IsOneWay = true)]
37 void RegisterClient();
38
39 /// <summary>
33 /// Allows the client to query and get all the different shares that the user has.40 /// Allows the client to query and get all the different shares that the user has.
34 /// </summary>41 /// </summary>
35 /// <returns>Returns a list with all the shares that the user has.</returns>42 /// <returns>Returns a list with all the shares that the user has.</returns>
3643
=== added directory 'src/Canonical.UbuntuOne.Common/Utils'
=== added file 'src/Canonical.UbuntuOne.Common/Utils/ApplicationWrapper.cs'
--- src/Canonical.UbuntuOne.Common/Utils/ApplicationWrapper.cs 1970-01-01 00:00:00 +0000
+++ src/Canonical.UbuntuOne.Common/Utils/ApplicationWrapper.cs 2010-08-09 16:14:47 +0000
@@ -0,0 +1,63 @@
1/**
2 * Copyright 2010 Canonical Ltd.
3 *
4 * This file is part of UbuntuOne on Windows.
5 *
6 * UbuntuOne on Windows is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License version
8 * as published by the Free Software Foundation.
9 *
10 * Ubuntu One on Windows is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with UbuntuOne for Windows. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * Authors: Manuel de la Peña <manuel.delapena@canonical.com>
19 */
20using System.Windows;
21
22namespace Canonical.UbuntuOne.Common.Utils
23{
24 public class ApplicationWrapper : IApplication
25 {
26 private readonly Application _app;
27
28 public ApplicationWrapper()
29 {
30 _app = new Application();
31 }
32
33 #region Implementation of IApplication
34
35 /// <summary>
36 /// Allows to start the application using the passed window.
37 /// </summary>
38 /// <param name="startWindow">The main window of the application.</param>
39 public void Run(Window startWindow)
40 {
41 _app.Run(startWindow);
42 }
43
44 /// <summary>
45 /// Gets and sets the shutdown mode to be used in the application.
46 /// </summary>
47 public ShutdownMode ShutdownMode
48 {
49 get { return _app.ShutdownMode; }
50 set { _app.ShutdownMode = value; }
51 }
52
53 /// <summary>
54 /// Allows to close the application.
55 /// </summary>
56 public void Exit()
57 {
58 _app.Shutdown();
59 }
60
61 #endregion
62 }
63}
064
=== added file 'src/Canonical.UbuntuOne.Common/Utils/Explorer.cs'
--- src/Canonical.UbuntuOne.Common/Utils/Explorer.cs 1970-01-01 00:00:00 +0000
+++ src/Canonical.UbuntuOne.Common/Utils/Explorer.cs 2010-08-09 16:14:47 +0000
@@ -0,0 +1,46 @@
1/**
2 * Copyright 2010 Canonical Ltd.
3 *
4 * This file is part of UbuntuOne on Windows.
5 *
6 * UbuntuOne on Windows is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License version
8 * as published by the Free Software Foundation.
9 *
10 * Ubuntu One on Windows is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with UbuntuOne for Windows. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * Authors: Manuel de la Peña <manuel.delapena@canonical.com>
19 */
20using System.Diagnostics;
21using System.IO;
22
23namespace Canonical.UbuntuOne.Common.Utils
24{
25
26 public class Explorer : IExplorer
27 {
28 private const string ExplorerProcess = "explorer.exe";
29
30 #region Implementation of IExplorer
31
32 /// <summary>
33 /// When implemented the method should open a location of a folder with the given path.
34 /// </summary>
35 public void OpenFolder(string folderFullPath)
36 {
37 if(!File.Exists(folderFullPath))
38 {
39 throw new ExplorerException("File not found.");
40 }
41 Process.Start(ExplorerProcess, folderFullPath);
42 }
43
44 #endregion
45 }
46}
047
=== added file 'src/Canonical.UbuntuOne.Common/Utils/ExplorerException.cs'
--- src/Canonical.UbuntuOne.Common/Utils/ExplorerException.cs 1970-01-01 00:00:00 +0000
+++ src/Canonical.UbuntuOne.Common/Utils/ExplorerException.cs 2010-08-09 16:14:47 +0000
@@ -0,0 +1,43 @@
1/**
2 * Copyright 2010 Canonical Ltd.
3 *
4 * This file is part of UbuntuOne on Windows.
5 *
6 * UbuntuOne on Windows is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License version
8 * as published by the Free Software Foundation.
9 *
10 * Ubuntu One on Windows is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with UbuntuOne for Windows. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * Authors: Manuel de la Peña <manuel.delapena@canonical.com>
19 */
20using System;
21
22namespace Canonical.UbuntuOne.Common.Utils
23{
24 public class ExplorerException : Exception
25 {
26 public ExplorerException()
27 {
28
29 }
30
31 public ExplorerException(string message)
32 : base(message)
33 {
34
35 }
36
37 public ExplorerException(string message, Exception inner)
38 : base(message, inner)
39 {
40
41 }
42 }
43}
044
=== added file 'src/Canonical.UbuntuOne.Common/Utils/IApplication.cs'
--- src/Canonical.UbuntuOne.Common/Utils/IApplication.cs 1970-01-01 00:00:00 +0000
+++ src/Canonical.UbuntuOne.Common/Utils/IApplication.cs 2010-08-09 16:14:47 +0000
@@ -0,0 +1,45 @@
1/**
2 * Copyright 2010 Canonical Ltd.
3 *
4 * This file is part of UbuntuOne on Windows.
5 *
6 * UbuntuOne on Windows is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License version
8 * as published by the Free Software Foundation.
9 *
10 * Ubuntu One on Windows is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with UbuntuOne for Windows. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * Authors: Manuel de la Peña <manuel.delapena@canonical.com>
19 */
20using System.Windows;
21
22namespace Canonical.UbuntuOne.Common.Utils
23{
24 /// <summary>
25 /// Interface that allows to abstract an application in C# allowing to make the code more testable.
26 /// </summary>
27 public interface IApplication
28 {
29 /// <summary>
30 /// Allows to start the application using the passed window.
31 /// </summary>
32 /// <param name="startWindow">The main window of the application.</param>
33 void Run(Window startWindow);
34
35 /// <summary>
36 /// Gets and sets the shutdown mode to be used in the application.
37 /// </summary>
38 ShutdownMode ShutdownMode { get; set; }
39
40 /// <summary>
41 /// Allows to close the application.
42 /// </summary>
43 void Exit();
44 }
45}
046
=== added file 'src/Canonical.UbuntuOne.Common/Utils/IExplorer.cs'
--- src/Canonical.UbuntuOne.Common/Utils/IExplorer.cs 1970-01-01 00:00:00 +0000
+++ src/Canonical.UbuntuOne.Common/Utils/IExplorer.cs 2010-08-09 16:14:47 +0000
@@ -0,0 +1,29 @@
1/**
2 * Copyright 2010 Canonical Ltd.
3 *
4 * This file is part of UbuntuOne on Windows.
5 *
6 * UbuntuOne on Windows is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License version
8 * as published by the Free Software Foundation.
9 *
10 * Ubuntu One on Windows is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with UbuntuOne for Windows. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * Authors: Manuel de la Peña <manuel.delapena@canonical.com>
19 */
20namespace Canonical.UbuntuOne.Common.Utils
21{
22 public interface IExplorer
23 {
24 /// <summary>
25 /// When implemented the method should open a location of a folder with the given path.
26 /// </summary>
27 void OpenFolder(string folderFullPath);
28 }
29}
030
=== added file 'src/Canonical.UbuntuOne.Common/Utils/IWebbrowser.cs'
--- src/Canonical.UbuntuOne.Common/Utils/IWebbrowser.cs 1970-01-01 00:00:00 +0000
+++ src/Canonical.UbuntuOne.Common/Utils/IWebbrowser.cs 2010-08-09 16:14:47 +0000
@@ -0,0 +1,29 @@
1/**
2 * Copyright 2010 Canonical Ltd.
3 *
4 * This file is part of UbuntuOne on Windows.
5 *
6 * UbuntuOne on Windows is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License version
8 * as published by the Free Software Foundation.
9 *
10 * Ubuntu One on Windows is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with UbuntuOne for Windows. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * Authors: Manuel de la Peña <manuel.delapena@canonical.com>
19 */
20namespace Canonical.UbuntuOne.Common.Utils
21{
22 public interface IWebbrowser
23 {
24 /// <summary>
25 /// The implementation should open the default browser in the system and dispaly the passed url.
26 /// </summary>
27 void LauncWebpage(string url);
28 }
29}
030
=== added file 'src/Canonical.UbuntuOne.Common/Utils/Webbrowser.cs'
--- src/Canonical.UbuntuOne.Common/Utils/Webbrowser.cs 1970-01-01 00:00:00 +0000
+++ src/Canonical.UbuntuOne.Common/Utils/Webbrowser.cs 2010-08-09 16:14:47 +0000
@@ -0,0 +1,32 @@
1/**
2 * Copyright 2010 Canonical Ltd.
3 *
4 * This file is part of UbuntuOne on Windows.
5 *
6 * UbuntuOne on Windows is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License version
8 * as published by the Free Software Foundation.
9 *
10 * Ubuntu One on Windows is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with UbuntuOne for Windows. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * Authors: Manuel de la Peña <manuel.delapena@canonical.com>
19 */
20using System.Diagnostics;
21
22namespace Canonical.UbuntuOne.Common.Utils
23{
24 public class Webbrowser : IWebbrowser
25 {
26 public void LauncWebpage(string url)
27 {
28 // trust the console to open the correct app
29 Process.Start(url);
30 }
31 }
32}
033
=== modified file 'src/Canonical.UbuntuOne.Common/objects.xml'
--- src/Canonical.UbuntuOne.Common/objects.xml 2010-07-30 16:32:54 +0000
+++ src/Canonical.UbuntuOne.Common/objects.xml 2010-08-09 16:14:47 +0000
@@ -31,8 +31,19 @@
31 <property name="RSSFeed"31 <property name="RSSFeed"
32 value="http://path/to/rss.feed"/> <!-- Provide a way to set this through config ????-->32 value="http://path/to/rss.feed"/> <!-- Provide a way to set this through config ????-->
33 </object>33 </object>
34 34
35 35 <!-- ######################################################################################## -->
36 <!-- Util Objects -->
37 <!-- ######################################################################################## -->
38
39 <object id="Webbrowser"
40 type="Canonical.UbuntuOne.Common.Utils.Webbrowser, Canonical.UbuntuOne.Common" />
41
42 <object id="Explorer"
43 type="Canonical.UbuntuOne.Common.Utils.Explorer, Canonical.UbuntuOne.Common" />
44
45 <object id="Application"
46 type="Canonical.UbuntuOne.Common.Utils.ApplicationWrapper, Canonical.UbuntuOne.Common" />
36 47
37</objects>48</objects>
38 49
39\ No newline at end of file50\ No newline at end of file
4051
=== modified file 'src/Canonical.UbuntuOne.ProcessDispatcher/SyncConfigurationService.cs'
--- src/Canonical.UbuntuOne.ProcessDispatcher/SyncConfigurationService.cs 2010-07-26 11:10:16 +0000
+++ src/Canonical.UbuntuOne.ProcessDispatcher/SyncConfigurationService.cs 2010-08-09 16:14:47 +0000
@@ -26,6 +26,15 @@
26 class SyncConfigurationService : ISyncConfiguration26 class SyncConfigurationService : ISyncConfiguration
27 {27 {
28 /// <summary>28 /// <summary>
29 /// Provides a way that the client can use to register itself to be notified about events
30 /// through callbacks. The client should implemented the ISyncDaemonClient interface.
31 /// </summary>
32 public void RegisterClient()
33 {
34 throw new NotImplementedException();
35 }
36
37 /// <summary>
29 /// Returns the throttling limits that have been set up for the daemon.38 /// Returns the throttling limits that have been set up for the daemon.
30 /// </summary>39 /// </summary>
31 /// <returns>The upload and downloads limits that the daemon has.</returns>40 /// <returns>The upload and downloads limits that the daemon has.</returns>
3241
=== modified file 'src/Canonical.UbuntuOne.ProcessDispatcher/SyncDaemonService.cs'
--- src/Canonical.UbuntuOne.ProcessDispatcher/SyncDaemonService.cs 2010-07-26 11:10:16 +0000
+++ src/Canonical.UbuntuOne.ProcessDispatcher/SyncDaemonService.cs 2010-08-09 16:14:47 +0000
@@ -82,6 +82,7 @@
82 _processesMap = new Dictionary<string, IProcessManager>();82 _processesMap = new Dictionary<string, IProcessManager>();
83 }83 }
8484
85
85 /// <summary>86 /// <summary>
86 /// Allows to start the daemon by a client.87 /// Allows to start the daemon by a client.
87 /// </summary>88 /// </summary>
@@ -194,6 +195,15 @@
194 }195 }
195196
196 /// <summary>197 /// <summary>
198 /// Provides a way that the client can use to register itself to be notified about events
199 /// through callbacks. The client should implemented the ISyncDaemonClient interface.
200 /// </summary>
201 public void RegisterClient()
202 {
203 throw new NotImplementedException();
204 }
205
206 /// <summary>
197 /// Allows to query the service about the current status of the daemon.207 /// Allows to query the service about the current status of the daemon.
198 /// </summary>208 /// </summary>
199 /// <returns>A data contract that contains the current status of the daemon.</returns>209 /// <returns>A data contract that contains the current status of the daemon.</returns>
200210
=== modified file 'src/Canonical.UbuntuOne.ProcessDispatcher/SyncFileManagerService.cs'
--- src/Canonical.UbuntuOne.ProcessDispatcher/SyncFileManagerService.cs 2010-07-26 11:10:16 +0000
+++ src/Canonical.UbuntuOne.ProcessDispatcher/SyncFileManagerService.cs 2010-08-09 16:14:47 +0000
@@ -26,6 +26,15 @@
26{26{
27 class SyncFileManagerService : ISyncFileManager27 class SyncFileManagerService : ISyncFileManager
28 {28 {
29 /// <summary>
30 /// Provides a way that the client can use to register itself to be notified about events
31 /// through callbacks. The client should implemented the ISyncDaemonClient interface.
32 /// </summary>
33 public void RegisterClient()
34 {
35 throw new NotImplementedException();
36 }
37
29 [DebugLogged]38 [DebugLogged]
30 public IDictionary<string, string> GetMetadata(string path)39 public IDictionary<string, string> GetMetadata(string path)
31 {40 {
3241
=== modified file 'src/Canonical.UbuntuOne.ProcessDispatcher/SyncFoldersService.cs'
--- src/Canonical.UbuntuOne.ProcessDispatcher/SyncFoldersService.cs 2010-07-07 10:41:49 +0000
+++ src/Canonical.UbuntuOne.ProcessDispatcher/SyncFoldersService.cs 2010-08-09 16:14:47 +0000
@@ -26,6 +26,15 @@
26 class SyncFoldersService : ISyncFolders26 class SyncFoldersService : ISyncFolders
27 {27 {
28 /// <summary>28 /// <summary>
29 /// Provides a way that the client can use to register itself to be notified about events
30 /// through callbacks. The client should implemented the ISyncDaemonClient interface.
31 /// </summary>
32 public void RegisterClient()
33 {
34 throw new NotImplementedException();
35 }
36
37 /// <summary>
29 /// Creates a new udf for the given path.38 /// Creates a new udf for the given path.
30 /// </summary>39 /// </summary>
31 /// <param name="path">The path to which the Udf will be created.</param>40 /// <param name="path">The path to which the Udf will be created.</param>
3241
=== modified file 'src/Canonical.UbuntuOne.ProcessDispatcher/SyncSharesService.cs'
--- src/Canonical.UbuntuOne.ProcessDispatcher/SyncSharesService.cs 2010-07-26 11:10:16 +0000
+++ src/Canonical.UbuntuOne.ProcessDispatcher/SyncSharesService.cs 2010-08-09 16:14:47 +0000
@@ -27,6 +27,15 @@
27 class SyncSharesService : ISyncShares27 class SyncSharesService : ISyncShares
28 {28 {
29 /// <summary>29 /// <summary>
30 /// Provides a way that the client can use to register itself to be notified about events
31 /// through callbacks. The client should implemented the ISyncDaemonClient interface.
32 /// </summary>
33 public void RegisterClient()
34 {
35 throw new NotImplementedException();
36 }
37
38 /// <summary>
30 /// Allows the client to query and get all the different shares that the user has.39 /// Allows the client to query and get all the different shares that the user has.
31 /// </summary>40 /// </summary>
32 /// <returns>Returns a list with all the shares that the user has.</returns>41 /// <returns>Returns a list with all the shares that the user has.</returns>
3342
=== modified file 'src/UbuntuOneClient.Tests/ProgramFixture.cs'
--- src/UbuntuOneClient.Tests/ProgramFixture.cs 2010-08-05 19:26:54 +0000
+++ src/UbuntuOneClient.Tests/ProgramFixture.cs 2010-08-09 16:14:47 +0000
@@ -21,6 +21,7 @@
21using System.Windows;21using System.Windows;
22using Canonical.UbuntuOne.Client.Notification;22using Canonical.UbuntuOne.Client.Notification;
23using Canonical.UbuntuOne.Common.Update;23using Canonical.UbuntuOne.Common.Update;
24using Canonical.UbuntuOne.Common.Utils;
24using NUnit.Framework;25using NUnit.Framework;
25using Rhino.Mocks;26using Rhino.Mocks;
2627
@@ -79,7 +80,8 @@
79 _app.ShutdownMode = ShutdownMode.OnExplicitShutdown;80 _app.ShutdownMode = ShutdownMode.OnExplicitShutdown;
8081
81 // expect that we are calling the run with the correct window82 // expect that we are calling the run with the correct window
82 Expect.Call(() => _app.Run(_notifyIcon))83 Expect.Call(() => _app.Run(_notifyIcon as Window))
84 .IgnoreArguments()
83 .Repeat.Once();85 .Repeat.Once();
8486
85 // return that the are no update, since we have a strict mock the test will87 // return that the are no update, since we have a strict mock the test will
@@ -102,7 +104,8 @@
102 _app.ShutdownMode = ShutdownMode.OnExplicitShutdown;104 _app.ShutdownMode = ShutdownMode.OnExplicitShutdown;
103105
104 // expect that we are calling the run with the correct window106 // expect that we are calling the run with the correct window
105 Expect.Call(() => _app.Run(_notifyIcon))107 Expect.Call(() => _app.Run(_notifyIcon as Window))
108 .IgnoreArguments()
106 .Repeat.Once();109 .Repeat.Once();
107110
108 // return that the are no update, since we have a strict mock the test will111 // return that the are no update, since we have a strict mock the test will
@@ -127,7 +130,8 @@
127 _app.ShutdownMode = ShutdownMode.OnExplicitShutdown;130 _app.ShutdownMode = ShutdownMode.OnExplicitShutdown;
128131
129 // expect that we are calling the run with the correct window132 // expect that we are calling the run with the correct window
130 Expect.Call(() => _app.Run(_notifyIcon))133 Expect.Call(() => _app.Run(_notifyIcon as Window))
134 .IgnoreArguments()
131 .Repeat.Once();135 .Repeat.Once();
132136
133 // throw an exception and expect it to be caught and continue.137 // throw an exception and expect it to be caught and continue.
134138
=== modified file 'src/UbuntuOneClient.Tests/UbuntuOneClient.Tests.csproj'
--- src/UbuntuOneClient.Tests/UbuntuOneClient.Tests.csproj 2010-07-30 16:32:54 +0000
+++ src/UbuntuOneClient.Tests/UbuntuOneClient.Tests.csproj 2010-08-09 16:14:47 +0000
@@ -43,6 +43,9 @@
43 <SpecificVersion>False</SpecificVersion>43 <SpecificVersion>False</SpecificVersion>
44 <HintPath>..\..\lib\Nunit\nunit.framework.dll</HintPath>44 <HintPath>..\..\lib\Nunit\nunit.framework.dll</HintPath>
45 </Reference>45 </Reference>
46 <Reference Include="PresentationCore">
47 <RequiredTargetFramework>3.0</RequiredTargetFramework>
48 </Reference>
46 <Reference Include="PresentationFramework">49 <Reference Include="PresentationFramework">
47 <RequiredTargetFramework>3.0</RequiredTargetFramework>50 <RequiredTargetFramework>3.0</RequiredTargetFramework>
48 </Reference>51 </Reference>
4952
=== removed file 'src/UbuntuOneClient/ApplicationWrapper.cs'
--- src/UbuntuOneClient/ApplicationWrapper.cs 2010-07-28 11:03:35 +0000
+++ src/UbuntuOneClient/ApplicationWrapper.cs 1970-01-01 00:00:00 +0000
@@ -1,55 +0,0 @@
1using System;
2/**
3 * Copyright 2010 Canonical Ltd.
4 *
5 * This file is part of UbuntuOne on Windows.
6 *
7 * UbuntuOne on Windows is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License version
9 * as published by the Free Software Foundation.
10 *
11 * Ubuntu One on Windows is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with UbuntuOne for Windows. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * Authors: Manuel de la Peña <manuel.delapena@canonical.com>
20 */
21using System.Threading;
22using System.Windows;
23using Canonical.UbuntuOne.Client.Notification;
24using Canonical.UbuntuOne.Common.Validation;
25
26namespace UbuntuOneClient
27{
28 /// <summary>
29 /// Helper class that has been created to allow an easy way to test the Program class that starts the application.
30 /// </summary>
31 internal class ApplicationWrapper : IApplication
32 {
33 private readonly Application _app;
34
35 public ApplicationWrapper()
36 {
37 _app = new Application();
38 }
39
40 public void Run(INotificationIconView notificationIcon)
41 {
42 ValidateArgs.Begin()
43 .IsOfType(notificationIcon, typeof (Window), "notificationIcon")
44 .Check();
45 var window = (Window)notificationIcon;
46 _app.Run(window);
47 }
48
49 public ShutdownMode ShutdownMode
50 {
51 get { return _app.ShutdownMode; }
52 set { _app.ShutdownMode = value; }
53 }
54 }
55}
560
=== removed file 'src/UbuntuOneClient/IApplication.cs'
--- src/UbuntuOneClient/IApplication.cs 2010-07-28 11:03:35 +0000
+++ src/UbuntuOneClient/IApplication.cs 1970-01-01 00:00:00 +0000
@@ -1,41 +0,0 @@
1/**
2 * Copyright 2010 Canonical Ltd.
3 *
4 * This file is part of UbuntuOne on Windows.
5 *
6 * UbuntuOne on Windows is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License version
8 * as published by the Free Software Foundation.
9 *
10 * Ubuntu One on Windows is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with UbuntuOne for Windows. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * Authors: Manuel de la Peña <manuel.delapena@canonical.com>
19 */
20using System.Windows;
21using Canonical.UbuntuOne.Client.Notification;
22
23namespace UbuntuOneClient
24{
25 /// <summary>
26 /// Helper interface that has been added to make the code more testable in the program class.
27 /// </summary>
28 public interface IApplication
29 {
30 /// <summary>
31 /// Runs an application using the passed window as its main window in the thread.
32 /// </summary>
33 /// <param name="notificationIcon">The notification icon used by the user to interact with the daemon.</param>
34 void Run(INotificationIconView notificationIcon);
35
36 /// <summary>
37 /// Gets and sets the shutdown mode to be used in the application.
38 /// </summary>
39 ShutdownMode ShutdownMode { get; set; }
40 }
41}
420
=== modified file 'src/UbuntuOneClient/Program.cs'
--- src/UbuntuOneClient/Program.cs 2010-07-30 16:32:54 +0000
+++ src/UbuntuOneClient/Program.cs 2010-08-09 16:14:47 +0000
@@ -23,6 +23,7 @@
23using Canonical.UbuntuOne.Client.Notification;23using Canonical.UbuntuOne.Client.Notification;
24using Canonical.UbuntuOne.Common.Container;24using Canonical.UbuntuOne.Common.Container;
25using Canonical.UbuntuOne.Common.Update;25using Canonical.UbuntuOne.Common.Update;
26using Canonical.UbuntuOne.Common.Utils;
26using log4net;27using log4net;
2728
28namespace UbuntuOneClient29namespace UbuntuOneClient
@@ -125,7 +126,7 @@
125 _updatesThread = new Thread(CheckForUpdates);126 _updatesThread = new Thread(CheckForUpdates);
126 _updatesThread.Start();127 _updatesThread.Start();
127 // we do not worry about looping to allow the other thread to finish, we no that app should take longer128 // we do not worry about looping to allow the other thread to finish, we no that app should take longer
128 Application.Run(NotifyIcon);129 Application.Run(NotifyIcon as Window);
129 }130 }
130131
131 /// <summary>132 /// <summary>
132133
=== modified file 'src/UbuntuOneClient/UbuntuOneClient.csproj'
--- src/UbuntuOneClient/UbuntuOneClient.csproj 2010-08-02 17:57:48 +0000
+++ src/UbuntuOneClient/UbuntuOneClient.csproj 2010-08-09 16:14:47 +0000
@@ -65,8 +65,6 @@
65 <Compile Include="..\Version.cs">65 <Compile Include="..\Version.cs">
66 <Link>Version.cs</Link>66 <Link>Version.cs</Link>
67 </Compile>67 </Compile>
68 <Compile Include="ApplicationWrapper.cs" />
69 <Compile Include="IApplication.cs" />
70 <Compile Include="Program.cs" />68 <Compile Include="Program.cs" />
71 <Compile Include="Properties\AssemblyInfo.cs">69 <Compile Include="Properties\AssemblyInfo.cs">
72 <SubType>Code</SubType>70 <SubType>Code</SubType>
7371
=== modified file 'src/Version.cs'
--- src/Version.cs 2010-08-04 14:20:36 +0000
+++ src/Version.cs 2010-08-09 16:14:47 +0000
@@ -10,6 +10,6 @@
10// </auto-generated>10// </auto-generated>
11//------------------------------------------------------------------------------11//------------------------------------------------------------------------------
1212
13[assembly: AssemblyVersionAttribute("1.0.404.5869")]13[assembly: AssemblyVersionAttribute("1.0.409.6549")]
14[assembly: AssemblyFileVersionAttribute("1.0.404.5869")]14[assembly: AssemblyFileVersionAttribute("1.0.409.6549")]
1515

Subscribers

People subscribed via source and target branches

to all changes: