private void timer_Tick(object sender, EventArgs e) { if (OnCountDown()) { HourArea.Text = processCount.GetHour(); MinuteArea.Text = processCount.GetMinute(); SecondArea.Text = processCount.GetSecond(); } else { using (SoundPlayer player = new SoundPlayer()) { player.SoundLocation = System.Environment.CurrentDirectory + "//Notify_Timeup.wav"; player.Play(); } countDownTimer.Stop(); ExternalFunctions.OnKeyDown((uint)asciiEncoding.GetBytes("S")[0]); MessageBox.Show("时间到了,请起身休息一下:)"); } }
private void Window_KeyDown(object sender, KeyEventArgs e) { ExternalFunctions.OnKeyDown((uint)asciiEncoding.GetBytes(e.Key.ToString())[e.Key.ToString().Length - 1]); }