Esempio n. 1
0
 public TimedNotification(string text, Action <TimedNotification> remove, IDispatcher dispatcher)
 {
     Text = text;
     Task.Delay(3000).ContinueWith(_ =>
     {
         dispatcher.ExecuteSynchronized(() => remove(this));
     });
 }
Esempio n. 2
0
 /// <summary>
 /// Continue in dispatcher, which is also responsible for catching errors.
 /// </summary>
 internal static void ContinueInDispatcher <T>(this Task <T> task, IDispatcher dispatcher, Action <Func <T> > continuation)
 {
     task.ContinueWith((taskResult, _) =>
     {
         dispatcher.ExecuteSynchronized(() =>
         {
             continuation(() => taskResult.Result);
         });
     }, null);
 }
Esempio n. 3
0
 protected void OnExited()
 {
     _dispatcher.ExecuteSynchronized(() => { Exited?.Invoke(); });
 }