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

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

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

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