public void Alarm() { ClockEventArgs args = new ClockEventArgs() { alarmingTime = DateTime.Now }; AlarmEvent(this, args); }
public void Tick() { Thread.Sleep(1000); ClockEventArgs args = new ClockEventArgs() { tickingTime = DateTime.Now }; TickEvent(this, args); }
static void AlarmListener(object sender, ClockEventArgs args) { Console.WriteLine("响铃啦!当前时间:" + args.alarmingTime); }
static void TickListener(object sender, ClockEventArgs args) { Console.WriteLine("秒针摆动!当前时间:" + args.tickingTime); }