Example #1
0
        //Raise the event
        protected virtual void OnThresholdReached(ThresholdReachedEventArgs e)
        {
            EventHandler <ThresholdReachedEventArgs> handler = ThresholdReached;

            //The non-generic version will be
            //EventHandler handler = ThresholdReached;
            if (handler != null)
            {
                handler(this, e);
            }
        }
Example #2
0
 public void Add(int x)
 {
     total += x;
     if (total >= threshold)
     {
         ThresholdReachedEventArgs args = new ThresholdReachedEventArgs();
         args.Threshold   = threshold;
         args.TimeReached = DateTime.Now;
         OnThresholdReached(args);
     }
 }