Merge lp:~mandel/ubuntuone-windows-installer/implement_notify_presenter into lp:ubuntuone-windows-installer/beta
- implement_notify_presenter
- Merge into 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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
John Lenton (community) | Approve | ||
Review via email: mp+31624@code.launchpad.net |
Commit message
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
1 | === modified file 'build.number' |
2 | --- build.number 2010-08-04 14:20:36 +0000 |
3 | +++ build.number 2010-08-09 16:14:47 +0000 |
4 | @@ -1,1 +1,1 @@ |
5 | -1.0.404.5869 |
6 | \ No newline at end of file |
7 | +1.0.409.6549 |
8 | \ No newline at end of file |
9 | |
10 | === modified file 'src/Canonical.UbuntuOne.Client.Test/Canonical.UbuntuOne.Client.Test.csproj' |
11 | --- src/Canonical.UbuntuOne.Client.Test/Canonical.UbuntuOne.Client.Test.csproj 2010-07-30 09:33:20 +0000 |
12 | +++ src/Canonical.UbuntuOne.Client.Test/Canonical.UbuntuOne.Client.Test.csproj 2010-08-09 16:14:47 +0000 |
13 | @@ -31,10 +31,18 @@ |
14 | <WarningLevel>4</WarningLevel> |
15 | </PropertyGroup> |
16 | <ItemGroup> |
17 | + <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL"> |
18 | + <SpecificVersion>False</SpecificVersion> |
19 | + <HintPath>..\..\lib\log4net\log4net.dll</HintPath> |
20 | + </Reference> |
21 | <Reference Include="nunit.framework, Version=2.5.5.10112, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL"> |
22 | <SpecificVersion>False</SpecificVersion> |
23 | <HintPath>..\..\lib\Nunit\nunit.framework.dll</HintPath> |
24 | </Reference> |
25 | + <Reference Include="Rhino.Mocks, Version=3.6.0.0, Culture=neutral, PublicKeyToken=0b3305902db7183f, processorArchitecture=MSIL"> |
26 | + <SpecificVersion>False</SpecificVersion> |
27 | + <HintPath>..\..\lib\RhinoMocks\Rhino.Mocks.dll</HintPath> |
28 | + </Reference> |
29 | <Reference Include="System" /> |
30 | <Reference Include="System.Core"> |
31 | <RequiredTargetFramework>3.5</RequiredTargetFramework> |
32 | @@ -53,6 +61,7 @@ |
33 | <Link>Properties\Version.cs</Link> |
34 | </Compile> |
35 | <Compile Include="Notification\NotificationEventArgsFixture.cs" /> |
36 | + <Compile Include="Notification\NotificationPresenterFixture.cs" /> |
37 | <Compile Include="Notification\OperationCompletenessEventArgsFixture.cs" /> |
38 | <Compile Include="Notification\RecentlyModifiedEventArgsFixture.cs" /> |
39 | <Compile Include="Notification\StateEventArgsFixture.cs" /> |
40 | @@ -63,6 +72,10 @@ |
41 | <Project>{7467483A-D6D5-4362-8DF4-57A7254EB569}</Project> |
42 | <Name>Canonical.UbuntuOne.Client</Name> |
43 | </ProjectReference> |
44 | + <ProjectReference Include="..\Canonical.UbuntuOne.Common\Canonical.UbuntuOne.Common.csproj"> |
45 | + <Project>{11353FF8-8E5A-488E-9CB1-873DADD232B9}</Project> |
46 | + <Name>Canonical.UbuntuOne.Common</Name> |
47 | + </ProjectReference> |
48 | </ItemGroup> |
49 | <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
50 | <!-- To modify your build process, add your task inside one of the targets below and uncomment it. |
51 | |
52 | === added file 'src/Canonical.UbuntuOne.Client.Test/Notification/NotificationPresenterFixture.cs' |
53 | --- src/Canonical.UbuntuOne.Client.Test/Notification/NotificationPresenterFixture.cs 1970-01-01 00:00:00 +0000 |
54 | +++ src/Canonical.UbuntuOne.Client.Test/Notification/NotificationPresenterFixture.cs 2010-08-09 16:14:47 +0000 |
55 | @@ -0,0 +1,294 @@ |
56 | +/** |
57 | + * Copyright 2010 Canonical Ltd. |
58 | + * |
59 | + * This file is part of UbuntuOne on Windows. |
60 | + * |
61 | + * UbuntuOne on Windows is free software: you can redistribute it and/or modify |
62 | + * it under the terms of the GNU Lesser General Public License version |
63 | + * as published by the Free Software Foundation. |
64 | + * |
65 | + * Ubuntu One on Windows is distributed in the hope that it will be useful, |
66 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
67 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
68 | + * GNU Lesser General Public License for more details. |
69 | + * |
70 | + * You should have received a copy of the GNU Lesser General Public License |
71 | + * along with UbuntuOne for Windows. If not, see <http://www.gnu.org/licenses/>. |
72 | + * |
73 | + * Authors: Manuel de la Peña <manuel.delapena@canonical.com> |
74 | + */ |
75 | +using System; |
76 | +using System.Collections.Generic; |
77 | +using Canonical.UbuntuOne.Client.Notification; |
78 | +using Canonical.UbuntuOne.Client.Preferences; |
79 | +using Canonical.UbuntuOne.Common.Utils; |
80 | +using log4net; |
81 | +using NUnit.Framework; |
82 | +using Rhino.Mocks; |
83 | +using Rhino.Mocks.Interfaces; |
84 | + |
85 | +namespace Canonical.UbuntuOne.Client.Test.Notification |
86 | +{ |
87 | + [TestFixture] |
88 | + public class NotificationPresenterFixture |
89 | + { |
90 | + |
91 | + #region Variables |
92 | + |
93 | + private MockRepository _mocks; |
94 | + private IApplication _app; |
95 | + private IExplorer _explorer; |
96 | + private IWebbrowser _browser; |
97 | + private IStateMapper _mapper; |
98 | + private IPreferencesDialogPresenter _preferences; |
99 | + private INotificationIconView _view; |
100 | + private ISyncDaemonClientNotifier _notifier; |
101 | + private NotificationIconPresenter _presenter; |
102 | + private ILog _logger; |
103 | + |
104 | + #endregion |
105 | + |
106 | + #region Setup |
107 | + |
108 | + [SetUp] |
109 | + public void Setup() |
110 | + { |
111 | + _mocks = new MockRepository(); |
112 | + _app = _mocks.StrictMock<IApplication>(); |
113 | + _explorer = _mocks.StrictMock<IExplorer>(); |
114 | + _browser = _mocks.StrictMock<IWebbrowser>(); |
115 | + _mapper = _mocks.StrictMock<IStateMapper>(); |
116 | + _preferences = _mocks.StrictMock<IPreferencesDialogPresenter>(); |
117 | + _view = _mocks.StrictMock<INotificationIconView>(); |
118 | + _notifier = _mocks.DynamicMock<ISyncDaemonClientNotifier>(); |
119 | + _logger = _mocks.StrictMock<ILog>(); |
120 | + _presenter = new NotificationIconPresenter |
121 | + { |
122 | + Application = _app, |
123 | + Explorer = _explorer, |
124 | + Webbrowser = _browser, |
125 | + StateMapper = _mapper, |
126 | + PreferencesDialogPresenter = _preferences, |
127 | + NotificationIconView = _view, |
128 | + Logger = _logger |
129 | + }; |
130 | + _mocks.BackToRecordAll(); |
131 | + } |
132 | + |
133 | + #endregion |
134 | + |
135 | + #region Tests |
136 | + |
137 | + [Test] |
138 | + public void OnStateChange() |
139 | + { |
140 | + IEventRaiser onStateRaiser; |
141 | + var args = new StateEventArgs(StateEventArgs.StateEnum.OUT_OF_SYNC); |
142 | + using (_mocks.Record()) |
143 | + { |
144 | + _notifier.OnStateChanged += null; |
145 | + onStateRaiser = LastCall.IgnoreArguments().GetEventRaiser(); |
146 | + |
147 | + Expect.Call(_mapper.ToString(args.State)) |
148 | + .Return("") |
149 | + .Repeat.Once(); |
150 | + _view.State = "new state"; |
151 | + |
152 | + LastCall.IgnoreArguments(); |
153 | + } |
154 | + using(_mocks.Playback()) |
155 | + { |
156 | + _presenter.SyncDaemonClientNotifier = _notifier; |
157 | + onStateRaiser.Raise(this, args); |
158 | + } |
159 | + } |
160 | + |
161 | + [Test] |
162 | + public void OnRecentlyModifiedTest() |
163 | + { |
164 | + IEventRaiser onRecentlyModifiedRaiser; |
165 | + var args = new RecentlyModifiedEventArgs(new List<string>()); |
166 | + using(_mocks.Record()) |
167 | + { |
168 | + _notifier.OnRecentlyModifiedChanged += null; |
169 | + onRecentlyModifiedRaiser = LastCall.IgnoreArguments().GetEventRaiser(); |
170 | + _view.RecentlyModifiedFiles = new List<string>(); |
171 | + LastCall.IgnoreArguments(); |
172 | + } |
173 | + using(_mocks.Playback()) |
174 | + { |
175 | + _presenter.SyncDaemonClientNotifier = _notifier; |
176 | + onRecentlyModifiedRaiser.Raise(this, args); |
177 | + } |
178 | + } |
179 | + |
180 | + [Test] |
181 | + public void OnOperationCompletnessTest() |
182 | + { |
183 | + IEventRaiser onOperationCompletnessRaiser; |
184 | + var args = new OperationCompletenessEventArgs("dowload", 45, 23.4, |
185 | + OperationCompletenessEventArgs.SpeedUnitsEnum.KB); |
186 | + using(_mocks.Record()) |
187 | + { |
188 | + _notifier.OnOperationCompletness += null; |
189 | + onOperationCompletnessRaiser = LastCall.IgnoreArguments().GetEventRaiser(); |
190 | + _view.CurrentOperation = ""; |
191 | + LastCall.IgnoreArguments(); |
192 | + } |
193 | + using(_mocks.Playback()) |
194 | + { |
195 | + _presenter.SyncDaemonClientNotifier = _notifier; |
196 | + onOperationCompletnessRaiser.Raise(this, args); |
197 | + } |
198 | + } |
199 | + |
200 | + [Test] |
201 | + public void OnNotificationTest() |
202 | + { |
203 | + IEventRaiser onNotificationRaiser; |
204 | + var notification = "mensagge"; |
205 | + var args = new NotificationEventArgs(notification); |
206 | + using (_mocks.Record()) |
207 | + { |
208 | + _notifier.OnNotification += null; |
209 | + onNotificationRaiser = LastCall.IgnoreArguments().GetEventRaiser(); |
210 | + _view.Notification = notification; |
211 | + } |
212 | + using(_mocks.Playback()) |
213 | + { |
214 | + _presenter.SyncDaemonClientNotifier = _notifier; |
215 | + onNotificationRaiser.Raise(this, args); |
216 | + } |
217 | + } |
218 | + |
219 | + [Test] |
220 | + public void OpenPreferencesTest() |
221 | + { |
222 | + using(_mocks.Record()) |
223 | + { |
224 | + Expect.Call(() => _preferences.Show()) |
225 | + .Repeat.Once(); |
226 | + } |
227 | + using(_mocks.Playback()) |
228 | + { |
229 | + _presenter.OpenUbuntuOnePreferences(); |
230 | + } |
231 | + } |
232 | + |
233 | + [Test] |
234 | + public void OpenShareLocationTest() |
235 | + { |
236 | + using(_mocks.Record()) |
237 | + { |
238 | + Expect.Call(() => _explorer.OpenFolder(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments))) |
239 | + .Repeat.Once(); |
240 | + } |
241 | + using(_mocks.Playback()) |
242 | + { |
243 | + _presenter.OpenSharesLocation(); |
244 | + } |
245 | + |
246 | + } |
247 | + |
248 | + [Test] |
249 | + [ExpectedException(typeof(ExplorerException))] |
250 | + public void OpenShareLocationExceptionTest() |
251 | + { |
252 | + using (_mocks.Record()) |
253 | + { |
254 | + Expect.Call(() => _explorer.OpenFolder("")) |
255 | + .IgnoreArguments() |
256 | + .Throw(new ExplorerException()); |
257 | + Expect.Call(() => _logger.WarnFormat("(0)", new ExplorerException())) |
258 | + .IgnoreArguments() |
259 | + .Repeat.Once(); |
260 | + _view.Notification = "error msg"; |
261 | + LastCall.IgnoreArguments(); |
262 | + } |
263 | + using (_mocks.Playback()) |
264 | + { |
265 | + _presenter.OpenSharesLocation(); |
266 | + } |
267 | + } |
268 | + |
269 | + [Test] |
270 | + public void OpenSyncsLocationTest() |
271 | + { |
272 | + using (_mocks.Record()) |
273 | + { |
274 | + Expect.Call(() => _explorer.OpenFolder(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments))) |
275 | + .Repeat.Once(); |
276 | + } |
277 | + using (_mocks.Playback()) |
278 | + { |
279 | + _presenter.OpenSyncsLocation(); |
280 | + } |
281 | + } |
282 | + |
283 | + [Test] |
284 | + [ExpectedException(typeof(ExplorerException))] |
285 | + public void OpenSyncsLocationExceptionTest() |
286 | + { |
287 | + using (_mocks.Record()) |
288 | + { |
289 | + Expect.Call(() => _explorer.OpenFolder("")) |
290 | + .IgnoreArguments() |
291 | + .Throw(new ExplorerException()); |
292 | + Expect.Call(() => _logger.WarnFormat("(0)", new ExplorerException())) |
293 | + .IgnoreArguments() |
294 | + .Repeat.Once(); |
295 | + _view.Notification = "error msg"; |
296 | + LastCall.IgnoreArguments(); |
297 | + } |
298 | + using (_mocks.Playback()) |
299 | + { |
300 | + _presenter.OpenSyncsLocation(); |
301 | + } |
302 | + } |
303 | + |
304 | + [Test] |
305 | + public void OpenHelpTest() |
306 | + { |
307 | + using (_mocks.Record()) |
308 | + { |
309 | + Expect.Call(() => _browser.LauncWebpage(NotificationIconPresenter.HelpUrl)) |
310 | + .Repeat.Once(); |
311 | + } |
312 | + using (_mocks.Playback()) |
313 | + { |
314 | + _presenter.OpenHelp(); |
315 | + } |
316 | + } |
317 | + |
318 | + [Test] |
319 | + public void OpenUpgradeOptionTest() |
320 | + { |
321 | + using (_mocks.Record()) |
322 | + { |
323 | + Expect.Call(() => _browser.LauncWebpage(NotificationIconPresenter.UpgradeUrl)) |
324 | + .Repeat.Once(); |
325 | + } |
326 | + using (_mocks.Playback()) |
327 | + { |
328 | + _presenter.OpenUpgradeOption(); |
329 | + } |
330 | + } |
331 | + |
332 | + [Test] |
333 | + public void ExitApplicationTest() |
334 | + { |
335 | + using (_mocks.Record()) |
336 | + { |
337 | + Expect.Call(() => _app.Exit()) |
338 | + .Repeat.Once(); |
339 | + } |
340 | + using (_mocks.Playback()) |
341 | + { |
342 | + _presenter.Exit(); |
343 | + } |
344 | + } |
345 | + |
346 | + #endregion |
347 | + |
348 | + } |
349 | +} |
350 | |
351 | === modified file 'src/Canonical.UbuntuOne.Client.Test/Notification/OperationCompletenessEventArgsFixture.cs' |
352 | --- src/Canonical.UbuntuOne.Client.Test/Notification/OperationCompletenessEventArgsFixture.cs 2010-07-27 11:57:29 +0000 |
353 | +++ src/Canonical.UbuntuOne.Client.Test/Notification/OperationCompletenessEventArgsFixture.cs 2010-08-09 16:14:47 +0000 |
354 | @@ -37,12 +37,13 @@ |
355 | Assert.AreEqual(OperationCompletenessEventArgs.SpeedUnitsEnum.MB, args.SpeedUnits); |
356 | } |
357 | |
358 | - [TestCase(1, 3.4, OperationCompletenessEventArgs.SpeedUnitsEnum.MB)] |
359 | - [TestCase(2323, 0.0, OperationCompletenessEventArgs.SpeedUnitsEnum.MB)] |
360 | - [TestCase(45, 23.4, OperationCompletenessEventArgs.SpeedUnitsEnum.KB)] |
361 | - public void ParametersConstructorTest(int percentage, double speed, OperationCompletenessEventArgs.SpeedUnitsEnum unitsEnum) |
362 | + [TestCase("work", 1, 3.4, OperationCompletenessEventArgs.SpeedUnitsEnum.MB)] |
363 | + [TestCase("dance", 2323, 0.0, OperationCompletenessEventArgs.SpeedUnitsEnum.MB)] |
364 | + [TestCase("dowload", 45, 23.4, OperationCompletenessEventArgs.SpeedUnitsEnum.KB)] |
365 | + public void ParametersConstructorTest(string operation, int percentage, double speed, OperationCompletenessEventArgs.SpeedUnitsEnum unitsEnum) |
366 | { |
367 | - var args = new OperationCompletenessEventArgs(percentage, speed, unitsEnum); |
368 | + var args = new OperationCompletenessEventArgs(operation, percentage, speed, unitsEnum); |
369 | + Assert.AreEqual(operation, args.Operation); |
370 | Assert.AreEqual(percentage, args.Percentage); |
371 | Assert.AreEqual(speed, args.Speed); |
372 | Assert.AreEqual(unitsEnum, args.SpeedUnits); |
373 | |
374 | === modified file 'src/Canonical.UbuntuOne.Client.Views/NotifyIcon.xaml.cs' |
375 | --- src/Canonical.UbuntuOne.Client.Views/NotifyIcon.xaml.cs 2010-07-28 11:06:07 +0000 |
376 | +++ src/Canonical.UbuntuOne.Client.Views/NotifyIcon.xaml.cs 2010-08-09 16:14:47 +0000 |
377 | @@ -17,7 +17,8 @@ |
378 | * |
379 | * Authors: Manuel de la Peña <manuel.delapena@canonical.com> |
380 | */ |
381 | -using System.Windows; |
382 | +using System; |
383 | +using System.Collections.Generic; |
384 | using Canonical.UbuntuOne.Client.Notification; |
385 | |
386 | namespace Canonical.UbuntuOne.Client.Views |
387 | @@ -25,11 +26,39 @@ |
388 | /// <summary> |
389 | /// Interaction logic for UbuntuOneNotifyIcon.xaml |
390 | /// </summary> |
391 | - public partial class UbuntuOneNotifyIcon : Window, INotificationIconView |
392 | + public partial class UbuntuOneNotifyIcon : INotificationIconView |
393 | { |
394 | public UbuntuOneNotifyIcon() |
395 | { |
396 | InitializeComponent(); |
397 | } |
398 | + |
399 | + #region Implementation of INotificationIconView |
400 | + |
401 | + public string Notification |
402 | + { |
403 | + get { throw new NotImplementedException(); } |
404 | + set { throw new NotImplementedException(); } |
405 | + } |
406 | + |
407 | + public IList<string> RecentlyModifiedFiles |
408 | + { |
409 | + get { throw new NotImplementedException(); } |
410 | + set { throw new NotImplementedException(); } |
411 | + } |
412 | + |
413 | + public string State |
414 | + { |
415 | + get { throw new NotImplementedException(); } |
416 | + set { throw new NotImplementedException(); } |
417 | + } |
418 | + |
419 | + public string CurrentOperation |
420 | + { |
421 | + get { throw new NotImplementedException(); } |
422 | + set { throw new NotImplementedException(); } |
423 | + } |
424 | + |
425 | + #endregion |
426 | } |
427 | } |
428 | |
429 | === modified file 'src/Canonical.UbuntuOne.Client/Canonical.UbuntuOne.Client.csproj' |
430 | --- src/Canonical.UbuntuOne.Client/Canonical.UbuntuOne.Client.csproj 2010-08-02 17:57:48 +0000 |
431 | +++ src/Canonical.UbuntuOne.Client/Canonical.UbuntuOne.Client.csproj 2010-08-09 16:14:47 +0000 |
432 | @@ -36,13 +36,20 @@ |
433 | <Link>Properties\Version.cs</Link> |
434 | </Compile> |
435 | <Compile Include="Notification\INotificationIconView.cs" /> |
436 | + <Compile Include="Notification\IStateMapper.cs" /> |
437 | + <Compile Include="Notification\ISyncDaemonClientNotifier.cs" /> |
438 | <Compile Include="Notification\NotificationIconPresenter.cs" /> |
439 | + <Compile Include="Notification\NotificationResources.Designer.cs"> |
440 | + <AutoGen>True</AutoGen> |
441 | + <DesignTime>True</DesignTime> |
442 | + <DependentUpon>NotificationResources.resx</DependentUpon> |
443 | + </Compile> |
444 | <Compile Include="Notification\OperationCompletenessEventArgs.cs" /> |
445 | <Compile Include="Notification\RecentlyModifiedEventArgs.cs" /> |
446 | <Compile Include="Notification\StateEventArgs.cs" /> |
447 | <Compile Include="Notification\INotificationIconPresenter.cs" /> |
448 | <Compile Include="Notification\NotificationEventArgs.cs" /> |
449 | - <Compile Include="Preferences\IPreferencesDialog.cs" /> |
450 | + <Compile Include="Preferences\IPreferencesDialogPresenter.cs" /> |
451 | <Compile Include="Properties\AssemblyInfo.cs" /> |
452 | <Compile Include="SyncDaemonClient.cs" /> |
453 | </ItemGroup> |
454 | @@ -53,6 +60,10 @@ |
455 | </ProjectReference> |
456 | </ItemGroup> |
457 | <ItemGroup> |
458 | + <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL"> |
459 | + <SpecificVersion>False</SpecificVersion> |
460 | + <HintPath>..\..\lib\log4net\log4net.dll</HintPath> |
461 | + </Reference> |
462 | <Reference Include="PresentationFramework"> |
463 | <RequiredTargetFramework>3.0</RequiredTargetFramework> |
464 | </Reference> |
465 | @@ -63,5 +74,12 @@ |
466 | <RequiredTargetFramework>3.0</RequiredTargetFramework> |
467 | </Reference> |
468 | </ItemGroup> |
469 | + <ItemGroup> |
470 | + <EmbeddedResource Include="Notification\NotificationResources.resx"> |
471 | + <Generator>ResXFileCodeGenerator</Generator> |
472 | + <LastGenOutput>NotificationResources.Designer.cs</LastGenOutput> |
473 | + <SubType>Designer</SubType> |
474 | + </EmbeddedResource> |
475 | + </ItemGroup> |
476 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> |
477 | </Project> |
478 | \ No newline at end of file |
479 | |
480 | === modified file 'src/Canonical.UbuntuOne.Client/Notification/INotificationIconPresenter.cs' |
481 | --- src/Canonical.UbuntuOne.Client/Notification/INotificationIconPresenter.cs 2010-07-27 11:58:32 +0000 |
482 | +++ src/Canonical.UbuntuOne.Client/Notification/INotificationIconPresenter.cs 2010-08-09 16:14:47 +0000 |
483 | @@ -17,8 +17,6 @@ |
484 | * |
485 | * Authors: Manuel de la Peña <manuel.delapena@canonical.com> |
486 | */ |
487 | -using System; |
488 | - |
489 | namespace Canonical.UbuntuOne.Client.Notification |
490 | { |
491 | /// <summary> |
492 | @@ -28,26 +26,6 @@ |
493 | public interface INotificationIconPresenter |
494 | { |
495 | /// <summary> |
496 | - /// Event to be raised when there is a notification to display to the user. |
497 | - /// </summary> |
498 | - event EventHandler<NotificationEventArgs> OnNotificationChanged; |
499 | - |
500 | - /// <summary> |
501 | - /// Event to be raised when there status of the daemon has changed. |
502 | - /// </summary> |
503 | - event EventHandler<StateEventArgs> OnStateChanged; |
504 | - |
505 | - /// <summary> |
506 | - /// Event to be raised when the completness of the current operation has changed. |
507 | - /// </summary> |
508 | - event EventHandler<OperationCompletenessEventArgs> OnCompletenessChanged; |
509 | - |
510 | - /// <summary> |
511 | - /// Event to be raised when the recently modified files have been changed. |
512 | - /// </summary> |
513 | - event EventHandler<RecentlyModifiedEventArgs> OnRecentlyModifiedChanged; |
514 | - |
515 | - /// <summary> |
516 | /// When implemented this method should open the Preferences window of Ubuntu One. |
517 | /// </summary> |
518 | void OpenUbuntuOnePreferences(); |
519 | |
520 | === modified file 'src/Canonical.UbuntuOne.Client/Notification/INotificationIconView.cs' |
521 | --- src/Canonical.UbuntuOne.Client/Notification/INotificationIconView.cs 2010-07-28 11:05:41 +0000 |
522 | +++ src/Canonical.UbuntuOne.Client/Notification/INotificationIconView.cs 2010-08-09 16:14:47 +0000 |
523 | @@ -17,9 +17,18 @@ |
524 | * |
525 | * Authors: Manuel de la Peña <manuel.delapena@canonical.com> |
526 | */ |
527 | +using System.Collections.Generic; |
528 | + |
529 | namespace Canonical.UbuntuOne.Client.Notification |
530 | { |
531 | public interface INotificationIconView |
532 | { |
533 | + string Notification { get; set; } |
534 | + |
535 | + IList<string> RecentlyModifiedFiles { get; set; } |
536 | + |
537 | + string State { get; set; } |
538 | + |
539 | + string CurrentOperation { get; set; } |
540 | } |
541 | } |
542 | |
543 | === added file 'src/Canonical.UbuntuOne.Client/Notification/IStateMapper.cs' |
544 | --- src/Canonical.UbuntuOne.Client/Notification/IStateMapper.cs 1970-01-01 00:00:00 +0000 |
545 | +++ src/Canonical.UbuntuOne.Client/Notification/IStateMapper.cs 2010-08-09 16:14:47 +0000 |
546 | @@ -0,0 +1,41 @@ |
547 | +/** |
548 | + * Copyright 2010 Canonical Ltd. |
549 | + * |
550 | + * This file is part of UbuntuOne on Windows. |
551 | + * |
552 | + * UbuntuOne on Windows is free software: you can redistribute it and/or modify |
553 | + * it under the terms of the GNU Lesser General Public License version |
554 | + * as published by the Free Software Foundation. |
555 | + * |
556 | + * Ubuntu One on Windows is distributed in the hope that it will be useful, |
557 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
558 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
559 | + * GNU Lesser General Public License for more details. |
560 | + * |
561 | + * You should have received a copy of the GNU Lesser General Public License |
562 | + * along with UbuntuOne for Windows. If not, see <http://www.gnu.org/licenses/>. |
563 | + * |
564 | + * Authors: Manuel de la Peña <manuel.delapena@canonical.com> |
565 | + */ |
566 | +namespace Canonical.UbuntuOne.Client.Notification |
567 | +{ |
568 | + /// <summary> |
569 | + /// Interface to be implemented by the |
570 | + /// </summary> |
571 | + public interface IStateMapper |
572 | + { |
573 | + /// <summary> |
574 | + /// Converts a state enum to a string that can be displayed to the user. |
575 | + /// </summary> |
576 | + /// <param name="state">The state to be converted.</param> |
577 | + /// <returns>A string that represents the sate.</returns> |
578 | + string ToString(StateEventArgs.StateEnum state); |
579 | + |
580 | + /// <summary> |
581 | + /// Converst a string to the state enum |
582 | + /// </summary> |
583 | + /// <param name="state">The string to be parsed and converted to the enum.</param> |
584 | + /// <returns>An enum with the state.</returns> |
585 | + StateEventArgs.StateEnum FromString(string state); |
586 | + } |
587 | +} |
588 | |
589 | === added file 'src/Canonical.UbuntuOne.Client/Notification/ISyncDaemonClientNotifier.cs' |
590 | --- src/Canonical.UbuntuOne.Client/Notification/ISyncDaemonClientNotifier.cs 1970-01-01 00:00:00 +0000 |
591 | +++ src/Canonical.UbuntuOne.Client/Notification/ISyncDaemonClientNotifier.cs 2010-08-09 16:14:47 +0000 |
592 | @@ -0,0 +1,50 @@ |
593 | +/** |
594 | + * Copyright 2010 Canonical Ltd. |
595 | + * |
596 | + * This file is part of UbuntuOne on Windows. |
597 | + * |
598 | + * UbuntuOne on Windows is free software: you can redistribute it and/or modify |
599 | + * it under the terms of the GNU Lesser General Public License version |
600 | + * as published by the Free Software Foundation. |
601 | + * |
602 | + * Ubuntu One on Windows is distributed in the hope that it will be useful, |
603 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
604 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
605 | + * GNU Lesser General Public License for more details. |
606 | + * |
607 | + * You should have received a copy of the GNU Lesser General Public License |
608 | + * along with UbuntuOne for Windows. If not, see <http://www.gnu.org/licenses/>. |
609 | + * |
610 | + * Authors: Manuel de la Peña <manuel.delapena@canonical.com> |
611 | + */ |
612 | +using System; |
613 | + |
614 | +namespace Canonical.UbuntuOne.Client.Notification |
615 | +{ |
616 | + /// <summary> |
617 | + /// Interface to be implemented by a sync daemon client that will contain the required events that will be used to notify the |
618 | + /// NotificationIconPresenter about the different operations that have occurred in the sync daemon client. |
619 | + /// </summary> |
620 | + public interface ISyncDaemonClientNotifier |
621 | + { |
622 | + /// <summary> |
623 | + /// Event raised when there are notifications to be provided to the notification icon. |
624 | + /// </summary> |
625 | + event EventHandler<NotificationEventArgs> OnNotification; |
626 | + |
627 | + /// <summary> |
628 | + /// Event raised when there are changes in the completness of the current opertaion. |
629 | + /// </summary> |
630 | + event EventHandler<OperationCompletenessEventArgs> OnOperationCompletness; |
631 | + |
632 | + /// <summary> |
633 | + /// Event raised when there are changed in teh recetly modififed items. |
634 | + /// </summary> |
635 | + event EventHandler<RecentlyModifiedEventArgs> OnRecentlyModifiedChanged; |
636 | + |
637 | + /// <summary> |
638 | + /// Event raised when there are changes in the state. |
639 | + /// </summary> |
640 | + event EventHandler<StateEventArgs> OnStateChanged; |
641 | + } |
642 | +} |
643 | |
644 | === modified file 'src/Canonical.UbuntuOne.Client/Notification/NotificationIconPresenter.cs' |
645 | --- src/Canonical.UbuntuOne.Client/Notification/NotificationIconPresenter.cs 2010-07-27 15:02:26 +0000 |
646 | +++ src/Canonical.UbuntuOne.Client/Notification/NotificationIconPresenter.cs 2010-08-09 16:14:47 +0000 |
647 | @@ -18,9 +18,10 @@ |
648 | * Authors: Manuel de la Peña <manuel.delapena@canonical.com> |
649 | */ |
650 | using System; |
651 | -using System.Windows; |
652 | -using System.Diagnostics; |
653 | using Canonical.UbuntuOne.Client.Preferences; |
654 | +using Canonical.UbuntuOne.Common.Aop; |
655 | +using Canonical.UbuntuOne.Common.Utils; |
656 | +using log4net; |
657 | |
658 | namespace Canonical.UbuntuOne.Client.Notification |
659 | { |
660 | @@ -28,9 +29,13 @@ |
661 | { |
662 | #region Variables |
663 | |
664 | - private const string UpgradeUrl = "https://one.ubuntu.com/upgrade"; |
665 | - |
666 | - private const string HelpUrl = "https://one.ubuntu.com/support/"; |
667 | + public const string UpgradeUrl = "https://one.ubuntu.com/upgrade"; |
668 | + public const string HelpUrl = "https://one.ubuntu.com/support/"; |
669 | + private static readonly string SharesLocation = ""; |
670 | + private static readonly string SyncsLocation = ""; |
671 | + private ISyncDaemonClientNotifier _clientNotifier; |
672 | + private ILog _logger; |
673 | + private readonly object _loggerLock = new object(); |
674 | |
675 | #endregion |
676 | |
677 | @@ -39,49 +44,192 @@ |
678 | /// <summary> |
679 | /// Gets and sets the dialog used to show the preferences. |
680 | /// </summary> |
681 | - public IPreferencesDialog PreferencesDialog { get; set; } |
682 | - |
683 | - #endregion |
684 | + public IPreferencesDialogPresenter PreferencesDialogPresenter { get; set; } |
685 | + |
686 | + /// <summary> |
687 | + /// Gets and sets the views that will be used to show the user the information. |
688 | + /// </summary> |
689 | + public INotificationIconView NotificationIconView { get; set; } |
690 | + |
691 | + /// <summary> |
692 | + /// Gets and sets the mapper used to convert from the state enum to a string. |
693 | + /// </summary> |
694 | + public IStateMapper StateMapper { get; set; } |
695 | + |
696 | + /// <summary> |
697 | + /// Gets and sets the webbrowser to be used to show pages to the user. |
698 | + /// </summary> |
699 | + public IWebbrowser Webbrowser { get; set; } |
700 | + |
701 | + /// <summary> |
702 | + /// Get and sets the eplorer that will be used to open folder in the client |
703 | + /// machine. |
704 | + /// </summary> |
705 | + public IExplorer Explorer { get; set; } |
706 | + |
707 | + /// <summary> |
708 | + /// Gets and sets the application that is running the notify presenter. |
709 | + /// </summary> |
710 | + public IApplication Application { get; set; } |
711 | + |
712 | + /// <summary> |
713 | + /// Gets and sets the notifier that will ensure that the presenter know about changes in the |
714 | + /// sync daemon. |
715 | + /// </summary> |
716 | + public ISyncDaemonClientNotifier SyncDaemonClientNotifier |
717 | + { |
718 | + get { return _clientNotifier; } |
719 | + set |
720 | + { |
721 | + if (value == null) return; |
722 | + _clientNotifier = value; |
723 | + // register to the different events raised by the client |
724 | + _clientNotifier.OnNotification += OnNotificationHandler; |
725 | + _clientNotifier.OnOperationCompletness += OnOperationCompletnessHandler; |
726 | + _clientNotifier.OnRecentlyModifiedChanged += OnRecentlyModifiedChangedHandler; |
727 | + _clientNotifier.OnStateChanged += OnStateChangedHandler; |
728 | + } |
729 | + } |
730 | + |
731 | + #endregion |
732 | + |
733 | + #region Properties |
734 | + |
735 | + /// <summary> |
736 | + /// Gets and sets the logger used by the class. |
737 | + /// </summary> |
738 | + internal ILog Logger |
739 | + { |
740 | + get |
741 | + { |
742 | + if(_logger == null) |
743 | + { |
744 | + lock (_loggerLock) |
745 | + { |
746 | + _logger = LogManager.GetLogger(typeof (NotificationIconPresenter)); |
747 | + } |
748 | + } |
749 | + return _logger; |
750 | + } |
751 | + set { _logger = value; } |
752 | + } |
753 | + |
754 | + #endregion |
755 | + |
756 | + #region Constructors |
757 | + |
758 | + static NotificationIconPresenter() |
759 | + { |
760 | + SharesLocation = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); |
761 | + SyncsLocation = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); |
762 | + } |
763 | + |
764 | + #endregion |
765 | + |
766 | + #region Helper methods |
767 | + |
768 | + /// <summary> |
769 | + /// Helper method that will ensure that when the state of the sync daemon changes this change |
770 | + /// is correctly reflected in the View. |
771 | + /// </summary> |
772 | + /// <param name="sender">The object that sent the event.</param> |
773 | + /// <param name="e">The arguments that describe the state change.</param> |
774 | + [DebugLogged] |
775 | + private void OnStateChangedHandler(object sender, StateEventArgs e) |
776 | + { |
777 | + NotificationIconView.State = StateMapper.ToString(e.State); |
778 | + } |
779 | + |
780 | + /// <summary> |
781 | + /// Helper method that will ensure that when the recently changed files are updated by the daemon that |
782 | + /// such a change is correcty displayed in the view. |
783 | + /// </summary> |
784 | + /// <param name="sender">The object that sent the event.</param> |
785 | + /// <param name="e">The arguments that describe the changes in the recently changed list.</param> |
786 | + [DebugLogged] |
787 | + private void OnRecentlyModifiedChangedHandler(object sender, RecentlyModifiedEventArgs e) |
788 | + { |
789 | + NotificationIconView.RecentlyModifiedFiles = e.RecentlyModifiedFiles; |
790 | + } |
791 | + |
792 | + /// <summary> |
793 | + /// Helper method that will ensure that when the status of an operation that is being performed by the daemon |
794 | + /// changes that such a changed ins correctly reflected in the UI. |
795 | + /// </summary> |
796 | + /// <param name="sender">The object that sent the event.</param> |
797 | + /// <param name="e">The argumets that describe the new updated operation state.</param> |
798 | + [DebugLogged] |
799 | + private void OnOperationCompletnessHandler(object sender, OperationCompletenessEventArgs e) |
800 | + { |
801 | + NotificationIconView.CurrentOperation = String.Format(NotificationResources.OperationStateNotification, |
802 | + e.Operation, e.Percentage, e.Speed, e.SpeedUnits); |
803 | + } |
804 | + |
805 | + /// <summary> |
806 | + /// Helper method that will ensure that when a notification is sent by the daemon that it is correctly displayed in the UI. |
807 | + /// </summary> |
808 | + /// <param name="sender">The object that sent the event.</param> |
809 | + /// <param name="e">The arguments that contains the notification to display.</param> |
810 | + [DebugLogged] |
811 | + private void OnNotificationHandler(object sender, NotificationEventArgs e) |
812 | + { |
813 | + NotificationIconView.Notification = e.Message; |
814 | + } |
815 | + |
816 | + #endregion |
817 | |
818 | #region Implementation of INotificationIconPresenter |
819 | |
820 | - #region events |
821 | - |
822 | - public event EventHandler<NotificationEventArgs> OnNotificationChanged; |
823 | - public event EventHandler<StateEventArgs> OnStateChanged; |
824 | - public event EventHandler<OperationCompletenessEventArgs> OnCompletenessChanged; |
825 | - public event EventHandler<RecentlyModifiedEventArgs> OnRecentlyModifiedChanged; |
826 | - |
827 | - #endregion |
828 | - |
829 | public void OpenUbuntuOnePreferences() |
830 | { |
831 | - PreferencesDialog.Show(); |
832 | + PreferencesDialogPresenter.Show(); |
833 | } |
834 | |
835 | public void OpenSharesLocation() |
836 | { |
837 | - throw new NotImplementedException(); |
838 | + try |
839 | + { |
840 | + Explorer.OpenFolder(SharesLocation); |
841 | + } |
842 | + catch(ExplorerException exception) |
843 | + { |
844 | + Logger.WarnFormat("There was an error operning the SharesLocation, {0}", exception); |
845 | + // use the view to notify the error |
846 | + NotificationIconView.Notification = String.Format(NotificationResources.ErrorOpeningFolder, |
847 | + Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)); |
848 | + throw; |
849 | + } |
850 | } |
851 | |
852 | public void OpenSyncsLocation() |
853 | { |
854 | - throw new NotImplementedException(); |
855 | + try |
856 | + { |
857 | + Explorer.OpenFolder(SyncsLocation); |
858 | + } |
859 | + catch (ExplorerException exception) |
860 | + { |
861 | + Logger.WarnFormat("There was an error operning the SharesLocation, {0}", exception); |
862 | + // use the view to notify the error |
863 | + NotificationIconView.Notification = String.Format(NotificationResources.ErrorOpeningFolder, |
864 | + Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)); |
865 | + throw; |
866 | + } |
867 | } |
868 | |
869 | public void OpenHelp() |
870 | { |
871 | - Process.Start(HelpUrl); |
872 | + Webbrowser.LauncWebpage(HelpUrl); |
873 | } |
874 | |
875 | public void OpenUpgradeOption() |
876 | { |
877 | - Process.Start(UpgradeUrl); |
878 | + Webbrowser.LauncWebpage(UpgradeUrl); |
879 | } |
880 | |
881 | public void Exit() |
882 | { |
883 | - Application.Current.Shutdown(); |
884 | + Application.Exit(); |
885 | } |
886 | |
887 | #endregion |
888 | |
889 | === added file 'src/Canonical.UbuntuOne.Client/Notification/NotificationResources.Designer.cs' |
890 | --- src/Canonical.UbuntuOne.Client/Notification/NotificationResources.Designer.cs 1970-01-01 00:00:00 +0000 |
891 | +++ src/Canonical.UbuntuOne.Client/Notification/NotificationResources.Designer.cs 2010-08-09 16:14:47 +0000 |
892 | @@ -0,0 +1,117 @@ |
893 | +//------------------------------------------------------------------------------ |
894 | +// <auto-generated> |
895 | +// This code was generated by a tool. |
896 | +// Runtime Version:2.0.50727.4927 |
897 | +// |
898 | +// Changes to this file may cause incorrect behavior and will be lost if |
899 | +// the code is regenerated. |
900 | +// </auto-generated> |
901 | +//------------------------------------------------------------------------------ |
902 | + |
903 | +namespace Canonical.UbuntuOne.Client.Notification { |
904 | + using System; |
905 | + |
906 | + |
907 | + /// <summary> |
908 | + /// A strongly-typed resource class, for looking up localized strings, etc. |
909 | + /// </summary> |
910 | + // This class was auto-generated by the StronglyTypedResourceBuilder |
911 | + // class via a tool like ResGen or Visual Studio. |
912 | + // To add or remove a member, edit your .ResX file then rerun ResGen |
913 | + // with the /str option, or rebuild your VS project. |
914 | + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] |
915 | + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
916 | + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] |
917 | + internal class NotificationResources { |
918 | + |
919 | + private static global::System.Resources.ResourceManager resourceMan; |
920 | + |
921 | + private static global::System.Globalization.CultureInfo resourceCulture; |
922 | + |
923 | + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] |
924 | + internal NotificationResources() { |
925 | + } |
926 | + |
927 | + /// <summary> |
928 | + /// Returns the cached ResourceManager instance used by this class. |
929 | + /// </summary> |
930 | + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] |
931 | + internal static global::System.Resources.ResourceManager ResourceManager { |
932 | + get { |
933 | + if (object.ReferenceEquals(resourceMan, null)) { |
934 | + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Canonical.UbuntuOne.Client.Notification.NotificationResources", typeof(NotificationResources).Assembly); |
935 | + resourceMan = temp; |
936 | + } |
937 | + return resourceMan; |
938 | + } |
939 | + } |
940 | + |
941 | + /// <summary> |
942 | + /// Overrides the current thread's CurrentUICulture property for all |
943 | + /// resource lookups using this strongly typed resource class. |
944 | + /// </summary> |
945 | + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] |
946 | + internal static global::System.Globalization.CultureInfo Culture { |
947 | + get { |
948 | + return resourceCulture; |
949 | + } |
950 | + set { |
951 | + resourceCulture = value; |
952 | + } |
953 | + } |
954 | + |
955 | + /// <summary> |
956 | + /// Looks up a localized string similar to Download finished for {0}. |
957 | + /// </summary> |
958 | + internal static string DownloadFinishedNotification { |
959 | + get { |
960 | + return ResourceManager.GetString("DownloadFinishedNotification", resourceCulture); |
961 | + } |
962 | + } |
963 | + |
964 | + /// <summary> |
965 | + /// Looks up a localized string similar to Download started for {0}. |
966 | + /// </summary> |
967 | + internal static string DownloadStartedNotitication { |
968 | + get { |
969 | + return ResourceManager.GetString("DownloadStartedNotitication", resourceCulture); |
970 | + } |
971 | + } |
972 | + |
973 | + /// <summary> |
974 | + /// Looks up a localized string similar to There was an error opening {0}. |
975 | + /// </summary> |
976 | + internal static string ErrorOpeningFolder { |
977 | + get { |
978 | + return ResourceManager.GetString("ErrorOpeningFolder", resourceCulture); |
979 | + } |
980 | + } |
981 | + |
982 | + /// <summary> |
983 | + /// Looks up a localized string similar to {0} , Completed {1}% at {2} {3}. |
984 | + /// </summary> |
985 | + internal static string OperationStateNotification { |
986 | + get { |
987 | + return ResourceManager.GetString("OperationStateNotification", resourceCulture); |
988 | + } |
989 | + } |
990 | + |
991 | + /// <summary> |
992 | + /// Looks up a localized string similar to Upload finished for {0}. |
993 | + /// </summary> |
994 | + internal static string UploadFinishedNotification { |
995 | + get { |
996 | + return ResourceManager.GetString("UploadFinishedNotification", resourceCulture); |
997 | + } |
998 | + } |
999 | + |
1000 | + /// <summary> |
1001 | + /// Looks up a localized string similar to Upload started for {0}. |
1002 | + /// </summary> |
1003 | + internal static string UploadStartedNotification { |
1004 | + get { |
1005 | + return ResourceManager.GetString("UploadStartedNotification", resourceCulture); |
1006 | + } |
1007 | + } |
1008 | + } |
1009 | +} |
1010 | |
1011 | === added file 'src/Canonical.UbuntuOne.Client/Notification/NotificationResources.resx' |
1012 | --- src/Canonical.UbuntuOne.Client/Notification/NotificationResources.resx 1970-01-01 00:00:00 +0000 |
1013 | +++ src/Canonical.UbuntuOne.Client/Notification/NotificationResources.resx 2010-08-09 16:14:47 +0000 |
1014 | @@ -0,0 +1,138 @@ |
1015 | +<?xml version="1.0" encoding="utf-8"?> |
1016 | +<root> |
1017 | + <!-- |
1018 | + Microsoft ResX Schema |
1019 | + |
1020 | + Version 2.0 |
1021 | + |
1022 | + The primary goals of this format is to allow a simple XML format |
1023 | + that is mostly human readable. The generation and parsing of the |
1024 | + various data types are done through the TypeConverter classes |
1025 | + associated with the data types. |
1026 | + |
1027 | + Example: |
1028 | + |
1029 | + ... ado.net/XML headers & schema ... |
1030 | + <resheader name="resmimetype">text/microsoft-resx</resheader> |
1031 | + <resheader name="version">2.0</resheader> |
1032 | + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> |
1033 | + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> |
1034 | + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> |
1035 | + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> |
1036 | + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> |
1037 | + <value>[base64 mime encoded serialized .NET Framework object]</value> |
1038 | + </data> |
1039 | + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> |
1040 | + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> |
1041 | + <comment>This is a comment</comment> |
1042 | + </data> |
1043 | + |
1044 | + There are any number of "resheader" rows that contain simple |
1045 | + name/value pairs. |
1046 | + |
1047 | + Each data row contains a name, and value. The row also contains a |
1048 | + type or mimetype. Type corresponds to a .NET class that support |
1049 | + text/value conversion through the TypeConverter architecture. |
1050 | + Classes that don't support this are serialized and stored with the |
1051 | + mimetype set. |
1052 | + |
1053 | + The mimetype is used for serialized objects, and tells the |
1054 | + ResXResourceReader how to depersist the object. This is currently not |
1055 | + extensible. For a given mimetype the value must be set accordingly: |
1056 | + |
1057 | + Note - application/x-microsoft.net.object.binary.base64 is the format |
1058 | + that the ResXResourceWriter will generate, however the reader can |
1059 | + read any of the formats listed below. |
1060 | + |
1061 | + mimetype: application/x-microsoft.net.object.binary.base64 |
1062 | + value : The object must be serialized with |
1063 | + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter |
1064 | + : and then encoded with base64 encoding. |
1065 | + |
1066 | + mimetype: application/x-microsoft.net.object.soap.base64 |
1067 | + value : The object must be serialized with |
1068 | + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter |
1069 | + : and then encoded with base64 encoding. |
1070 | + |
1071 | + mimetype: application/x-microsoft.net.object.bytearray.base64 |
1072 | + value : The object must be serialized into a byte array |
1073 | + : using a System.ComponentModel.TypeConverter |
1074 | + : and then encoded with base64 encoding. |
1075 | + --> |
1076 | + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> |
1077 | + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> |
1078 | + <xsd:element name="root" msdata:IsDataSet="true"> |
1079 | + <xsd:complexType> |
1080 | + <xsd:choice maxOccurs="unbounded"> |
1081 | + <xsd:element name="metadata"> |
1082 | + <xsd:complexType> |
1083 | + <xsd:sequence> |
1084 | + <xsd:element name="value" type="xsd:string" minOccurs="0" /> |
1085 | + </xsd:sequence> |
1086 | + <xsd:attribute name="name" use="required" type="xsd:string" /> |
1087 | + <xsd:attribute name="type" type="xsd:string" /> |
1088 | + <xsd:attribute name="mimetype" type="xsd:string" /> |
1089 | + <xsd:attribute ref="xml:space" /> |
1090 | + </xsd:complexType> |
1091 | + </xsd:element> |
1092 | + <xsd:element name="assembly"> |
1093 | + <xsd:complexType> |
1094 | + <xsd:attribute name="alias" type="xsd:string" /> |
1095 | + <xsd:attribute name="name" type="xsd:string" /> |
1096 | + </xsd:complexType> |
1097 | + </xsd:element> |
1098 | + <xsd:element name="data"> |
1099 | + <xsd:complexType> |
1100 | + <xsd:sequence> |
1101 | + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
1102 | + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> |
1103 | + </xsd:sequence> |
1104 | + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> |
1105 | + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> |
1106 | + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> |
1107 | + <xsd:attribute ref="xml:space" /> |
1108 | + </xsd:complexType> |
1109 | + </xsd:element> |
1110 | + <xsd:element name="resheader"> |
1111 | + <xsd:complexType> |
1112 | + <xsd:sequence> |
1113 | + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
1114 | + </xsd:sequence> |
1115 | + <xsd:attribute name="name" type="xsd:string" use="required" /> |
1116 | + </xsd:complexType> |
1117 | + </xsd:element> |
1118 | + </xsd:choice> |
1119 | + </xsd:complexType> |
1120 | + </xsd:element> |
1121 | + </xsd:schema> |
1122 | + <resheader name="resmimetype"> |
1123 | + <value>text/microsoft-resx</value> |
1124 | + </resheader> |
1125 | + <resheader name="version"> |
1126 | + <value>2.0</value> |
1127 | + </resheader> |
1128 | + <resheader name="reader"> |
1129 | + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
1130 | + </resheader> |
1131 | + <resheader name="writer"> |
1132 | + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
1133 | + </resheader> |
1134 | + <data name="DownloadFinishedNotification" xml:space="preserve"> |
1135 | + <value>Download finished for {0}</value> |
1136 | + </data> |
1137 | + <data name="DownloadStartedNotitication" xml:space="preserve"> |
1138 | + <value>Download started for {0}</value> |
1139 | + </data> |
1140 | + <data name="ErrorOpeningFolder" xml:space="preserve"> |
1141 | + <value>There was an error opening {0}</value> |
1142 | + </data> |
1143 | + <data name="OperationStateNotification" xml:space="preserve"> |
1144 | + <value>{0} , Completed {1}% at {2} {3}</value> |
1145 | + </data> |
1146 | + <data name="UploadFinishedNotification" xml:space="preserve"> |
1147 | + <value>Upload finished for {0}</value> |
1148 | + </data> |
1149 | + <data name="UploadStartedNotification" xml:space="preserve"> |
1150 | + <value>Upload started for {0}</value> |
1151 | + </data> |
1152 | +</root> |
1153 | \ No newline at end of file |
1154 | |
1155 | === modified file 'src/Canonical.UbuntuOne.Client/Notification/OperationCompletenessEventArgs.cs' |
1156 | --- src/Canonical.UbuntuOne.Client/Notification/OperationCompletenessEventArgs.cs 2010-07-27 11:58:32 +0000 |
1157 | +++ src/Canonical.UbuntuOne.Client/Notification/OperationCompletenessEventArgs.cs 2010-08-09 16:14:47 +0000 |
1158 | @@ -34,25 +34,30 @@ |
1159 | } |
1160 | |
1161 | /// <summary> |
1162 | - /// |
1163 | + /// The percentage of the operation that has been done. |
1164 | /// </summary> |
1165 | public int Percentage { get; set; } |
1166 | |
1167 | /// <summary> |
1168 | - /// |
1169 | + /// The speed in which the operation is being done. |
1170 | /// </summary> |
1171 | public double Speed { get; set; } |
1172 | |
1173 | /// <summary> |
1174 | - /// |
1175 | + /// The unit used in the speed. |
1176 | /// </summary> |
1177 | public SpeedUnitsEnum SpeedUnits { get; set; } |
1178 | |
1179 | /// <summary> |
1180 | + /// A string with the operation that is being performed. |
1181 | + /// </summary> |
1182 | + public string Operation { get; set; } |
1183 | + |
1184 | + /// <summary> |
1185 | /// Creates a new event arge with all its data init to the default values. |
1186 | /// </summary> |
1187 | public OperationCompletenessEventArgs() |
1188 | - : this(0, 0, SpeedUnitsEnum.MB) |
1189 | + : this("", 0, 0, SpeedUnitsEnum.MB) |
1190 | { |
1191 | |
1192 | } |
1193 | @@ -60,11 +65,13 @@ |
1194 | /// <summary> |
1195 | /// Creates a new event arg that can be used to state the current completness of an operation. |
1196 | /// </summary> |
1197 | + /// <param name="operation">A string with the operation that is being performed.</param> |
1198 | /// <param name="percentage">The percentage of the operation that has been done.</param> |
1199 | /// <param name="speed">The speed in which the operation is done.</param> |
1200 | /// <param name="units">The units used in the speed.</param> |
1201 | - public OperationCompletenessEventArgs(int percentage, double speed, SpeedUnitsEnum units) |
1202 | + public OperationCompletenessEventArgs(string operation, int percentage, double speed, SpeedUnitsEnum units) |
1203 | { |
1204 | + Operation = operation; |
1205 | Percentage = percentage; |
1206 | Speed = speed; |
1207 | SpeedUnits = units; |
1208 | |
1209 | === removed file 'src/Canonical.UbuntuOne.Client/Preferences/IPreferencesDialog.cs' |
1210 | --- src/Canonical.UbuntuOne.Client/Preferences/IPreferencesDialog.cs 2010-07-27 15:36:33 +0000 |
1211 | +++ src/Canonical.UbuntuOne.Client/Preferences/IPreferencesDialog.cs 1970-01-01 00:00:00 +0000 |
1212 | @@ -1,30 +0,0 @@ |
1213 | -/** |
1214 | - * Copyright 2010 Canonical Ltd. |
1215 | - * |
1216 | - * This file is part of UbuntuOne on Windows. |
1217 | - * |
1218 | - * UbuntuOne on Windows is free software: you can redistribute it and/or modify |
1219 | - * it under the terms of the GNU Lesser General Public License version |
1220 | - * as published by the Free Software Foundation. |
1221 | - * |
1222 | - * Ubuntu One on Windows is distributed in the hope that it will be useful, |
1223 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1224 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1225 | - * GNU Lesser General Public License for more details. |
1226 | - * |
1227 | - * You should have received a copy of the GNU Lesser General Public License |
1228 | - * along with UbuntuOne for Windows. If not, see <http://www.gnu.org/licenses/>. |
1229 | - * |
1230 | - * Authors: Manuel de la Peña <manuel.delapena@canonical.com> |
1231 | - */ |
1232 | - |
1233 | -namespace Canonical.UbuntuOne.Client.Preferences |
1234 | -{ |
1235 | - /// <summary> |
1236 | - /// Interface to be implemented by those dialogs used tod isaply preferences. |
1237 | - /// </summary> |
1238 | - public interface IPreferencesDialog |
1239 | - { |
1240 | - void Show(); |
1241 | - } |
1242 | -} |
1243 | |
1244 | === added file 'src/Canonical.UbuntuOne.Client/Preferences/IPreferencesDialogPresenter.cs' |
1245 | --- src/Canonical.UbuntuOne.Client/Preferences/IPreferencesDialogPresenter.cs 1970-01-01 00:00:00 +0000 |
1246 | +++ src/Canonical.UbuntuOne.Client/Preferences/IPreferencesDialogPresenter.cs 2010-08-09 16:14:47 +0000 |
1247 | @@ -0,0 +1,30 @@ |
1248 | +/** |
1249 | + * Copyright 2010 Canonical Ltd. |
1250 | + * |
1251 | + * This file is part of UbuntuOne on Windows. |
1252 | + * |
1253 | + * UbuntuOne on Windows is free software: you can redistribute it and/or modify |
1254 | + * it under the terms of the GNU Lesser General Public License version |
1255 | + * as published by the Free Software Foundation. |
1256 | + * |
1257 | + * Ubuntu One on Windows is distributed in the hope that it will be useful, |
1258 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1259 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1260 | + * GNU Lesser General Public License for more details. |
1261 | + * |
1262 | + * You should have received a copy of the GNU Lesser General Public License |
1263 | + * along with UbuntuOne for Windows. If not, see <http://www.gnu.org/licenses/>. |
1264 | + * |
1265 | + * Authors: Manuel de la Peña <manuel.delapena@canonical.com> |
1266 | + */ |
1267 | + |
1268 | +namespace Canonical.UbuntuOne.Client.Preferences |
1269 | +{ |
1270 | + /// <summary> |
1271 | + /// Interface to be implemented by those dialogs used tod isaply preferences. |
1272 | + /// </summary> |
1273 | + public interface IPreferencesDialogPresenter |
1274 | + { |
1275 | + void Show(); |
1276 | + } |
1277 | +} |
1278 | |
1279 | === modified file 'src/Canonical.UbuntuOne.Client/Properties/AssemblyInfo.cs' |
1280 | --- src/Canonical.UbuntuOne.Client/Properties/AssemblyInfo.cs 2010-07-30 09:33:20 +0000 |
1281 | +++ src/Canonical.UbuntuOne.Client/Properties/AssemblyInfo.cs 2010-08-09 16:14:47 +0000 |
1282 | @@ -21,4 +21,5 @@ |
1283 | |
1284 | // The following GUID is for the ID of the typelib if this project is exposed to COM |
1285 | [assembly: Guid("3c7586a6-40ca-463b-b12c-b0aed0f4cb92")] |
1286 | +[assembly: InternalsVisibleTo("Canonical.UbuntuOne.Client.Test")] |
1287 | |
1288 | |
1289 | === modified file 'src/Canonical.UbuntuOne.Client/SyncDaemonClient.cs' |
1290 | --- src/Canonical.UbuntuOne.Client/SyncDaemonClient.cs 2010-07-27 15:02:26 +0000 |
1291 | +++ src/Canonical.UbuntuOne.Client/SyncDaemonClient.cs 2010-08-09 16:14:47 +0000 |
1292 | @@ -18,13 +18,35 @@ |
1293 | * Authors: Manuel de la Peña <manuel.delapena@canonical.com> |
1294 | */ |
1295 | using System; |
1296 | +using Canonical.UbuntuOne.Client.Notification; |
1297 | using Canonical.UbuntuOne.Common; |
1298 | using Canonical.UbuntuOne.Common.Validation; |
1299 | |
1300 | namespace Canonical.UbuntuOne.Client |
1301 | { |
1302 | - class SyncDaemonClient : ISyncDaemonClient |
1303 | + class SyncDaemonClient : ISyncDaemonClient, ISyncDaemonClientNotifier |
1304 | { |
1305 | + #region ISyncDaemonClientNotifier implementation |
1306 | + |
1307 | + public event EventHandler<NotificationEventArgs> OnNotification; |
1308 | + public event EventHandler<OperationCompletenessEventArgs> OnOperationCompletness; |
1309 | + public event EventHandler<RecentlyModifiedEventArgs> OnRecentlyModifiedChanged; |
1310 | + public event EventHandler<StateEventArgs> OnStateChanged; |
1311 | + |
1312 | + #endregion |
1313 | + |
1314 | + #region Helper methods |
1315 | + |
1316 | + private void NotifyAction(string message) |
1317 | + { |
1318 | + if (OnNotification == null) return; |
1319 | + var args = new NotificationEventArgs(message); |
1320 | + OnNotification(this, args); |
1321 | + } |
1322 | + #endregion |
1323 | + |
1324 | + #region ISyncDaemonClient implementation |
1325 | + |
1326 | /// <summary> |
1327 | /// Callback performed when a download starts. |
1328 | /// </summary> |
1329 | @@ -34,8 +56,7 @@ |
1330 | ValidateArgs.Begin() |
1331 | .IsNotNull(data, "data") |
1332 | .Check(); |
1333 | - |
1334 | - throw new NotImplementedException(); |
1335 | + NotifyAction(String.Format(NotificationResources.DownloadStartedNotitication, data.Path)); |
1336 | } |
1337 | |
1338 | /// <summary> |
1339 | @@ -47,8 +68,7 @@ |
1340 | ValidateArgs.Begin() |
1341 | .IsNotNull(data) |
1342 | .Check(); |
1343 | - |
1344 | - throw new NotImplementedException(); |
1345 | + NotifyAction(String.Format(NotificationResources.DownloadFinishedNotification, data.Path)); |
1346 | } |
1347 | |
1348 | /// <summary> |
1349 | @@ -61,7 +81,7 @@ |
1350 | .IsNotNull(data) |
1351 | .Check(); |
1352 | |
1353 | - throw new NotImplementedException(); |
1354 | + NotifyAction(String.Format(NotificationResources.UploadStartedNotification, data.Path)); |
1355 | } |
1356 | |
1357 | /// <summary> |
1358 | @@ -73,7 +93,7 @@ |
1359 | ValidateArgs.Begin() |
1360 | .IsNotNull(data, "data") |
1361 | .Check(); |
1362 | - throw new NotImplementedException(); |
1363 | + NotifyAction(String.Format(NotificationResources.UploadFinishedNotification, data.Path)); |
1364 | } |
1365 | |
1366 | /// <summary> |
1367 | @@ -85,7 +105,7 @@ |
1368 | ValidateArgs.Begin() |
1369 | .IsNotNull(data, "data") |
1370 | .Check(); |
1371 | - throw new NotImplementedException(); |
1372 | + |
1373 | } |
1374 | |
1375 | /// <summary> |
1376 | @@ -233,5 +253,7 @@ |
1377 | .Check(); |
1378 | throw new NotImplementedException(); |
1379 | } |
1380 | + |
1381 | + #endregion |
1382 | } |
1383 | } |
1384 | |
1385 | === modified file 'src/Canonical.UbuntuOne.Common/Canonical.UbuntuOne.Common.csproj' |
1386 | --- src/Canonical.UbuntuOne.Common/Canonical.UbuntuOne.Common.csproj 2010-08-04 14:23:27 +0000 |
1387 | +++ src/Canonical.UbuntuOne.Common/Canonical.UbuntuOne.Common.csproj 2010-08-09 16:14:47 +0000 |
1388 | @@ -57,9 +57,15 @@ |
1389 | <Compile Include="Container\SpringContainer.cs" /> |
1390 | <Compile Include="Container\UnsatisfiedDependencyException.cs" /> |
1391 | <Compile Include="IAuthentication.cs" /> |
1392 | + <Compile Include="Utils\ApplicationWrapper.cs" /> |
1393 | + <Compile Include="Utils\Explorer.cs" /> |
1394 | + <Compile Include="Utils\ExplorerException.cs" /> |
1395 | + <Compile Include="Utils\IApplication.cs" /> |
1396 | + <Compile Include="Utils\IExplorer.cs" /> |
1397 | <Compile Include="IMessageBox.cs" /> |
1398 | <Compile Include="IProcessManager.cs" /> |
1399 | <Compile Include="IProcessManagerFactory.cs" /> |
1400 | + <Compile Include="Utils\IWebbrowser.cs" /> |
1401 | <Compile Include="ProcessManagementException.cs" /> |
1402 | <Compile Include="ProcessManager.cs" /> |
1403 | <Compile Include="SyncDaemonAuthentication.cs" /> |
1404 | @@ -106,6 +112,7 @@ |
1405 | <Compile Include="Validation\ValidateArgs.cs" /> |
1406 | <Compile Include="Validation\ValidationException.cs" /> |
1407 | <Compile Include="Validation\ValidationExtensions.cs" /> |
1408 | + <Compile Include="Utils\Webbrowser.cs" /> |
1409 | </ItemGroup> |
1410 | <ItemGroup> |
1411 | <Reference Include="DotUpdater, Version=0.2.0.4, Culture=neutral, processorArchitecture=MSIL"> |
1412 | @@ -120,6 +127,9 @@ |
1413 | <SpecificVersion>False</SpecificVersion> |
1414 | <HintPath>..\..\lib\log4net\log4net.dll</HintPath> |
1415 | </Reference> |
1416 | + <Reference Include="PresentationCore"> |
1417 | + <RequiredTargetFramework>3.0</RequiredTargetFramework> |
1418 | + </Reference> |
1419 | <Reference Include="PresentationFramework"> |
1420 | <RequiredTargetFramework>3.0</RequiredTargetFramework> |
1421 | </Reference> |
1422 | |
1423 | === modified file 'src/Canonical.UbuntuOne.Common/OperationContracts/ISyncConfiguration.cs' |
1424 | --- src/Canonical.UbuntuOne.Common/OperationContracts/ISyncConfiguration.cs 2010-07-07 10:41:49 +0000 |
1425 | +++ src/Canonical.UbuntuOne.Common/OperationContracts/ISyncConfiguration.cs 2010-08-09 16:14:47 +0000 |
1426 | @@ -29,6 +29,13 @@ |
1427 | public interface ISyncConfiguration |
1428 | { |
1429 | /// <summary> |
1430 | + /// Provides a way that the client can use to register itself to be notified about events |
1431 | + /// through callbacks. The client should implemented the ISyncDaemonClient interface. |
1432 | + /// </summary> |
1433 | + [OperationContract(IsOneWay = true)] |
1434 | + void RegisterClient(); |
1435 | + |
1436 | + /// <summary> |
1437 | /// Returns the throttling limits that have been set up for the daemon. |
1438 | /// </summary> |
1439 | /// <returns>The upload and downloads limits that the daemon has.</returns> |
1440 | |
1441 | === modified file 'src/Canonical.UbuntuOne.Common/OperationContracts/ISyncDaemon.cs' |
1442 | --- src/Canonical.UbuntuOne.Common/OperationContracts/ISyncDaemon.cs 2010-07-07 10:41:49 +0000 |
1443 | +++ src/Canonical.UbuntuOne.Common/OperationContracts/ISyncDaemon.cs 2010-08-09 16:14:47 +0000 |
1444 | @@ -33,6 +33,13 @@ |
1445 | SessionMode = SessionMode.Required)] |
1446 | public interface ISyncDaemon |
1447 | { |
1448 | + /// <summary> |
1449 | + /// Provides a way that the client can use to register itself to be notified about events |
1450 | + /// through callbacks. The client should implemented the ISyncDaemonClient interface. |
1451 | + /// </summary> |
1452 | + [OperationContract(IsOneWay = true)] |
1453 | + void RegisterClient(); |
1454 | + |
1455 | /// <summary> |
1456 | /// Allows to start the daemon by a client. |
1457 | /// </summary> |
1458 | |
1459 | === modified file 'src/Canonical.UbuntuOne.Common/OperationContracts/ISyncFileManager.cs' |
1460 | --- src/Canonical.UbuntuOne.Common/OperationContracts/ISyncFileManager.cs 2010-07-07 10:41:49 +0000 |
1461 | +++ src/Canonical.UbuntuOne.Common/OperationContracts/ISyncFileManager.cs 2010-08-09 16:14:47 +0000 |
1462 | @@ -32,7 +32,18 @@ |
1463 | SessionMode = SessionMode.Required)] |
1464 | public interface ISyncFileManager |
1465 | { |
1466 | + /// <summary> |
1467 | + /// Provides a way that the client can use to register itself to be notified about events |
1468 | + /// through callbacks. The client should implemented the ISyncDaemonClient interface. |
1469 | + /// </summary> |
1470 | + [OperationContract(IsOneWay = true)] |
1471 | + void RegisterClient(); |
1472 | |
1473 | + /// <summary> |
1474 | + /// Returns the metadata |
1475 | + /// </summary> |
1476 | + /// <param name="path"></param> |
1477 | + /// <returns></returns> |
1478 | [OperationContract] |
1479 | IDictionary<string, string> GetMetadata(string path); |
1480 | } |
1481 | |
1482 | === modified file 'src/Canonical.UbuntuOne.Common/OperationContracts/ISyncFolders.cs' |
1483 | --- src/Canonical.UbuntuOne.Common/OperationContracts/ISyncFolders.cs 2010-07-07 10:41:49 +0000 |
1484 | +++ src/Canonical.UbuntuOne.Common/OperationContracts/ISyncFolders.cs 2010-08-09 16:14:47 +0000 |
1485 | @@ -30,6 +30,13 @@ |
1486 | public interface ISyncFolders |
1487 | { |
1488 | /// <summary> |
1489 | + /// Provides a way that the client can use to register itself to be notified about events |
1490 | + /// through callbacks. The client should implemented the ISyncDaemonClient interface. |
1491 | + /// </summary> |
1492 | + [OperationContract(IsOneWay = true)] |
1493 | + void RegisterClient(); |
1494 | + |
1495 | + /// <summary> |
1496 | /// Creates a new udf for the given path. |
1497 | /// </summary> |
1498 | /// <param name="path">The path to which the Udf will be created.</param> |
1499 | |
1500 | === modified file 'src/Canonical.UbuntuOne.Common/OperationContracts/ISyncShares.cs' |
1501 | --- src/Canonical.UbuntuOne.Common/OperationContracts/ISyncShares.cs 2010-07-07 10:41:49 +0000 |
1502 | +++ src/Canonical.UbuntuOne.Common/OperationContracts/ISyncShares.cs 2010-08-09 16:14:47 +0000 |
1503 | @@ -30,6 +30,13 @@ |
1504 | public interface ISyncShares |
1505 | { |
1506 | /// <summary> |
1507 | + /// Provides a way that the client can use to register itself to be notified about events |
1508 | + /// through callbacks. The client should implemented the ISyncDaemonClient interface. |
1509 | + /// </summary> |
1510 | + [OperationContract(IsOneWay = true)] |
1511 | + void RegisterClient(); |
1512 | + |
1513 | + /// <summary> |
1514 | /// Allows the client to query and get all the different shares that the user has. |
1515 | /// </summary> |
1516 | /// <returns>Returns a list with all the shares that the user has.</returns> |
1517 | |
1518 | === added directory 'src/Canonical.UbuntuOne.Common/Utils' |
1519 | === added file 'src/Canonical.UbuntuOne.Common/Utils/ApplicationWrapper.cs' |
1520 | --- src/Canonical.UbuntuOne.Common/Utils/ApplicationWrapper.cs 1970-01-01 00:00:00 +0000 |
1521 | +++ src/Canonical.UbuntuOne.Common/Utils/ApplicationWrapper.cs 2010-08-09 16:14:47 +0000 |
1522 | @@ -0,0 +1,63 @@ |
1523 | +/** |
1524 | + * Copyright 2010 Canonical Ltd. |
1525 | + * |
1526 | + * This file is part of UbuntuOne on Windows. |
1527 | + * |
1528 | + * UbuntuOne on Windows is free software: you can redistribute it and/or modify |
1529 | + * it under the terms of the GNU Lesser General Public License version |
1530 | + * as published by the Free Software Foundation. |
1531 | + * |
1532 | + * Ubuntu One on Windows is distributed in the hope that it will be useful, |
1533 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1534 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1535 | + * GNU Lesser General Public License for more details. |
1536 | + * |
1537 | + * You should have received a copy of the GNU Lesser General Public License |
1538 | + * along with UbuntuOne for Windows. If not, see <http://www.gnu.org/licenses/>. |
1539 | + * |
1540 | + * Authors: Manuel de la Peña <manuel.delapena@canonical.com> |
1541 | + */ |
1542 | +using System.Windows; |
1543 | + |
1544 | +namespace Canonical.UbuntuOne.Common.Utils |
1545 | +{ |
1546 | + public class ApplicationWrapper : IApplication |
1547 | + { |
1548 | + private readonly Application _app; |
1549 | + |
1550 | + public ApplicationWrapper() |
1551 | + { |
1552 | + _app = new Application(); |
1553 | + } |
1554 | + |
1555 | + #region Implementation of IApplication |
1556 | + |
1557 | + /// <summary> |
1558 | + /// Allows to start the application using the passed window. |
1559 | + /// </summary> |
1560 | + /// <param name="startWindow">The main window of the application.</param> |
1561 | + public void Run(Window startWindow) |
1562 | + { |
1563 | + _app.Run(startWindow); |
1564 | + } |
1565 | + |
1566 | + /// <summary> |
1567 | + /// Gets and sets the shutdown mode to be used in the application. |
1568 | + /// </summary> |
1569 | + public ShutdownMode ShutdownMode |
1570 | + { |
1571 | + get { return _app.ShutdownMode; } |
1572 | + set { _app.ShutdownMode = value; } |
1573 | + } |
1574 | + |
1575 | + /// <summary> |
1576 | + /// Allows to close the application. |
1577 | + /// </summary> |
1578 | + public void Exit() |
1579 | + { |
1580 | + _app.Shutdown(); |
1581 | + } |
1582 | + |
1583 | + #endregion |
1584 | + } |
1585 | +} |
1586 | |
1587 | === added file 'src/Canonical.UbuntuOne.Common/Utils/Explorer.cs' |
1588 | --- src/Canonical.UbuntuOne.Common/Utils/Explorer.cs 1970-01-01 00:00:00 +0000 |
1589 | +++ src/Canonical.UbuntuOne.Common/Utils/Explorer.cs 2010-08-09 16:14:47 +0000 |
1590 | @@ -0,0 +1,46 @@ |
1591 | +/** |
1592 | + * Copyright 2010 Canonical Ltd. |
1593 | + * |
1594 | + * This file is part of UbuntuOne on Windows. |
1595 | + * |
1596 | + * UbuntuOne on Windows is free software: you can redistribute it and/or modify |
1597 | + * it under the terms of the GNU Lesser General Public License version |
1598 | + * as published by the Free Software Foundation. |
1599 | + * |
1600 | + * Ubuntu One on Windows is distributed in the hope that it will be useful, |
1601 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1602 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1603 | + * GNU Lesser General Public License for more details. |
1604 | + * |
1605 | + * You should have received a copy of the GNU Lesser General Public License |
1606 | + * along with UbuntuOne for Windows. If not, see <http://www.gnu.org/licenses/>. |
1607 | + * |
1608 | + * Authors: Manuel de la Peña <manuel.delapena@canonical.com> |
1609 | + */ |
1610 | +using System.Diagnostics; |
1611 | +using System.IO; |
1612 | + |
1613 | +namespace Canonical.UbuntuOne.Common.Utils |
1614 | +{ |
1615 | + |
1616 | + public class Explorer : IExplorer |
1617 | + { |
1618 | + private const string ExplorerProcess = "explorer.exe"; |
1619 | + |
1620 | + #region Implementation of IExplorer |
1621 | + |
1622 | + /// <summary> |
1623 | + /// When implemented the method should open a location of a folder with the given path. |
1624 | + /// </summary> |
1625 | + public void OpenFolder(string folderFullPath) |
1626 | + { |
1627 | + if(!File.Exists(folderFullPath)) |
1628 | + { |
1629 | + throw new ExplorerException("File not found."); |
1630 | + } |
1631 | + Process.Start(ExplorerProcess, folderFullPath); |
1632 | + } |
1633 | + |
1634 | + #endregion |
1635 | + } |
1636 | +} |
1637 | |
1638 | === added file 'src/Canonical.UbuntuOne.Common/Utils/ExplorerException.cs' |
1639 | --- src/Canonical.UbuntuOne.Common/Utils/ExplorerException.cs 1970-01-01 00:00:00 +0000 |
1640 | +++ src/Canonical.UbuntuOne.Common/Utils/ExplorerException.cs 2010-08-09 16:14:47 +0000 |
1641 | @@ -0,0 +1,43 @@ |
1642 | +/** |
1643 | + * Copyright 2010 Canonical Ltd. |
1644 | + * |
1645 | + * This file is part of UbuntuOne on Windows. |
1646 | + * |
1647 | + * UbuntuOne on Windows is free software: you can redistribute it and/or modify |
1648 | + * it under the terms of the GNU Lesser General Public License version |
1649 | + * as published by the Free Software Foundation. |
1650 | + * |
1651 | + * Ubuntu One on Windows is distributed in the hope that it will be useful, |
1652 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1653 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1654 | + * GNU Lesser General Public License for more details. |
1655 | + * |
1656 | + * You should have received a copy of the GNU Lesser General Public License |
1657 | + * along with UbuntuOne for Windows. If not, see <http://www.gnu.org/licenses/>. |
1658 | + * |
1659 | + * Authors: Manuel de la Peña <manuel.delapena@canonical.com> |
1660 | + */ |
1661 | +using System; |
1662 | + |
1663 | +namespace Canonical.UbuntuOne.Common.Utils |
1664 | +{ |
1665 | + public class ExplorerException : Exception |
1666 | + { |
1667 | + public ExplorerException() |
1668 | + { |
1669 | + |
1670 | + } |
1671 | + |
1672 | + public ExplorerException(string message) |
1673 | + : base(message) |
1674 | + { |
1675 | + |
1676 | + } |
1677 | + |
1678 | + public ExplorerException(string message, Exception inner) |
1679 | + : base(message, inner) |
1680 | + { |
1681 | + |
1682 | + } |
1683 | + } |
1684 | +} |
1685 | |
1686 | === added file 'src/Canonical.UbuntuOne.Common/Utils/IApplication.cs' |
1687 | --- src/Canonical.UbuntuOne.Common/Utils/IApplication.cs 1970-01-01 00:00:00 +0000 |
1688 | +++ src/Canonical.UbuntuOne.Common/Utils/IApplication.cs 2010-08-09 16:14:47 +0000 |
1689 | @@ -0,0 +1,45 @@ |
1690 | +/** |
1691 | + * Copyright 2010 Canonical Ltd. |
1692 | + * |
1693 | + * This file is part of UbuntuOne on Windows. |
1694 | + * |
1695 | + * UbuntuOne on Windows is free software: you can redistribute it and/or modify |
1696 | + * it under the terms of the GNU Lesser General Public License version |
1697 | + * as published by the Free Software Foundation. |
1698 | + * |
1699 | + * Ubuntu One on Windows is distributed in the hope that it will be useful, |
1700 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1701 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1702 | + * GNU Lesser General Public License for more details. |
1703 | + * |
1704 | + * You should have received a copy of the GNU Lesser General Public License |
1705 | + * along with UbuntuOne for Windows. If not, see <http://www.gnu.org/licenses/>. |
1706 | + * |
1707 | + * Authors: Manuel de la Peña <manuel.delapena@canonical.com> |
1708 | + */ |
1709 | +using System.Windows; |
1710 | + |
1711 | +namespace Canonical.UbuntuOne.Common.Utils |
1712 | +{ |
1713 | + /// <summary> |
1714 | + /// Interface that allows to abstract an application in C# allowing to make the code more testable. |
1715 | + /// </summary> |
1716 | + public interface IApplication |
1717 | + { |
1718 | + /// <summary> |
1719 | + /// Allows to start the application using the passed window. |
1720 | + /// </summary> |
1721 | + /// <param name="startWindow">The main window of the application.</param> |
1722 | + void Run(Window startWindow); |
1723 | + |
1724 | + /// <summary> |
1725 | + /// Gets and sets the shutdown mode to be used in the application. |
1726 | + /// </summary> |
1727 | + ShutdownMode ShutdownMode { get; set; } |
1728 | + |
1729 | + /// <summary> |
1730 | + /// Allows to close the application. |
1731 | + /// </summary> |
1732 | + void Exit(); |
1733 | + } |
1734 | +} |
1735 | |
1736 | === added file 'src/Canonical.UbuntuOne.Common/Utils/IExplorer.cs' |
1737 | --- src/Canonical.UbuntuOne.Common/Utils/IExplorer.cs 1970-01-01 00:00:00 +0000 |
1738 | +++ src/Canonical.UbuntuOne.Common/Utils/IExplorer.cs 2010-08-09 16:14:47 +0000 |
1739 | @@ -0,0 +1,29 @@ |
1740 | +/** |
1741 | + * Copyright 2010 Canonical Ltd. |
1742 | + * |
1743 | + * This file is part of UbuntuOne on Windows. |
1744 | + * |
1745 | + * UbuntuOne on Windows is free software: you can redistribute it and/or modify |
1746 | + * it under the terms of the GNU Lesser General Public License version |
1747 | + * as published by the Free Software Foundation. |
1748 | + * |
1749 | + * Ubuntu One on Windows is distributed in the hope that it will be useful, |
1750 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1751 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1752 | + * GNU Lesser General Public License for more details. |
1753 | + * |
1754 | + * You should have received a copy of the GNU Lesser General Public License |
1755 | + * along with UbuntuOne for Windows. If not, see <http://www.gnu.org/licenses/>. |
1756 | + * |
1757 | + * Authors: Manuel de la Peña <manuel.delapena@canonical.com> |
1758 | + */ |
1759 | +namespace Canonical.UbuntuOne.Common.Utils |
1760 | +{ |
1761 | + public interface IExplorer |
1762 | + { |
1763 | + /// <summary> |
1764 | + /// When implemented the method should open a location of a folder with the given path. |
1765 | + /// </summary> |
1766 | + void OpenFolder(string folderFullPath); |
1767 | + } |
1768 | +} |
1769 | |
1770 | === added file 'src/Canonical.UbuntuOne.Common/Utils/IWebbrowser.cs' |
1771 | --- src/Canonical.UbuntuOne.Common/Utils/IWebbrowser.cs 1970-01-01 00:00:00 +0000 |
1772 | +++ src/Canonical.UbuntuOne.Common/Utils/IWebbrowser.cs 2010-08-09 16:14:47 +0000 |
1773 | @@ -0,0 +1,29 @@ |
1774 | +/** |
1775 | + * Copyright 2010 Canonical Ltd. |
1776 | + * |
1777 | + * This file is part of UbuntuOne on Windows. |
1778 | + * |
1779 | + * UbuntuOne on Windows is free software: you can redistribute it and/or modify |
1780 | + * it under the terms of the GNU Lesser General Public License version |
1781 | + * as published by the Free Software Foundation. |
1782 | + * |
1783 | + * Ubuntu One on Windows is distributed in the hope that it will be useful, |
1784 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1785 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1786 | + * GNU Lesser General Public License for more details. |
1787 | + * |
1788 | + * You should have received a copy of the GNU Lesser General Public License |
1789 | + * along with UbuntuOne for Windows. If not, see <http://www.gnu.org/licenses/>. |
1790 | + * |
1791 | + * Authors: Manuel de la Peña <manuel.delapena@canonical.com> |
1792 | + */ |
1793 | +namespace Canonical.UbuntuOne.Common.Utils |
1794 | +{ |
1795 | + public interface IWebbrowser |
1796 | + { |
1797 | + /// <summary> |
1798 | + /// The implementation should open the default browser in the system and dispaly the passed url. |
1799 | + /// </summary> |
1800 | + void LauncWebpage(string url); |
1801 | + } |
1802 | +} |
1803 | |
1804 | === added file 'src/Canonical.UbuntuOne.Common/Utils/Webbrowser.cs' |
1805 | --- src/Canonical.UbuntuOne.Common/Utils/Webbrowser.cs 1970-01-01 00:00:00 +0000 |
1806 | +++ src/Canonical.UbuntuOne.Common/Utils/Webbrowser.cs 2010-08-09 16:14:47 +0000 |
1807 | @@ -0,0 +1,32 @@ |
1808 | +/** |
1809 | + * Copyright 2010 Canonical Ltd. |
1810 | + * |
1811 | + * This file is part of UbuntuOne on Windows. |
1812 | + * |
1813 | + * UbuntuOne on Windows is free software: you can redistribute it and/or modify |
1814 | + * it under the terms of the GNU Lesser General Public License version |
1815 | + * as published by the Free Software Foundation. |
1816 | + * |
1817 | + * Ubuntu One on Windows is distributed in the hope that it will be useful, |
1818 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1819 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1820 | + * GNU Lesser General Public License for more details. |
1821 | + * |
1822 | + * You should have received a copy of the GNU Lesser General Public License |
1823 | + * along with UbuntuOne for Windows. If not, see <http://www.gnu.org/licenses/>. |
1824 | + * |
1825 | + * Authors: Manuel de la Peña <manuel.delapena@canonical.com> |
1826 | + */ |
1827 | +using System.Diagnostics; |
1828 | + |
1829 | +namespace Canonical.UbuntuOne.Common.Utils |
1830 | +{ |
1831 | + public class Webbrowser : IWebbrowser |
1832 | + { |
1833 | + public void LauncWebpage(string url) |
1834 | + { |
1835 | + // trust the console to open the correct app |
1836 | + Process.Start(url); |
1837 | + } |
1838 | + } |
1839 | +} |
1840 | |
1841 | === modified file 'src/Canonical.UbuntuOne.Common/objects.xml' |
1842 | --- src/Canonical.UbuntuOne.Common/objects.xml 2010-07-30 16:32:54 +0000 |
1843 | +++ src/Canonical.UbuntuOne.Common/objects.xml 2010-08-09 16:14:47 +0000 |
1844 | @@ -31,8 +31,19 @@ |
1845 | <property name="RSSFeed" |
1846 | value="http://path/to/rss.feed"/> <!-- Provide a way to set this through config ????--> |
1847 | </object> |
1848 | - |
1849 | - |
1850 | + |
1851 | + <!-- ######################################################################################## --> |
1852 | + <!-- Util Objects --> |
1853 | + <!-- ######################################################################################## --> |
1854 | + |
1855 | + <object id="Webbrowser" |
1856 | + type="Canonical.UbuntuOne.Common.Utils.Webbrowser, Canonical.UbuntuOne.Common" /> |
1857 | + |
1858 | + <object id="Explorer" |
1859 | + type="Canonical.UbuntuOne.Common.Utils.Explorer, Canonical.UbuntuOne.Common" /> |
1860 | + |
1861 | + <object id="Application" |
1862 | + type="Canonical.UbuntuOne.Common.Utils.ApplicationWrapper, Canonical.UbuntuOne.Common" /> |
1863 | |
1864 | </objects> |
1865 | |
1866 | \ No newline at end of file |
1867 | |
1868 | === modified file 'src/Canonical.UbuntuOne.ProcessDispatcher/SyncConfigurationService.cs' |
1869 | --- src/Canonical.UbuntuOne.ProcessDispatcher/SyncConfigurationService.cs 2010-07-26 11:10:16 +0000 |
1870 | +++ src/Canonical.UbuntuOne.ProcessDispatcher/SyncConfigurationService.cs 2010-08-09 16:14:47 +0000 |
1871 | @@ -26,6 +26,15 @@ |
1872 | class SyncConfigurationService : ISyncConfiguration |
1873 | { |
1874 | /// <summary> |
1875 | + /// Provides a way that the client can use to register itself to be notified about events |
1876 | + /// through callbacks. The client should implemented the ISyncDaemonClient interface. |
1877 | + /// </summary> |
1878 | + public void RegisterClient() |
1879 | + { |
1880 | + throw new NotImplementedException(); |
1881 | + } |
1882 | + |
1883 | + /// <summary> |
1884 | /// Returns the throttling limits that have been set up for the daemon. |
1885 | /// </summary> |
1886 | /// <returns>The upload and downloads limits that the daemon has.</returns> |
1887 | |
1888 | === modified file 'src/Canonical.UbuntuOne.ProcessDispatcher/SyncDaemonService.cs' |
1889 | --- src/Canonical.UbuntuOne.ProcessDispatcher/SyncDaemonService.cs 2010-07-26 11:10:16 +0000 |
1890 | +++ src/Canonical.UbuntuOne.ProcessDispatcher/SyncDaemonService.cs 2010-08-09 16:14:47 +0000 |
1891 | @@ -82,6 +82,7 @@ |
1892 | _processesMap = new Dictionary<string, IProcessManager>(); |
1893 | } |
1894 | |
1895 | + |
1896 | /// <summary> |
1897 | /// Allows to start the daemon by a client. |
1898 | /// </summary> |
1899 | @@ -194,6 +195,15 @@ |
1900 | } |
1901 | |
1902 | /// <summary> |
1903 | + /// Provides a way that the client can use to register itself to be notified about events |
1904 | + /// through callbacks. The client should implemented the ISyncDaemonClient interface. |
1905 | + /// </summary> |
1906 | + public void RegisterClient() |
1907 | + { |
1908 | + throw new NotImplementedException(); |
1909 | + } |
1910 | + |
1911 | + /// <summary> |
1912 | /// Allows to query the service about the current status of the daemon. |
1913 | /// </summary> |
1914 | /// <returns>A data contract that contains the current status of the daemon.</returns> |
1915 | |
1916 | === modified file 'src/Canonical.UbuntuOne.ProcessDispatcher/SyncFileManagerService.cs' |
1917 | --- src/Canonical.UbuntuOne.ProcessDispatcher/SyncFileManagerService.cs 2010-07-26 11:10:16 +0000 |
1918 | +++ src/Canonical.UbuntuOne.ProcessDispatcher/SyncFileManagerService.cs 2010-08-09 16:14:47 +0000 |
1919 | @@ -26,6 +26,15 @@ |
1920 | { |
1921 | class SyncFileManagerService : ISyncFileManager |
1922 | { |
1923 | + /// <summary> |
1924 | + /// Provides a way that the client can use to register itself to be notified about events |
1925 | + /// through callbacks. The client should implemented the ISyncDaemonClient interface. |
1926 | + /// </summary> |
1927 | + public void RegisterClient() |
1928 | + { |
1929 | + throw new NotImplementedException(); |
1930 | + } |
1931 | + |
1932 | [DebugLogged] |
1933 | public IDictionary<string, string> GetMetadata(string path) |
1934 | { |
1935 | |
1936 | === modified file 'src/Canonical.UbuntuOne.ProcessDispatcher/SyncFoldersService.cs' |
1937 | --- src/Canonical.UbuntuOne.ProcessDispatcher/SyncFoldersService.cs 2010-07-07 10:41:49 +0000 |
1938 | +++ src/Canonical.UbuntuOne.ProcessDispatcher/SyncFoldersService.cs 2010-08-09 16:14:47 +0000 |
1939 | @@ -26,6 +26,15 @@ |
1940 | class SyncFoldersService : ISyncFolders |
1941 | { |
1942 | /// <summary> |
1943 | + /// Provides a way that the client can use to register itself to be notified about events |
1944 | + /// through callbacks. The client should implemented the ISyncDaemonClient interface. |
1945 | + /// </summary> |
1946 | + public void RegisterClient() |
1947 | + { |
1948 | + throw new NotImplementedException(); |
1949 | + } |
1950 | + |
1951 | + /// <summary> |
1952 | /// Creates a new udf for the given path. |
1953 | /// </summary> |
1954 | /// <param name="path">The path to which the Udf will be created.</param> |
1955 | |
1956 | === modified file 'src/Canonical.UbuntuOne.ProcessDispatcher/SyncSharesService.cs' |
1957 | --- src/Canonical.UbuntuOne.ProcessDispatcher/SyncSharesService.cs 2010-07-26 11:10:16 +0000 |
1958 | +++ src/Canonical.UbuntuOne.ProcessDispatcher/SyncSharesService.cs 2010-08-09 16:14:47 +0000 |
1959 | @@ -27,6 +27,15 @@ |
1960 | class SyncSharesService : ISyncShares |
1961 | { |
1962 | /// <summary> |
1963 | + /// Provides a way that the client can use to register itself to be notified about events |
1964 | + /// through callbacks. The client should implemented the ISyncDaemonClient interface. |
1965 | + /// </summary> |
1966 | + public void RegisterClient() |
1967 | + { |
1968 | + throw new NotImplementedException(); |
1969 | + } |
1970 | + |
1971 | + /// <summary> |
1972 | /// Allows the client to query and get all the different shares that the user has. |
1973 | /// </summary> |
1974 | /// <returns>Returns a list with all the shares that the user has.</returns> |
1975 | |
1976 | === modified file 'src/UbuntuOneClient.Tests/ProgramFixture.cs' |
1977 | --- src/UbuntuOneClient.Tests/ProgramFixture.cs 2010-08-05 19:26:54 +0000 |
1978 | +++ src/UbuntuOneClient.Tests/ProgramFixture.cs 2010-08-09 16:14:47 +0000 |
1979 | @@ -21,6 +21,7 @@ |
1980 | using System.Windows; |
1981 | using Canonical.UbuntuOne.Client.Notification; |
1982 | using Canonical.UbuntuOne.Common.Update; |
1983 | +using Canonical.UbuntuOne.Common.Utils; |
1984 | using NUnit.Framework; |
1985 | using Rhino.Mocks; |
1986 | |
1987 | @@ -79,7 +80,8 @@ |
1988 | _app.ShutdownMode = ShutdownMode.OnExplicitShutdown; |
1989 | |
1990 | // expect that we are calling the run with the correct window |
1991 | - Expect.Call(() => _app.Run(_notifyIcon)) |
1992 | + Expect.Call(() => _app.Run(_notifyIcon as Window)) |
1993 | + .IgnoreArguments() |
1994 | .Repeat.Once(); |
1995 | |
1996 | // return that the are no update, since we have a strict mock the test will |
1997 | @@ -102,7 +104,8 @@ |
1998 | _app.ShutdownMode = ShutdownMode.OnExplicitShutdown; |
1999 | |
2000 | // expect that we are calling the run with the correct window |
2001 | - Expect.Call(() => _app.Run(_notifyIcon)) |
2002 | + Expect.Call(() => _app.Run(_notifyIcon as Window)) |
2003 | + .IgnoreArguments() |
2004 | .Repeat.Once(); |
2005 | |
2006 | // return that the are no update, since we have a strict mock the test will |
2007 | @@ -127,7 +130,8 @@ |
2008 | _app.ShutdownMode = ShutdownMode.OnExplicitShutdown; |
2009 | |
2010 | // expect that we are calling the run with the correct window |
2011 | - Expect.Call(() => _app.Run(_notifyIcon)) |
2012 | + Expect.Call(() => _app.Run(_notifyIcon as Window)) |
2013 | + .IgnoreArguments() |
2014 | .Repeat.Once(); |
2015 | |
2016 | // throw an exception and expect it to be caught and continue. |
2017 | |
2018 | === modified file 'src/UbuntuOneClient.Tests/UbuntuOneClient.Tests.csproj' |
2019 | --- src/UbuntuOneClient.Tests/UbuntuOneClient.Tests.csproj 2010-07-30 16:32:54 +0000 |
2020 | +++ src/UbuntuOneClient.Tests/UbuntuOneClient.Tests.csproj 2010-08-09 16:14:47 +0000 |
2021 | @@ -43,6 +43,9 @@ |
2022 | <SpecificVersion>False</SpecificVersion> |
2023 | <HintPath>..\..\lib\Nunit\nunit.framework.dll</HintPath> |
2024 | </Reference> |
2025 | + <Reference Include="PresentationCore"> |
2026 | + <RequiredTargetFramework>3.0</RequiredTargetFramework> |
2027 | + </Reference> |
2028 | <Reference Include="PresentationFramework"> |
2029 | <RequiredTargetFramework>3.0</RequiredTargetFramework> |
2030 | </Reference> |
2031 | |
2032 | === removed file 'src/UbuntuOneClient/ApplicationWrapper.cs' |
2033 | --- src/UbuntuOneClient/ApplicationWrapper.cs 2010-07-28 11:03:35 +0000 |
2034 | +++ src/UbuntuOneClient/ApplicationWrapper.cs 1970-01-01 00:00:00 +0000 |
2035 | @@ -1,55 +0,0 @@ |
2036 | -using System; |
2037 | -/** |
2038 | - * Copyright 2010 Canonical Ltd. |
2039 | - * |
2040 | - * This file is part of UbuntuOne on Windows. |
2041 | - * |
2042 | - * UbuntuOne on Windows is free software: you can redistribute it and/or modify |
2043 | - * it under the terms of the GNU Lesser General Public License version |
2044 | - * as published by the Free Software Foundation. |
2045 | - * |
2046 | - * Ubuntu One on Windows is distributed in the hope that it will be useful, |
2047 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2048 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2049 | - * GNU Lesser General Public License for more details. |
2050 | - * |
2051 | - * You should have received a copy of the GNU Lesser General Public License |
2052 | - * along with UbuntuOne for Windows. If not, see <http://www.gnu.org/licenses/>. |
2053 | - * |
2054 | - * Authors: Manuel de la Peña <manuel.delapena@canonical.com> |
2055 | - */ |
2056 | -using System.Threading; |
2057 | -using System.Windows; |
2058 | -using Canonical.UbuntuOne.Client.Notification; |
2059 | -using Canonical.UbuntuOne.Common.Validation; |
2060 | - |
2061 | -namespace UbuntuOneClient |
2062 | -{ |
2063 | - /// <summary> |
2064 | - /// Helper class that has been created to allow an easy way to test the Program class that starts the application. |
2065 | - /// </summary> |
2066 | - internal class ApplicationWrapper : IApplication |
2067 | - { |
2068 | - private readonly Application _app; |
2069 | - |
2070 | - public ApplicationWrapper() |
2071 | - { |
2072 | - _app = new Application(); |
2073 | - } |
2074 | - |
2075 | - public void Run(INotificationIconView notificationIcon) |
2076 | - { |
2077 | - ValidateArgs.Begin() |
2078 | - .IsOfType(notificationIcon, typeof (Window), "notificationIcon") |
2079 | - .Check(); |
2080 | - var window = (Window)notificationIcon; |
2081 | - _app.Run(window); |
2082 | - } |
2083 | - |
2084 | - public ShutdownMode ShutdownMode |
2085 | - { |
2086 | - get { return _app.ShutdownMode; } |
2087 | - set { _app.ShutdownMode = value; } |
2088 | - } |
2089 | - } |
2090 | -} |
2091 | |
2092 | === removed file 'src/UbuntuOneClient/IApplication.cs' |
2093 | --- src/UbuntuOneClient/IApplication.cs 2010-07-28 11:03:35 +0000 |
2094 | +++ src/UbuntuOneClient/IApplication.cs 1970-01-01 00:00:00 +0000 |
2095 | @@ -1,41 +0,0 @@ |
2096 | -/** |
2097 | - * Copyright 2010 Canonical Ltd. |
2098 | - * |
2099 | - * This file is part of UbuntuOne on Windows. |
2100 | - * |
2101 | - * UbuntuOne on Windows is free software: you can redistribute it and/or modify |
2102 | - * it under the terms of the GNU Lesser General Public License version |
2103 | - * as published by the Free Software Foundation. |
2104 | - * |
2105 | - * Ubuntu One on Windows is distributed in the hope that it will be useful, |
2106 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2107 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2108 | - * GNU Lesser General Public License for more details. |
2109 | - * |
2110 | - * You should have received a copy of the GNU Lesser General Public License |
2111 | - * along with UbuntuOne for Windows. If not, see <http://www.gnu.org/licenses/>. |
2112 | - * |
2113 | - * Authors: Manuel de la Peña <manuel.delapena@canonical.com> |
2114 | - */ |
2115 | -using System.Windows; |
2116 | -using Canonical.UbuntuOne.Client.Notification; |
2117 | - |
2118 | -namespace UbuntuOneClient |
2119 | -{ |
2120 | - /// <summary> |
2121 | - /// Helper interface that has been added to make the code more testable in the program class. |
2122 | - /// </summary> |
2123 | - public interface IApplication |
2124 | - { |
2125 | - /// <summary> |
2126 | - /// Runs an application using the passed window as its main window in the thread. |
2127 | - /// </summary> |
2128 | - /// <param name="notificationIcon">The notification icon used by the user to interact with the daemon.</param> |
2129 | - void Run(INotificationIconView notificationIcon); |
2130 | - |
2131 | - /// <summary> |
2132 | - /// Gets and sets the shutdown mode to be used in the application. |
2133 | - /// </summary> |
2134 | - ShutdownMode ShutdownMode { get; set; } |
2135 | - } |
2136 | -} |
2137 | |
2138 | === modified file 'src/UbuntuOneClient/Program.cs' |
2139 | --- src/UbuntuOneClient/Program.cs 2010-07-30 16:32:54 +0000 |
2140 | +++ src/UbuntuOneClient/Program.cs 2010-08-09 16:14:47 +0000 |
2141 | @@ -23,6 +23,7 @@ |
2142 | using Canonical.UbuntuOne.Client.Notification; |
2143 | using Canonical.UbuntuOne.Common.Container; |
2144 | using Canonical.UbuntuOne.Common.Update; |
2145 | +using Canonical.UbuntuOne.Common.Utils; |
2146 | using log4net; |
2147 | |
2148 | namespace UbuntuOneClient |
2149 | @@ -125,7 +126,7 @@ |
2150 | _updatesThread = new Thread(CheckForUpdates); |
2151 | _updatesThread.Start(); |
2152 | // we do not worry about looping to allow the other thread to finish, we no that app should take longer |
2153 | - Application.Run(NotifyIcon); |
2154 | + Application.Run(NotifyIcon as Window); |
2155 | } |
2156 | |
2157 | /// <summary> |
2158 | |
2159 | === modified file 'src/UbuntuOneClient/UbuntuOneClient.csproj' |
2160 | --- src/UbuntuOneClient/UbuntuOneClient.csproj 2010-08-02 17:57:48 +0000 |
2161 | +++ src/UbuntuOneClient/UbuntuOneClient.csproj 2010-08-09 16:14:47 +0000 |
2162 | @@ -65,8 +65,6 @@ |
2163 | <Compile Include="..\Version.cs"> |
2164 | <Link>Version.cs</Link> |
2165 | </Compile> |
2166 | - <Compile Include="ApplicationWrapper.cs" /> |
2167 | - <Compile Include="IApplication.cs" /> |
2168 | <Compile Include="Program.cs" /> |
2169 | <Compile Include="Properties\AssemblyInfo.cs"> |
2170 | <SubType>Code</SubType> |
2171 | |
2172 | === modified file 'src/Version.cs' |
2173 | --- src/Version.cs 2010-08-04 14:20:36 +0000 |
2174 | +++ src/Version.cs 2010-08-09 16:14:47 +0000 |
2175 | @@ -10,6 +10,6 @@ |
2176 | // </auto-generated> |
2177 | //------------------------------------------------------------------------------ |
2178 | |
2179 | -[assembly: AssemblyVersionAttribute("1.0.404.5869")] |
2180 | -[assembly: AssemblyFileVersionAttribute("1.0.404.5869")] |
2181 | +[assembly: AssemblyVersionAttribute("1.0.409.6549")] |
2182 | +[assembly: AssemblyFileVersionAttribute("1.0.409.6549")] |
2183 |