public void KeyUp(string keyToRelease) { var key = KeyboardModifiers.GetVirtualKeyShort(keyToRelease); this.modifiers.Remove(keyToRelease); Keyboard.Release(key); }
private void SendKeys(IEnumerable <KeyEvent> events) { foreach (var keyEvent in events) { if (keyEvent.IsNewLine()) { Keyboard.Type(VirtualKeyShort.ENTER); } else if (keyEvent.IsModifierRelease()) { this.ReleaseModifiers(); } else if (keyEvent.IsModifier()) { this.PressOrReleaseModifier(keyEvent.GetKey()); } else if (keyEvent.IsKey()) { Keyboard.Press(KeyboardModifiers.GetVirtualKeyShort(keyEvent.GetKey())); } else { this.Type(keyEvent.GetCharacter()); } } }
public void KeyDown(string keyToPress) { var key = KeyboardModifiers.GetVirtualKeyShort(keyToPress); this.modifiers.Add(keyToPress); Keyboard.Press(key); }