Example #1
0
 public void Add(int x)
 {
     total += x;
     if (total >= threshold)
     {
         ThresholdReachedEventArgs args = new ThresholdReachedEventArgs();
         args.Threshold   = threshold;
         args.TimeReached = DateTime.Now;
         OnThresholdReached(args);
     }
 }
Example #2
0
 static void MethodThresholdReached(object sender, ThresholdReachedEventArgs e)
 {
     Console.WriteLine(sender);
     Console.WriteLine($"{e.Threshold} was reached at {e.TimeReached}");
 }
Example #3
0
        protected virtual void OnThresholdReached(ThresholdReachedEventArgs e)
        {
            EventHandler <ThresholdReachedEventArgs> handler = ThresholdReached;

            handler?.Invoke(this, e);
        }