public void Tick1() { while (!(DateTime.Now.Hour == Hour && DateTime.Now.Minute == Min && DateTime.Now.Second == Sec)) { Alarmevent alarm2event = new Alarmevent(DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second, "滴答..."); Tick(this, alarm2event); } }
public void ring() { while (!(DateTime.Now.Hour == Hour && DateTime.Now.Minute == Min && DateTime.Now.Second == Sec)) { } Alarmevent alarmevent = new Alarmevent(Hour, Min, Sec, "响铃"); alarm(this, alarmevent); }
private static void AlarmTrigger(object sender, Alarmevent a) { string message = string.Format("{0}时{1}分{2}秒,{3}", a.Hour, a.Min, a.Sec, a.AlarmTime); Console.WriteLine(message); }