示例#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);
            }
        }
示例#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);
     }
 }