public void IsTime() { ClockEventArgs setClock = new ClockEventArgs(); setClock.SetTime = Console.ReadLine(); while (true) { string currentTime = DateTime.Now.ToShortTimeString().ToString(); if (currentTime == setClock.SetTime) { informing(this, setClock); break; } } }
static void ClockInforming(object sender, ClockEventArgs t) { Console.WriteLine("时间到了!"); }