public void Resolve(T data) { if (Canceled()) { return; } finished?.Invoke(this, data); FinishReport(progressId); }
public bool Canceled() { if (!IsValid()) { return(true); } if (cancelEvent == null) { return(false); } if (!cancelEvent.WaitOne(0)) { return(false); } canceled = true; ClearReport(); if (resolver != null) { Dispatcher.Enqueue(() => resolver.Invoke(this, null)); } return(true); }
public void Resolve(T data, bool completed = true) { if (!IsValid()) { return; } if (Canceled()) { return; } resolver?.Invoke(this, data); if (completed) { Dispose(); } }
public bool Canceled() { if (cancelEvent == null) { return(false); } if (!cancelEvent.WaitOne(0)) { return(false); } canceled = true; ClearReport(progressId); if (finished != null) { Dispatcher.Enqueue(() => finished.Invoke(this, null)); } return(true); }