Revision a27aa447 trunk/Pithos.Client.WPF/TaskbarViewModel.cs
b/trunk/Pithos.Client.WPF/TaskbarViewModel.cs | ||
---|---|---|
179 | 179 |
_events.Publish(new Notification { Title = "Start", Message = "Start Monitoring", Level = TraceLevel.Info}); |
180 | 180 |
if (!String.IsNullOrWhiteSpace(Monitor.UserName) && |
181 | 181 |
!String.IsNullOrWhiteSpace(Monitor.ApiKey)) |
182 |
Task.Factory.StartNew(() => |
|
183 |
Monitor.Start()) |
|
184 |
.ContinueWith(t =>{ |
|
185 |
if (t.IsFaulted) |
|
186 |
{ |
|
187 |
|
|
188 |
var message= String.Format("An exception occured. Can't start monitoring\n{0}",t.Exception); |
|
189 |
_events.Publish(new Notification { Title = "Error",Message=message,Level= TraceLevel.Error }); |
|
190 |
MessageBox.Show(message); |
|
191 |
} |
|
192 |
}); |
|
182 |
StartMonitor(); |
|
183 |
} |
|
184 |
|
|
185 |
private void StartMonitor() |
|
186 |
{ |
|
187 |
Task.Factory.StartNew(() => |
|
188 |
{ |
|
189 |
try |
|
190 |
{ |
|
191 |
Monitor.Start(); |
|
192 |
} |
|
193 |
catch(Exception exc) |
|
194 |
{ |
|
195 |
var message = String.Format("An exception occured. Can't start monitoring\nWill retry in 10 seconds\n{0}",exc); |
|
196 |
_events.Publish(new Notification{Title = "Error", Message = message, Level = TraceLevel.Error}); |
|
197 |
Task.Factory.StartNewDelayed(10000, StartMonitor); |
|
198 |
} |
|
199 |
}); |
|
193 | 200 |
} |
194 | 201 |
|
195 |
|
|
196 | 202 |
|
197 | 203 |
public void NotifyChange(string status, TraceLevel level=TraceLevel.Info) |
198 | 204 |
{ |
Also available in: Unified diff