/// <summary> /// Initializes a new instance of the <see cref="InputSimulator" /> class using the specified /// <see cref="IKeyboardSimulator" />, <see cref="IMouseSimulator" /> and <see cref="IInputDeviceStateAdaptor" /> /// instances. /// </summary> /// <param name="keyboardSimulator">The <see cref="IKeyboardSimulator" /> instance to use for simulating keyboard input.</param> /// <param name="mouseSimulator">The <see cref="IMouseSimulator" /> instance to use for simulating mouse input.</param> /// <param name="inputDeviceStateAdaptor"> /// The <see cref="IInputDeviceStateAdaptor" /> instance to use for interpreting the /// state of input devices. /// </param> public InputSimulator(IKeyboardSimulator keyboardSimulator, IMouseSimulator mouseSimulator, IInputDeviceStateAdaptor inputDeviceStateAdaptor) { _keyboardSimulator = keyboardSimulator; _mouseSimulator = mouseSimulator; _inputDeviceState = inputDeviceStateAdaptor; }
public InputSimulator(IKeyboardSimulator keyboardSimulator, IMouseSimulator mouseSimulator, IInputDeviceStateAdaptor inputDeviceStateAdaptor) { Keyboard = keyboardSimulator; Mouse = mouseSimulator; InputDeviceState = inputDeviceStateAdaptor; }
public DummyInputSimulator() { Keyboard = new DummyKeyboardSimulator(this); Mouse = new DummyMouseSimulator(this); // No reason this can't be the real thing InputDeviceState = new WindowsInputDeviceStateAdaptor(); }
public AppTarget(UserModel userModel) { _UserModel = userModel; _KeyboardSimulator = new KeyboardSimulator(); _MouseSimulator = new MouseSimulator(); _InputDeviceState = new WindowsInputDeviceStateAdaptor(); _MediaPlayer = new SoundPlayer("letter.wav"); _MediaPlayer.LoadAsync(); }
private bool IsKeyPressed(IInputDeviceStateAdaptor Adaptor, VirtualKeyCode keyCode) { if (Adaptor.IsKeyDown(keyCode)) { while (!Adaptor.IsKeyUp(keyCode)) { Thread.Sleep(1); } return(true); } return(false); }
/// <summary> /// Initializes a new instance of the <see cref="InputSimulator"/> class using the default <see cref="KeyboardSimulator"/>, <see cref="MouseSimulator"/> and <see cref="WindowsInputDeviceStateAdaptor"/> instances. /// </summary> public InputSimulator() { _keyboardSimulator = new KeyboardSimulator(this); _mouseSimulator = new MouseSimulator(this); _inputDeviceState = new WindowsInputDeviceStateAdaptor(); }
/// <summary> /// Initializes a new instance of the <see cref="InputSimulator"/> class using the default <see cref="KeyboardSimulator"/>, <see cref="MouseSimulator"/> and <see cref="WindowsInputDeviceStateAdaptor"/> instances. /// </summary> public InputSimulator() { _keyboardSimulator = new KeyboardSimulator(); _mouseSimulator = new MouseSimulator(); _inputDeviceState = new WindowsInputDeviceStateAdaptor(); }
/// <summary> /// Initializes a new instance of the <see cref="InputSimulator"/> class using the specified <see cref="IKeyboardSimulator"/>, <see cref="IMouseSimulator"/> and <see cref="IInputDeviceStateAdaptor"/> instances. /// </summary> /// <param name="keyboardSimulator">The <see cref="IKeyboardSimulator"/> instance to use for simulating keyboard input.</param> /// <param name="mouseSimulator">The <see cref="IMouseSimulator"/> instance to use for simulating mouse input.</param> /// <param name="inputDeviceStateAdaptor">The <see cref="IInputDeviceStateAdaptor"/> instance to use for interpreting the state of input devices.</param> public InputSimulator(IKeyboardSimulator keyboardSimulator, IMouseSimulator mouseSimulator, IInputDeviceStateAdaptor inputDeviceStateAdaptor) { _keyboardSimulator = keyboardSimulator; _mouseSimulator = mouseSimulator; _inputDeviceState = inputDeviceStateAdaptor; }
/// <summary> /// Initializes a new instance of the <see cref="InputSimulator"/> class using the specified <see cref="IKeyboardSimulator"/>, <see cref="IMouseSimulator"/> and <see cref="IInputDeviceStateAdaptor"/> instances. /// </summary> /// <param name="keyboardSimulator">The <see cref="IKeyboardSimulator"/> instance to use for simulating keyboard input.</param> /// <param name="mouseSimulator">The <see cref="IMouseSimulator"/> instance to use for simulating mouse input.</param> /// <param name="inputDeviceStateAdaptor">The <see cref="IInputDeviceStateAdaptor"/> instance to use for interpreting the state of input devices.</param> public InputSimulator(IKeyboardSimulator keyboardSimulator, IMouseSimulator mouseSimulator, IInputDeviceStateAdaptor inputDeviceStateAdaptor) { Keyboard = keyboardSimulator; Mouse = mouseSimulator; InputDeviceState = inputDeviceStateAdaptor; }
internal LogicalKey(IInputSimulator inputSimulator, VirtualKeyCode key) { keyboard = inputSimulator.Keyboard; inputDeviceState = inputSimulator.InputDeviceState; KeyCode = (WindowsInput.Native.VirtualKeyCode)key; }