private void startButton_Click(object sender, RoutedEventArgs e)
        {
            if (isRunning)
            {
                startButton.Content = "确定";
                setEditEnable(true);
                cancelCountdown();
                SystemSleepManagement.RestoreSleep();
            }
            else
            {
                try
                {
                    limitSpeed = Convert.ToInt16(tbLimit.Text);
                    limitCount = Convert.ToInt16(tbCountdown.Text);
                }
                catch (FormatException fe)
                {
                    MessageBox.Show("解析数字错误");
                    return;
                }

                startButton.Content = "取消";
                setEditEnable(false);
                SystemSleepManagement.PreventSleep();
            }
            isRunning = !isRunning;
        }
 private void Window_Closed(object sender, EventArgs e)
 {
     SystemSleepManagement.RestoreSleep();
     Environment.Exit(0);
 }