private void ButtonRepeat() { while (true) { try { while (ButtonsHolding.Count == 0) { Thread.Sleep(new TimeSpan(10000)); // 100 us } int iterations = 0; while (ButtonsHolding.Count > 0) { if (iterations == 0) { Thread.Sleep(500); } if (ButtonsHolding.Contains(128)) { ButtonsHolding.Remove(128); } if (ButtonsHolding.Contains(3)) { ButtonsHolding.Remove(3); // dont repeat ENTER } lock (ButtonsHolding) { foreach (int b in ButtonsHolding) { Press(b); } } iterations++; if (iterations > 3) { Thread.Sleep(150); } else { Thread.Sleep(650); } } } catch (Exception ex) { // } } }
void g25_Release(Joystick joystick, int button) { ButtonsHolding.Remove(button); }