コード例 #1
0
        /// <inheritdoc />
        /// <summary>
        /// Simulates a key press for each of the specified key codes in the order they are specified.
        /// </summary>
        /// <param name="keyCodes"></param>
        public IKeyboardSimulator KeyPress(params VirtualKeyCode[] keyCodes)
        {
            var builder = new InputBuilder();

            this.KeysPress(builder, keyCodes);
            this.SendSimulatedInput(builder.ToArray());
            return(this);
        }
コード例 #2
0
        /// <inheritdoc />
        /// <summary>
        /// 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.
        /// </summary>
        /// <param name="modifierKeyCodes">The list of modifier keys</param>
        /// <param name="keyCodes">The list of keys to simulate</param>
        public IKeyboardSimulator ModifiedKeyStroke(IEnumerable <VirtualKeyCode> modifierKeyCodes, IEnumerable <VirtualKeyCode> keyCodes)
        {
            var builder = new InputBuilder();

            this.ModifiersDown(builder, modifierKeyCodes);
            this.KeysPress(builder, keyCodes);
            this.ModifiersUp(builder, modifierKeyCodes);

            this.SendSimulatedInput(builder.ToArray());
            return(this);
        }