public void Run() { Console.Write("Enter your alert message: "); string message = Console.ReadLine(); // Ask for how many seconds to wait Console.Write("How many seconds to wait? "); int seconds = Convert.ToInt32(Console.ReadLine()); // Create the clock class CountDownClock cdc = new CountDownClock(message, seconds); // Create the observer class CountDownTimerDisplay display = new CountDownTimerDisplay(cdc); cdc.Run(); }
public CountDownTimerDisplay(CountDownClock cdc) { myHandler = new CountDownClock.TimesUpEventHandler(TimeExpired); // register the event handler and start the timer cdc.TimeExpired += myHandler; }