public void PauseCount() { Thread.Sleep(10000); //10 second pause ClockArgs e = new ClockArgs(this.clockCount); OnAlarm(e); }
public void StopCount() { Thread.Sleep(Timeout.Infinite); //set permanent pause ClockArgs e = new ClockArgs(this.clockCount); OnAlarm(e); }
public void ClockUser(object sender, ClockArgs e) { Console.WriteLine(e.clockCount + " Seconds remaining"); if (e.clockCount == 0) { Console.WriteLine("Goodbye"); } }
//////////////////////////////clock methods////////////////////////////////////////////// public void Start() { while (this.clockCount > 0) { Thread.Sleep(1000); this.clockCount--; ClockArgs e = new ClockArgs(this.clockCount); OnAlarm(e); } }
protected virtual void OnAlarm(ClockArgs e) { ClockEventHandler handler = Alarm; if (handler != null) { // Invokes the delegates. handler(this, e); } }