Beispiel #1
0
        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);
        }
Beispiel #2
0
 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;
     }
 }
Beispiel #3
0
 protected virtual void OnComplete(DelayEventArgs e) =>
 Complete?.Invoke(this, e);
Beispiel #4
0
 protected virtual void OnBlocking(DelayEventArgs e) =>
 Blocking?.Invoke(this, e);
Beispiel #5
0
 protected virtual void OnStarting(DelayEventArgs e) =>
 Starting?.Invoke(this, e);
Beispiel #6
0
 private void Delay_Complete(object sender, DelayEventArgs e)
 {
     Update(e);
 }
Beispiel #7
0
 private void Delay_Blocking(object sender, DelayEventArgs e)
 {
     Update(e);
 }
Beispiel #8
0
 private void Delay_Starting(object sender, DelayEventArgs e)
 {
     Update(e);
 }