Skip to content

Commit

Permalink
키 자동반복으로 입력된건 오디오 재생 안하게
Browse files Browse the repository at this point in the history
  • Loading branch information
20chan committed Sep 15, 2020
1 parent e2743b6 commit fc475c6
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions SansTyping/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ public partial class MainWindow : Window {
private MediaPlayer[] players;
private int index;

private int lastHit;

public MainWindow() {
InitializeComponent();
Hook.KeyboardHook.KeyDown += KeyboardHook_KeyDown;
Hook.KeyboardHook.KeyUp += KeyboardHook_KeyUp;
Hook.KeyboardHook.HookStart();

players = new MediaPlayer[5];
Expand All @@ -28,10 +31,21 @@ public MainWindow() {
}

private bool KeyboardHook_KeyDown(int vkCode) {
if (lastHit == vkCode) {
return true;
}
lastHit = vkCode;
Play();
return true;
}

private bool KeyboardHook_KeyUp(int vkCode) {
if (lastHit == vkCode) {
lastHit = -1;
}
return true;
}

private void Window_MouseDown(object sender, MouseButtonEventArgs e) {
if (e.ChangedButton == MouseButton.Left) {
this.DragMove();
Expand Down

0 comments on commit fc475c6

Please sign in to comment.