Exemplo n.º 1
0
        protected virtual void OnConditionFailed(ConditionFailedEventArgs e)
        {
            EventHandler <ConditionFailedEventArgs> handler = ConditionFailed_delegate;

            if (handler != null)
            {
                handler(this, e);
            }
            else
            {
                Console.WriteLine("OnConditionFailed does not have a handler yet");
            }
        }
Exemplo n.º 2
0
 public void Eat(int x)
 {
     totalEaten += CalculateFoodSize(x);
     if (totalEaten > foodTillFull)
     {
         ThresholdReachedEventArgs args = new ThresholdReachedEventArgs(totalEaten, DateTime.Now);
         OnThresholdReached(args);
     }
     else
     {
         ConditionFailedEventArgs args = new ConditionFailedEventArgs(DateTime.Now);
         OnConditionFailed(args);
     }
 }
Exemplo n.º 3
0
 static void HandleConditionFailed(object sender, ConditionFailedEventArgs e)
 {
     Console.WriteLine("Condition from object {0} at {1}", sender.GetHashCode(), e.TimeFailed);
 }