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