/// <summary> /// 初始化倒计时 /// </summary> private void InitClock() { pCount = new ProcessCount(40); tbSecond.Text = pCount.GetSecond(); timer = new DispatcherTimer(); timer.Tick += new EventHandler(timer_Tick); timer.Interval = TimeSpan.FromMilliseconds(1000); timer.Start(); }
private void timer_Tick(object sender, EventArgs args) { if (pCount.ProcessCountDown()) { tbSecond.Text = pCount.GetSecond(); } else { timer.Stop(); this.Close(); // CommonHelper.SpeechToPrompt("40秒没有开始考试"); // CommonHelper.mainWindow.Content = new Login(); } }