Revision ff26eb71 trunk/Pithos.Client.WPF/ShellViewModel.cs
b/trunk/Pithos.Client.WPF/ShellViewModel.cs | ||
---|---|---|
80 | 80 |
{ |
81 | 81 |
base.OnActivate(); |
82 | 82 |
|
83 |
|
|
84 |
var tasks=from account in Settings.Accounts |
|
85 |
select MonitorAccount(account); |
|
86 |
|
|
87 |
try |
|
88 |
{ |
|
83 |
StartMonitoring(); |
|
84 |
} |
|
89 | 85 |
|
90 |
Task.Factory.Iterate(tasks).Wait(); |
|
91 |
_statusService=StatusService.Start(); |
|
92 | 86 |
|
87 |
private async Task StartMonitoring() |
|
88 |
{ |
|
89 |
try |
|
90 |
{ |
|
91 |
foreach (var account in Settings.Accounts) |
|
92 |
{ |
|
93 |
await MonitorAccount(account); |
|
94 |
} |
|
95 |
_statusService = StatusService.Start(); |
|
93 | 96 |
} |
94 | 97 |
catch (AggregateException exc) |
95 | 98 |
{ |
96 |
exc.Handle(e =>{ |
|
99 |
exc.Handle(e => |
|
100 |
{ |
|
97 | 101 |
Log.Error("Error while starting monitoring", e); |
98 | 102 |
return true; |
99 | 103 |
}); |
100 | 104 |
throw; |
101 | 105 |
} |
102 |
|
|
103 | 106 |
} |
104 | 107 |
|
105 | 108 |
protected override void OnDeactivate(bool close) |
... | ... | |
115 | 118 |
public Task MonitorAccount(AccountSettings account) |
116 | 119 |
{ |
117 | 120 |
return Task.Factory.StartNew(() => |
118 |
{ |
|
121 |
{ |
|
122 |
throw new Exception("Smoo"); |
|
119 | 123 |
PithosMonitor monitor = null; |
120 | 124 |
var accountName = account.AccountName; |
121 | 125 |
|
Also available in: Unified diff