private void Keyboard_KeyPressed(object sender, KeyEventArgs e) { if (!WaitDescriptor.IsMatch(e)) { return; } var time = DateTime.Now; if (time.TimeOfDay - _lastPressTime.TimeOfDay > _maxKeysPressingInterval) { _currentPressCount = 0; } _lastPressTime = time; lock (s_counterSync) { _currentPressCount++; } PressedKeyArgs = e; if (_currentPressCount == PressTimes) { ThreadUtils.StartBackgroundThread(WaitForSet); } }
private void Keyboard_KeyPressed(object sender, KeyEventArgs e) { lock (_sync) { if (!WaitDescriptor.IsMatch(e)) { return; } PressedKeyArgs = e; Set(); } }