void Alarm(ClockEventArgs args) { if (args.sec > 20 && args.sec < 30) { Console.WriteLine("Clock is Alarming..."); } }
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..."); }
public void Go() { ClockEventArgs args = new ClockEventArgs() { hour = 0, min = 0, sec = 0 }; while (true) { Run(args); args.sec++; System.Threading.Thread.Sleep(1000); } }