Exemple #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);
     }
 }
Exemple #2
0
        protected virtual void OnThresholdReached(ThresholdReachedEventArgs e)
        {
            EventHandler <ThresholdReachedEventArgs> handler = ThresholdReached;

            if (handler != null)
            {
                handler(this, e);
            }
            //ThresholdReached(this, e);
            //ThresholdReached?.Invoke(this, e);
        }
Exemple #3
0
 private 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);
 }