/// <summary> /// Handler for keyboard key press event /// </summary> private void OnKeyEvent(object sender, EventSourceEventArgs <KeyboardEvent> keyboardEventArgs) { if (keyboardEventArgs.Data == null) { return; } if (!_hotkeyConditionService.ShouldHandleHotkeyEvent(keyboardEventArgs.Data)) { return; } InputResult?inputResult = null; if (keyboardEventArgs.Data.KeyDown != null) { UserInputKey mappedKey = _keyMapper.MapToUserInputKey(keyboardEventArgs.Data.KeyDown.Key); ModifierKeys modifierKeys = GetModifierKeys(); inputResult = _keyHandler.OnKeyDown(mappedKey, modifierKeys); } else if (keyboardEventArgs.Data.KeyUp != null) { UserInputKey mappedKey = _keyMapper.MapToUserInputKey(keyboardEventArgs.Data.KeyUp.Key); inputResult = _keyHandler.OnKeyUp(mappedKey); } if (inputResult.HasValue && inputResult.Value.HasFlag(InputResult.HideFromOtherApplications)) { keyboardEventArgs.Next_Hook_Enabled = false; } }
public void ProcessKeyUp(KeyCode key) { if ((GlobalHandler != null) && !GlobalHandler.OnKeyUp(key)) { return; } LinkedListNode <IKeyHandler> node = Handlers.First; while (node != null) { if (!node.Value.OnKeyUp(key)) { break; } node = node.Next; } }