Example #1
0
        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();
        }
Example #2
0
        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();
        }
Example #3
0
 public CountDownTimerDisplay(CountDownClock cdc)
 {
     myHandler = new CountDownClock.TimesUpEventHandler(TimeExpired);
     // register the event handler and start the timer
     cdc.TimeExpired += myHandler;
 }
Example #4
0
 public CountDownTimerDisplay(CountDownClock cdc)
 {
     myHandler = new CountDownClock.TimesUpEventHandler(TimeExpired);
     // register the event handler and start the timer
     cdc.TimeExpired += myHandler;
 }