Ejemplo n.º 1
0
 public CountDownTimerDisplay(CountDownClock cdc)
 {
     // register the event handler and start the timer
     cdc.TimeExpired += (object theClock, CountDownClockEventArgs e) =>
     {
         Console.WriteLine("You requested to receive this message: {0}", e.message);
     };
 }
Ejemplo n.º 2
0
 public CountDownTimerDisplay(CountDownClock cdc)
 {
     // register the event handler and start the timer
     cdc.TimeExpired += (object theClock, CountDownClockEventArgs e) =>
     {
         Console.WriteLine("You requested to receive this message: {0}", e.message);
     };
 }
Ejemplo n.º 3
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();
        }
Ejemplo n.º 4
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();
        }