示例#1
0
 void Alarm(ClockEventArgs args)
 {
     if (args.sec > 20 && args.sec < 30)
     {
         Console.WriteLine("Clock is Alarming...");
     }
 }
示例#2
0
 void Tick(ClockEventArgs args)
 {
     if (args.sec == 60)
     {
         args.min++;
     }
     if (args.min == 60)
     {
         args.hour++;
     }
     if (args.hour == 24)
     {
         args.hour = 0;
     }
     Console.WriteLine("Clock is Ticking...");
 }
示例#3
0
        public void Go()
        {
            ClockEventArgs args = new ClockEventArgs()
            {
                hour = 0,
                min  = 0,
                sec  = 0
            };

            while (true)
            {
                Run(args);
                args.sec++;
                System.Threading.Thread.Sleep(1000);
            }
        }