public void Ring(int hour, int min, int sec) { AlarmClockArgs args = new AlarmClockArgs(); args.Hour = hour; args.Min = min; args.Sec = sec; while (args.Hour != DateTime.Now.Hour || args.Min != DateTime.Now.Minute || args.Sec != DateTime.Now.Second) { System.Threading.Thread.Sleep(0); } TimeOut(this, args); }
static void clock_Alarmclock(object sender, AlarmClockArgs args) { Console.WriteLine("Time out!"); }