public void DoTime() { double total; Console.Write("请设置提示时间(s): "); string s = Console.ReadLine(); total = double.Parse(s); while (total != 0) { System.Threading.Thread.Sleep(1000); total--; } if (Ring != null) { TimeArgs args = new TimeArgs(); args.time = total; Ring(this, args); } }
//事件处理方法 static void Show(object sender, TimeArgs e) { Console.WriteLine("The alarm is ringing!"); }