Пример #1
0
 public void Add(int x)
 {
     total += x;
     if (total >= threshold)
     {
         ThresholdReachedEventArgs args = new ThresholdReachedEventArgs
         {
             Threshold   = threshold,
             TimeReached = DateTime.Now
         };
         OnThresholdReached(args);
     }
 }
Пример #2
0
 protected virtual void OnThresholdReached(ThresholdReachedEventArgs e)
 {
     ThresholdReached?.Invoke(this, e);
 }
Пример #3
0
 static void C_ThresholdReached(object sender, ThresholdReachedEventArgs e)
 {
     Console.WriteLine("The threshold of {0} was reached at {1}.", e.Threshold, e.TimeReached);
     Environment.Exit(0);
 }