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(); } }
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(); } }