Ejemplo n.º 1
0
 public LazyNotifyTaskCompletion(Func <Task <TResult> > task, bool lazyLoad = true)
 {
     lazy = new AsyncAuto <TResult>(task);
     lazy.IsValueCreatedChanged   += Lazy_IsValueCreatedChanged;
     _taskCompletedSource          = new TaskCompletionSource <object>();
     _notificationsCompletedSource = new TaskCompletionSource <object>();
     if (!lazyLoad)
     {
         lazy.Start();
     }
 }
Ejemplo n.º 2
0
 public LazyNotifyTaskCompletion0(Func <Task> task, bool lazyLoad = true)
 {
     lazy = new AsyncAuto <object>(async() =>
     {
         await task();
         return(null);
     });
     lazy.IsValueCreatedChanged   += Lazy_IsValueCreatedChanged;
     _taskCompletedSource          = new TaskCompletionSource <object>();
     _notificationsCompletedSource = new TaskCompletionSource <object>();
     if (!lazyLoad)
     {
         lazy.Start();
     }
 }