private bool Canceling(TimeSpan elapsed, TimeSpan?remaining, Delay.CancelDelegate cancel) { var e = new DelayEventArgs(elapsed, remaining); if (cancel?.Invoke(e) == true) { return(true); } OnBlocking(e); return(e.Cancel); }
private void Update(DelayEventArgs e) { if (null == e) { throw new ArgumentNullException(nameof(e)); } Elapsed = e.Elapsed; Remaining = e.Remaining; Determinate = e.Determinate; if (Canceling) { Canceling = false; e.Cancel = true; } }
protected virtual void OnComplete(DelayEventArgs e) => Complete?.Invoke(this, e);
protected virtual void OnBlocking(DelayEventArgs e) => Blocking?.Invoke(this, e);
protected virtual void OnStarting(DelayEventArgs e) => Starting?.Invoke(this, e);
private void Delay_Complete(object sender, DelayEventArgs e) { Update(e); }
private void Delay_Blocking(object sender, DelayEventArgs e) { Update(e); }
private void Delay_Starting(object sender, DelayEventArgs e) { Update(e); }