public void Run() { while (true) { DateTime t = DateTime.Now; CurrentTime = new MyTime(t.Hour, t.Minute, t.Second); TickEvent(this); if (AlarmTime.Equals(CurrentTime)) { AlarmEvent(this); } Thread.Sleep(1000); } }
public MyClock() { CurrentTime = new MyTime(0, 0, 0); }