// Wait until time has elapsed, then check to see // if anyone is listening, and send the message public void Run() { // sleep until time has elapsed Thread.Sleep(seconds * 1000); if (TimeExpired != null) { // Create the CountDownClockEventArgs to hold the message CountDownClockEventArgs e = new CountDownClockEventArgs(this.message); // fire the event TimeExpired(this, e); } }
// Alert the user that the time has expired public void TimeExpired(object theClock, CountDownClockEventArgs e) { Console.WriteLine("You requested to receive this message: {0}", e.message); }
// Alert the user that the time has expired public void TimeExpired(object theClock, CountDownClockEventArgs e) { Console.WriteLine("You requested to receive this message: {0}", e.message); }