Пример #1
0
 // By convention this method must be "protected", so it can be inherit
 protected void OnTimer(string msg)
 {
     // Check if we have any subscribers
     if (RaiseTimerEvent != null)
     {
         // Raise event with string parameter passed from another method
         TimerEventArgs e = new TimerEventArgs(msg);
         RaiseTimerEvent(this, e);
     }
 }
Пример #2
0
 // Method to be added to the "TimerEventHandler" delegate
 static void PastSeconds(object sender, TimerEventArgs e)
 {
     Console.WriteLine("Seconds past: {0}", e.Message);
 }