//bool D_idDown = false; //bool F_idDown = false; //bool J_idDown = false; //bool K_idDown = false; /// <summary> /// 键盘按下事件处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void LayoutRoot_KeyDown(object sender, KeyEventArgs e) { // MessageBox.Show("ad"); if (!CommHelper.CheckKeyLicity(e.Key)) { return; } ResponseSign(e); switch (e.Key) { case Key.D: drumHead.KnockPlay(DrumType.LeftSide); break; case Key.F: drumHead.KnockPlay(DrumType.LeftFace); break; case Key.J: drumHead.KnockPlay(DrumType.RightFace); break; case Key.K: drumHead.KnockPlay(DrumType.RightSide); break; case Key.L: drumHead.KnockPlay(DrumType.FaceAll); break; case Key.S: drumHead.KnockPlay(DrumType.SideAll); break; } }
/// <summary> /// 键盘抬起事件处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void LayoutRoot_KeyUp(object sender, KeyEventArgs e) { if (!CommHelper.CheckKeyLicity(e.Key)) { return; } switch (e.Key) { case Key.D: drumHead.RelaseKnockPlay(DrumType.LeftSide); break; case Key.F: drumHead.RelaseKnockPlay(DrumType.LeftFace); break; case Key.J: drumHead.RelaseKnockPlay(DrumType.RightFace); break; case Key.K: drumHead.RelaseKnockPlay(DrumType.RightSide); break; case Key.L: drumHead.RelaseKnockPlay(DrumType.FaceAll); break; case Key.S: drumHead.RelaseKnockPlay(DrumType.SideAll); break; } }
/// <summary> /// 监控按键信号 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void MusicRecordSignPanel_KeyUp(object sender, KeyEventArgs e) { if (!isStart || !CommHelper.CheckKeyLicity(e.Key)) { return; } long realLapseTime = lapseTime - PrelapseTime; PrelapseTime = lapseTime; string tempSign = string.Empty; switch (e.Key) { case Key.D: tempSign = "LS-" + realLapseTime; break; case Key.F: tempSign = "LF-" + realLapseTime; break; case Key.J: tempSign = "RF-" + realLapseTime; break; case Key.K: tempSign = "RS-" + realLapseTime; break; case Key.L: tempSign = "FA-" + realLapseTime; break; case Key.S: tempSign = "SA-" + realLapseTime; break; } listSigns.Add(tempSign); Interlocked.Increment(ref signCount); tbSignCount.Text = signCount.ToString(); tbPreRecordTime.Text = PrelapseTime.ToString(); //调试用 AddPreviewSign(e); }