void clock2(Object sender, TickClock args1, AlarmClock args2) { if (args1.nowTime == args2.alarmTime) { Console.WriteLine("闹钟响了"); } Thread.Sleep(1000); }
//触发事件 public void onClock() { TickClock args1 = new TickClock(); AlarmClock args2 = new AlarmClock("19:56:00"); TickClock(this, args1); AlarmClock(this, args1, args2); }
void clock1(Object sender, TickClock args) { Console.WriteLine("现在时间是:" + args.nowTime); }