using System; using System.Collections.Generic; using WindowsInput.Native; namespace WindowsInput { /// /// The service contract for a keyboard simulator for the Windows platform. /// public interface IKeyboardSimulator { /// /// Gets the instance for simulating Mouse input. /// /// The instance. IMouseSimulator Mouse { get; } /// /// Simulates the key down gesture for the specified key. /// /// The for the key. IKeyboardSimulator KeyDown(VirtualKeyCode keyCode); /// /// Simulates the key press gesture for the specified key. /// /// The for the key. IKeyboardSimulator KeyPress(VirtualKeyCode keyCode); /// /// Simulates a key press for each of the specified key codes in the order they are specified. /// /// IKeyboardSimulator KeyPress(params VirtualKeyCode[] keyCodes); /// /// Simulates the key up gesture for the specified key. /// /// The for the key. IKeyboardSimulator KeyUp(VirtualKeyCode keyCode); /// /// Simulates a modified keystroke where there are multiple modifiers and multiple keys like CTRL-ALT-K-C where CTRL and ALT are the modifierKeys and K and C are the keys. /// The flow is Modifiers KeyDown in order, Keys Press in order, Modifiers KeyUp in reverse order. /// /// The list of s for the modifier keys. /// The list of s for the keys to simulate. IKeyboardSimulator ModifiedKeyStroke(IEnumerable modifierKeyCodes, IEnumerable keyCodes); /// /// Simulates a modified keystroke where there are multiple modifiers and one key like CTRL-ALT-C where CTRL and ALT are the modifierKeys and C is the key. /// The flow is Modifiers KeyDown in order, Key Press, Modifiers KeyUp in reverse order. /// /// The list of s for the modifier keys. /// The for the key. IKeyboardSimulator ModifiedKeyStroke(IEnumerable modifierKeyCodes, VirtualKeyCode keyCode); /// /// Simulates a modified keystroke where there is one modifier and multiple keys like CTRL-K-C where CTRL is the modifierKey and K and C are the keys. /// The flow is Modifier KeyDown, Keys Press in order, Modifier KeyUp. /// /// The for the modifier key. /// The list of s for the keys to simulate. IKeyboardSimulator ModifiedKeyStroke(VirtualKeyCode modifierKey, IEnumerable keyCodes); /// /// Simulates a simple modified keystroke like CTRL-C where CTRL is the modifierKey and C is the key. /// The flow is Modifier KeyDown, Key Press, Modifier KeyUp. /// /// The for the modifier key. /// The for the key. IKeyboardSimulator ModifiedKeyStroke(VirtualKeyCode modifierKeyCode, VirtualKeyCode keyCode); /// /// Simulates uninterrupted text entry via the keyboard. /// /// The text to be simulated. IKeyboardSimulator TextEntry(string text); /// /// Simulates a single character text entry via the keyboard. /// /// The unicode character to be simulated. IKeyboardSimulator TextEntry(char character); /// /// Sleeps the executing thread to create a pause between simulated inputs. /// /// The number of milliseconds to wait. IKeyboardSimulator Sleep(int millsecondsTimeout); /// /// Sleeps the executing thread to create a pause between simulated inputs. /// /// The time to wait. IKeyboardSimulator Sleep(TimeSpan timeout); } }