コード例 #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();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: agraphe/C-Sharp-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();
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: agraphe/C-Sharp-3.0
 public CountDownTimerDisplay(CountDownClock cdc)
 {
     myHandler = new CountDownClock.TimesUpEventHandler(TimeExpired);
     // register the event handler and start the timer
     cdc.TimeExpired += myHandler;
 }
コード例 #4
0
 public CountDownTimerDisplay(CountDownClock cdc)
 {
     myHandler = new CountDownClock.TimesUpEventHandler(TimeExpired);
     // register the event handler and start the timer
     cdc.TimeExpired += myHandler;
 }