Пример #1
0
 /// <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;
 }
Пример #2
0
 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();
        }
Пример #4
0
        public AppTarget(UserModel userModel)
        {
            _UserModel = userModel;

            _KeyboardSimulator = new KeyboardSimulator();
            _MouseSimulator = new MouseSimulator();
            _InputDeviceState = new WindowsInputDeviceStateAdaptor();
            _MediaPlayer = new SoundPlayer("letter.wav");
            _MediaPlayer.LoadAsync();
        }
Пример #5
0
        private bool IsKeyPressed(IInputDeviceStateAdaptor Adaptor, VirtualKeyCode keyCode)
        {
            if (Adaptor.IsKeyDown(keyCode))
            {
                while (!Adaptor.IsKeyUp(keyCode))
                {
                    Thread.Sleep(1);
                }

                return(true);
            }
            return(false);
        }
Пример #6
0
 /// <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();
 }
Пример #7
0
 /// <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();
 }
Пример #8
0
 /// <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;
 }
Пример #9
0
 /// <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;
 }
Пример #10
0
 internal LogicalKey(IInputSimulator inputSimulator, VirtualKeyCode key)
 {
     keyboard         = inputSimulator.Keyboard;
     inputDeviceState = inputSimulator.InputDeviceState;
     KeyCode          = (WindowsInput.Native.VirtualKeyCode)key;
 }