Revision 2115e2a5 trunk/Pithos.Client.WPF/Shell/ShellViewModel.cs
b/trunk/Pithos.Client.WPF/Shell/ShellViewModel.cs | ||
---|---|---|
324 | 324 |
_sparkle.ShowDiagnosticWindow = Settings.UpdateDiagnostics; |
325 | 325 |
} |
326 | 326 |
|
327 |
private async void StartMonitoring()
|
|
327 |
private async Task StartMonitoring()
|
|
328 | 328 |
{ |
329 | 329 |
try |
330 | 330 |
{ |
... | ... | |
359 | 359 |
} |
360 | 360 |
} |
361 | 361 |
|
362 |
public Task MonitorAccount(AccountSettings account) |
|
362 |
public async Task MonitorAccount(AccountSettings account)
|
|
363 | 363 |
{ |
364 |
return Task.Factory.StartNew(() => |
|
365 |
{ |
|
364 |
await TaskEx.Yield(); |
|
366 | 365 |
PithosMonitor monitor; |
367 | 366 |
var accountName = account.AccountName; |
368 | 367 |
|
... | ... | |
381 | 380 |
monitor.RootPath = account.RootPath; |
382 | 381 |
//Start the monitor. It's OK to start an already started monitor, |
383 | 382 |
//it will just ignore the call |
384 |
StartMonitor(monitor).Wait();
|
|
383 |
await StartMonitor(monitor);
|
|
385 | 384 |
} |
386 | 385 |
else |
387 | 386 |
{ |
... | ... | |
428 | 427 |
if (String.IsNullOrWhiteSpace(monitor.UserName) || |
429 | 428 |
String.IsNullOrWhiteSpace(monitor.ApiKey)) |
430 | 429 |
return; |
431 |
StartMonitor(monitor); |
|
430 |
await StartMonitor(monitor);
|
|
432 | 431 |
} |
433 |
}); |
|
432 |
|
|
434 | 433 |
} |
435 | 434 |
|
436 | 435 |
private void MigrateFolders(AccountSettings account) |
... | ... | |
933 | 932 |
|
934 | 933 |
private void TryAuthenticateProxy(PithosMonitor monitor,int retries) |
935 | 934 |
{ |
936 |
Execute.OnUIThread(() => |
|
935 |
Execute.OnUIThread(async () =>
|
|
937 | 936 |
{ |
938 | 937 |
var proxyAccount = IoC.Get<ProxyAccountViewModel>(); |
939 | 938 |
proxyAccount.Settings = Settings; |
940 | 939 |
if (true != _windowManager.ShowDialog(proxyAccount)) |
941 | 940 |
return; |
942 |
StartMonitor(monitor, retries); |
|
941 |
await StartMonitor(monitor, retries);
|
|
943 | 942 |
NotifyOfPropertyChange(() => Accounts); |
944 | 943 |
}); |
945 | 944 |
} |
... | ... | |
961 | 960 |
private void TryLater(PithosMonitor monitor, Exception exc,int retries) |
962 | 961 |
{ |
963 | 962 |
var message = String.Format("An exception occured. Can't start monitoring\nWill retry in 10 seconds"); |
964 |
Task.Factory.StartNewDelayed(10000, () => StartMonitor(monitor,retries+1)); |
|
963 |
|
|
964 |
TaskEx.Delay(10000).ContinueWith(t=>StartMonitor(monitor,retries+1)); |
|
965 | 965 |
_events.Publish(new Notification |
966 | 966 |
{Title = "Error", Message = message, Level = TraceLevel.Error}); |
967 | 967 |
Log.Error(message, exc); |
Also available in: Unified diff