public void LookTime() { PresentTime time = new PresentTime(); int bHour = time.Now.Hour; int bMinute = time.Now.Minute; if (bHour == anHour && bMinute == aMinute) { time.Now = DateTime.Now; AlarmEvent(this, time); } else { System.Threading.Thread.Sleep(1000); LookTime(); } }
static void myAlarmEvent(object sender, PresentTime a) { Console.WriteLine("时间到啦"); }