Beispiel #1
0
        public void StartTimer(int time, String user)
        {
            for (int i = time; i > 0; i--)
            {
                Console.WriteLine(i);
                Thread.Sleep(1000);
            }
            TimerEventArgs e = new TimerEventArgs();

            e.AcknowledgeSource(this.clockName);
            e.AcknowledgeUser(user);
            timerEventHandler(this, e);
        }
Beispiel #2
0
 //定义事件处理方法
 public static void Message(object sender, TimerEventArgs e)
 {
     Console.WriteLine(e.GetUser() + "'s " + e.GetSource() + " says: time is up!");
 }