コード例 #1
0
ファイル: Timer.cs プロジェクト: memoninja/Telerik-Academy
 // 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);
 }