Ejemplo n.º 1
0
        protected virtual void OnThresholdReached(ThresholdReachedEventArgs1 e)
        {
            ThresholdReachedEventHandler handler = ThresholdReached;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Ejemplo n.º 2
0
 //4. method
 public void Add(int x)
 {
     total += x;
     if (total >= threshold)
     {
         ThresholdReachedEventArgs1 args = new ThresholdReachedEventArgs1();
         args.Threshold   = threshold;
         args.TimeReached = DateTime.Now;
         OnThresholdReached(args);
     }
 }
Ejemplo n.º 3
0
 //3. eventHander
 static void c_ThresholdReached(object sender, ThresholdReachedEventArgs1 e)
 {
     Console.WriteLine("The threshold of {0} was reached at {1}.", e.Threshold, e.TimeReached);
     Environment.Exit(0);
 }