Example #1
0
        public void PauseCount()
        {
            Thread.Sleep(10000);  //10 second pause
            ClockArgs e = new ClockArgs(this.clockCount);

            OnAlarm(e);
        }
Example #2
0
        public void StopCount()
        {
            Thread.Sleep(Timeout.Infinite); //set permanent pause
            ClockArgs e = new ClockArgs(this.clockCount);

            OnAlarm(e);
        }
Example #3
0
 public void ClockUser(object sender, ClockArgs e)
 {
     Console.WriteLine(e.clockCount + " Seconds remaining");
     if (e.clockCount == 0)
     {
         Console.WriteLine("Goodbye");
     }
 }
Example #4
0
 //////////////////////////////clock methods//////////////////////////////////////////////
 public void Start()
 {
     while (this.clockCount > 0)
     {
         Thread.Sleep(1000);
         this.clockCount--;
         ClockArgs e = new ClockArgs(this.clockCount);
         OnAlarm(e);
     }
 }
Example #5
0
        protected virtual void OnAlarm(ClockArgs e)
        {
            ClockEventHandler handler = Alarm;

            if (handler != null)
            {
                // Invokes the delegates.
                handler(this, e);
            }
        }