Пример #1
0
        public void DoClock()
        {
            Console.WriteLine("请输入计时时间(秒数):");
            int counttime = int.Parse(Console.ReadLine());

            Console.WriteLine("正在计时中……");
            for (int i = 0; i < counttime; i++)
            {
                System.Threading.Thread.Sleep(1000);
            }
            if (Endclock != null)
            {
                ClockEventArgs args = new ClockEventArgs();
                args.time = counttime;
                Endclock(this, args);
            }
        }
Пример #2
0
 static void ShowEnd(object sender, ClockEventArgs e)
 {
     Console.WriteLine("计时结束!共计" + e.time + "秒!");
 }