public void SendKeyboardEvents(IEnumerable <KeyboardEvent> events) { var keyboard = new InputSimulator().Keyboard; foreach (var e in events) { if (e.KeyDown) { keyboard.KeyDown(e.KeyCode); } else { keyboard.KeyUp(e.KeyCode); } if (e.Timeout > 0) { keyboard.Sleep((int)(e.Timeout * 1000)); } } }