Пример #1
0
 public IMouseSimulator MoveMouseToPositionOnVirtualDesktop(double absoluteX, double absoluteY){
     Win32Types.INPUT[] inputList =
         new InputBuilder().AddAbsoluteMouseMovementOnVirtualDesktop((int) Math.Truncate(absoluteX),
             (int) Math.Truncate(absoluteY)).ToArray();
     SendSimulatedInput(inputList);
     return this;
 }
Пример #2
0
        private static void ModifiersUp(InputBuilder builder, IEnumerable<VirtualKeyCode> modifierKeyCodes) {
            if (modifierKeyCodes == null) return;

            var stack = new Stack<VirtualKeyCode>(modifierKeyCodes);
            while (stack.Count > 0) {
                builder.AddKeyUp(stack.Pop());
            }
        }
Пример #3
0
 public void Should_be_able_to_Generate_Text_With_the_type_Text_box()
 {
     ITextBoxBuilder textbox = new InputBuilder("Name", HTMLATTRIBUTE.TEXT).Value("Satish");
     string htmlTextBox = textbox.ToString();
     var cq = CQ.Create(htmlTextBox);
     cq.Attr("name").Should().Be("Name");
     cq.Val().Should().Be("Satish");
 }
Пример #4
0
 public void Should_be_able_to_Generate_the_TextBox_with_the_PlaceHolder()
 {
     ITextBoxBuilder textbox = new InputBuilder("Name", HTMLATTRIBUTE.TEXT).WithPlaceholder("SomeText");
     string htmlTextBox = textbox.ToString();
     var cq = CQ.Create(htmlTextBox);
     cq.Attr("name").Should().Be("Name");
     cq.Attr("placeholder").Should().Be("SomeText");
 }
Пример #5
0
        private void ModifiersUp(InputBuilder builder, IEnumerable<VirtualKeyCode> modifierKeyCodes)
        {
            if (modifierKeyCodes == null) return;

            // Key up in reverse (I miss LINQ)
            var stack = new Stack<VirtualKeyCode>(modifierKeyCodes);
            while (stack.Count > 0) builder.AddKeyUp(stack.Pop());
        }
Пример #6
0
 public void Should_be_able_to_Generate_the_Password_Box()
 {
     IInputElementBuilder textbox = new InputBuilder("Name", HTMLATTRIBUTE.PASSWORD).Value("Satish");
     string htmlTextBox = textbox.ToString();
     var cq = CQ.Create(htmlTextBox);
     cq.Attr(HTMLATTRIBUTE.TYPE).Should().Be(HTMLATTRIBUTE.PASSWORD);
     cq.Val().Should().Be("Satish");
 }
Пример #7
0
 public void AddKeyDown()
 {
     var builder = new InputBuilder();
     Assert.That(builder.ToArray(), Is.Empty);
     builder.AddKeyDown(VirtualKeyCode.VK_A);
     Assert.That(builder.Count(), Is.EqualTo(1));
     Assert.That(builder[0].Type, Is.EqualTo((uint)InputType.Keyboard));
     Assert.That(builder[0].Data.Keyboard.KeyCode, Is.EqualTo((ushort)VirtualKeyCode.VK_A));
 }
Пример #8
0
 public void AddKeyDown()
 {
     var builder = new InputBuilder();
     Assert.IsFalse(builder.ToArray().Any());
     builder.AddKeyDown(VirtualKeyCode.VK_A);
     Assert.AreEqual(builder.Count(), 1);
     Assert.AreEqual(builder[0].Type,(uint)InputType.Keyboard);
     Assert.AreEqual(builder[0].Data.Keyboard.KeyCode, (ushort)VirtualKeyCode.VK_A);
 }
Пример #9
0
 public static CommandInput Generate(string messages)
 {
     return(new CommandInput()
     {
         Command = CommandTypes.Help,
         CommandName = CommandNames.Help,
         Inputs = InputBuilder.ToInputs(messages),
     });
 }
Пример #10
0
 public void Should_be_able_to_add_Id_to_the_property_With_the_Generic_Name()
 {
     IInputElementBuilder textbox = new InputBuilder("Name", HTMLATTRIBUTE.PASSWORD)
         .Class("cssclass");
     string htmlTextBox = textbox.ToString();
     var cq = CQ.Create(htmlTextBox);
     cq.Attr(HTMLATTRIBUTE.TYPE).Should().Be(HTMLATTRIBUTE.PASSWORD);
     cq.Attr(HTMLATTRIBUTE.CLASS).Should().Be("cssclass");
 }
Пример #11
0
        public void AddKeyDown()
        {
            var builder = new InputBuilder();

            Assert.That(builder.ToArray(), Is.Empty);
            builder.AddKeyDown(VirtualKeyCode.VK_A);
            Assert.That(builder.Count(), Is.EqualTo(1));
            Assert.That(builder[0].Type, Is.EqualTo((uint)InputType.Keyboard));
            Assert.That(builder[0].Data.Keyboard.KeyCode, Is.EqualTo((ushort)VirtualKeyCode.VK_A));
        }
Пример #12
0
        /// <summary>
        /// Calls the Win32 SendInput method with a KeyDown and KeyUp message in the same input sequence in order to simulate a Key PRESS.
        /// </summary>
        /// <param name="keyCode">The <see cref="VirtualKeyCode"/> to press</param>
        public void KeyPress(VirtualKeyCode keyCode)
        {
            var inputList =
                new InputBuilder()
                    .AddKeyDown(keyCode)
                    .AddKeyUp(keyCode)
                    .ToArray();

            SendSimulatedInput(inputList);
        }
Пример #13
0
        public ActionResult MainInfo(FormCollection forms)
        {
            var model = InputBuilder.BuildInputByRequest <PymeInfoInput>(Request);

            if (Request.Files.Count > 0)
            {
                model.Image = Request.Files[0];
            }
            return(Json(_pymeAdminService.AddInfo(model), JsonRequestBehavior.AllowGet));
        }
Пример #14
0
 public void Should_be_able_to_Generate_the_Text_With_Disabled_and_ReadOnly_TextBox()
 {
     ITextBoxBuilder textbox = new InputBuilder("Name", HTMLATTRIBUTE.TEXT).Value("Satish").Disabled(true).IsReadOnly(true);
     string htmlTextBox = textbox.ToString();
     var cq = CQ.Create(htmlTextBox);
     cq.Attr("name").Should().Be("Name");
     cq.Attr("disabled").Should().Be("disabled");
     cq.Attr("readonly").Should().Be("readonly");
     cq.Val().Should().Be("Satish");
 }
Пример #15
0
        public IKeyboardInput ModifiedKeyStroke(IEnumerable <KeyCode> modifierKeyCodes, IEnumerable <KeyCode> keyCodes)
        {
            var builder = new InputBuilder();

            KeyDown(builder, modifierKeyCodes);
            KeyPress(builder, keyCodes);
            KeyUp(builder, modifierKeyCodes);
            NativeHelper.SendInput((uint)builder.Count(), builder.ToArray(), Marshal.SizeOf(typeof(Input)));
            return(this);
        }
Пример #16
0
 public IKeyboardSimulator TextEntry(string text)
 {
     if (text.Length > UInt32.MaxValue / 2)
     {
         throw new ArgumentException(
                   $"The text parameter is too long. It must be less than {UInt32.MaxValue / 2} characters.", nameof(text));
     }
     Win32Types.INPUT[] inputList = new InputBuilder().AddCharacters(text).ToArray();
     SendSimulatedInput(inputList);
     return(this);
 }
Пример #17
0
 /// <summary>
 /// 初始化输入控件生成器
 /// </summary>
 private void InitInputBuilder(FormFieldBuilder formFieldBuilder, InputBuilder inputBuilder)
 {
     inputBuilder.SetText();
     inputBuilder.AddOtherAttributes(_config);
     inputBuilder.Id(_config);
     inputBuilder.AddAttribute(UiConst.Name, _config.GetValue(UiConst.Name));
     inputBuilder.AddAttribute("placeholder", _config.GetValue(UiConst.Placeholder));
     inputBuilder.AddAttribute("type", _config.Type);
     inputBuilder.AddAttribute("[(ngModel)]", _config.GetValue(UiConst.Model));
     AddValidations(formFieldBuilder, inputBuilder);
 }
Пример #18
0
        /// <summary>
        /// 添加错误消息
        /// </summary>
        private void AddError(FormFieldBuilder formFieldBuilder, InputBuilder inputBuilder, string type, string message)
        {
            if (string.IsNullOrWhiteSpace(message))
            {
                return;
            }
            var id = $"m_{Id.Guid()}";

            inputBuilder.AddAttribute($"#{id}", "ngModel");
            formFieldBuilder.AppendChild(new ErrorBuilder(id, type, message));
        }
Пример #19
0
        /// <summary>
        /// Calls the Win32 SendInput method with a stream of KeyDown and KeyUp messages in order to simulate uninterrupted text entry via the keyboard.
        /// </summary>
        /// <param name="text">The text to be simulated.</param>
        public IKeyboardSimulator TextEntry(string text)
        {
            if (text.Length > UInt32.MaxValue / 2)
            {
                throw new ArgumentException(string.Format("The text parameter is too long. It must be less than {0} characters.", UInt32.MaxValue / 2), "text");
            }
            var inputList = new InputBuilder().AddCharacters(text).ToArray();

            SendSimulatedInput(inputList);
            return(this);
        }
Пример #20
0
 private void ModifiersDown(InputBuilder builder, IEnumerable <VirtualKeyCode> modifierKeyCodes)
 {
     if (modifierKeyCodes == null)
     {
         return;
     }
     foreach (var key in modifierKeyCodes)
     {
         builder.AddKeyDown(key);
     }
 }
Пример #21
0
        public override void BuildInput(InputBuilder input)
        {
            if (!shouldPlayerMove(this.Pawn))
            {
                input.InputDirection = Vector3.Zero;
                input.ClearButton(InputButton.Jump);
                input.ClearButton(InputButton.Duck);
            }

            base.BuildInput(input);
        }
Пример #22
0
        /// <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();

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

            SendSimulatedInput(builder.ToArray());
            return(this);
        }
Пример #23
0
 private void ModifiersDown(InputBuilder builder, IEnumerable <Win32Constants.VirtualKeys> modifierKeyCodes)
 {
     if (modifierKeyCodes == null)
     {
         return;
     }
     foreach (Win32Constants.VirtualKeys key in modifierKeyCodes)
     {
         builder.AddKeyDown(key);
     }
 }
Пример #24
0
        public IKeyboardSimulator ModifiedKeyStroke(
            IEnumerable<Win32Constants.VirtualKeys> modifierKeyCodes, IEnumerable<Win32Constants.VirtualKeys> keyCodes){
            var builder = new InputBuilder();
            Win32Constants.VirtualKeys[] virtualKeyss = modifierKeyCodes.ToArray();
            ModifiersDown(builder, virtualKeyss);
            KeysPress(builder, keyCodes);
            ModifiersUp(builder, virtualKeyss);

            SendSimulatedInput(builder.ToArray());
            return this;
        }
Пример #25
0
 private void KeysPress(InputBuilder builder, IEnumerable <Win32Constants.VirtualKeys> keyCodes)
 {
     if (keyCodes == null)
     {
         return;
     }
     foreach (Win32Constants.VirtualKeys key in keyCodes)
     {
         builder.AddKeyPress(key);
     }
 }
Пример #26
0
 private void KeysPress(InputBuilder builder, IEnumerable <VirtualKeyCode> keyCodes)
 {
     if (keyCodes == null)
     {
         return;
     }
     foreach (var key in keyCodes)
     {
         builder.AddKeyPress(key);
     }
 }
Пример #27
0
 public IKeyboardInput KeyDown(InputBuilder builder, IEnumerable <KeyCode> keyCodes)
 {
     if (keyCodes == null)
     {
         return(this);
     }
     foreach (var key in keyCodes)
     {
         builder.AddKeyDown(key);
     }
     return(this);
 }
        public void Configure()
        {
            InputBuilder.BootStrap();
            InputBuilder.SetPropertyConvention(() => new InputBuilderPropertyFactory());
            ControllerBuilder.Current.SetControllerFactory(new ControllerFactory());
            ModelBinders.Binders.DefaultBinder = GetDefault();

            Bus.AddMessageHandler(typeof(LoginHandler));
            Bus.Instance.SetMessageHandlerFactory(new ConventionMessageHandlerFactory());

            new RouteConfigurator().RegisterRoutes(AreaRegistration.RegisterAllAreas);
        }
Пример #29
0
        private void KeyUp(InputBuilder builder, IEnumerable <KeyCode> keyCodes)
        {
            if (keyCodes == null)
            {
                return;
            }

            foreach (var key in keyCodes)
            {
                builder.AddKeyUp(key);
            }
        }
Пример #30
0
        private int GetKeyboardNumberPressed(InputBuilder input)
        {
            for (int i = 0; i < _slotInputButtons.Length; i++)
            {
                if (input.Pressed(_slotInputButtons[i]))
                {
                    return(i);
                }
            }

            return(-1);
        }
Пример #31
0
        public async Task PrepareInputFilesTest()
        {
            List <string> files     = Directory.EnumerateFiles(Resources.Images).ToList();
            InputBuilder  builder   = new InputBuilder();
            string        directory = string.Empty;

            Func <string, string> inputBuilder  = builder.PrepareInputFiles(files, out directory);
            List <string>         preparedFiles = Directory.EnumerateFiles(directory).ToList();

            Assert.Equal(12, builder.FileList.Count);
            Assert.Equal(builder.FileList.Count, preparedFiles.Count);
        }
        private WeightedSelector <string> BuildSelector()
        {
            var Selector = new WeightedSelector <string>(new SelectorOptions()
            {
                AllowDuplicates = false
            });
            var Inputs = InputBuilder.CreateInputs(MinInputs, MaxInputs, MinWeight, MaxWeight);

            Selector.Add(Inputs);

            return(Selector);
        }
Пример #33
0
        public RenderFragment Render
        (
            StructureInstance <TStructure> structure, TStructure value, MemberInstance <TStructure, TMember> member
        ) => builder =>
        {
            int seq = -1;

            builder.OpenElement(++seq, "div");

            //

            var classes = new ClassSet(
                "Integrant.Element.Override.Input",
                "Integrant.Rudiment.Input." + nameof(NumberInput <TStructure, TMember>)
                );

            bool required = InputBuilder.Required(value, member.Member, classes);
            bool disabled = InputBuilder.Disabled(value, member.Member, classes);

            builder.AddAttribute(++seq, "class", classes.ToString());

            //

            InputBuilder.OpenInnerInput
            (
                builder, ref seq,
                value, member.Member,
                "input", "number",
                "value", member.Member.InputValue.Invoke(value, member.Member),
                required, disabled,
                args => OnChange(value, member.Member, args)
            );

            if (_min != null)
            {
                builder.AddAttribute(++seq, "min", _min.Value);
            }

            if (_max != null)
            {
                builder.AddAttribute(++seq, "max", _max.Value);
            }

            if (_step != null)
            {
                builder.AddAttribute(++seq, "step", _step.Value);
            }

            InputBuilder.CloseInnerInput(builder);

            builder.CloseElement();
        };
Пример #34
0
        private void ModifiersUp(InputBuilder builder, IEnumerable <VirtualKeyCode> modifierKeyCodes)
        {
            if (modifierKeyCodes == null)
            {
                return;
            }
            var stack = new Stack <VirtualKeyCode>(modifierKeyCodes);

            while (stack.Count > 0)
            {
                builder.AddKeyUp(stack.Pop());
            }
        }
        public void GivenNotNullTitle_InvokeOutputHandler()
        {
            var          gateway       = new Mock <ITodoItemGateway> ();
            var          outputHandler = new Mock <IUseCaseOutputHandler <Output> > ();
            InputBuilder builder       = new InputBuilder();

            builder.WithTitle("My Title");
            IUseCase <Input> addTodoItem = new Interactor(outputHandler.Object, gateway.Object);

            addTodoItem.Execute(builder.Build());

            outputHandler.Verify(e => e.Handle(It.IsAny <Output> ()), Times.Once);
        }
Пример #36
0
        protected void Application_Start()
        {
            //wire up a sample observer
            Bus.AddMessageHandler(typeof(LogAllMessagesObserver));
            //wire up a handler that validates a login for the Login Area.
            Bus.AddMessageHandler(typeof(LoginHandler));

            //Default MVC2 registration syntax
            AreaRegistration.RegisterAllAreas();

            RegisterRoutes(RouteTable.Routes);
            InputBuilder.BootStrap();
        }
Пример #37
0
 public void Should_be_able_to_Generate_the_Text_With_AutoComplete_and_AutoFoucs_TextBox()
 {
     ITextBoxBuilder textbox = new InputBuilder("Name", HTMLATTRIBUTE.TEXT)
         .Value("Satish")
         .EnableAutoComplete(true)
         .AutoFocus(true);
     string htmlTextBox = textbox.ToString();
     var cq = CQ.Create(htmlTextBox);
     cq.Attr("name").Should().Be("Name");
     cq.Attr("AutoFocus").Should().Be("autofocus");
     cq.Attr("autocomplete").Should().Be("on");
     cq.Val().Should().Be("Satish");
 }
Пример #38
0
        public IKeyboardSimulator ModifiedKeyStroke(
            IEnumerable <Win32Constants.VirtualKeys> modifierKeyCodes, IEnumerable <Win32Constants.VirtualKeys> keyCodes)
        {
            var builder = new InputBuilder();

            Win32Constants.VirtualKeys[] virtualKeyss = modifierKeyCodes.ToArray();
            ModifiersDown(builder, virtualKeyss);
            KeysPress(builder, keyCodes);
            ModifiersUp(builder, virtualKeyss);

            SendSimulatedInput(builder.ToArray());
            return(this);
        }
Пример #39
0
        public async Task <ActionResult> AddEditContent()
        {
            var model = InputBuilder.BuildInputByRequest <ContentInput>(Request);

            if (Request.Files.Count <= 0)
            {
                throw new UserFriendlyException("No hay imagen");
            }
            model.File = Request.Files[0];
            var id = await _mainContentAdminService.AddEditContentWithFile(model);

            return(Json(id, JsonRequestBehavior.AllowGet));
        }
Пример #40
0
 /// <summary>
 /// 初始化输入控件生成器
 /// </summary>
 private void InitInputBuilder(FormFieldBuilder formFieldBuilder, InputBuilder inputBuilder, TextBoxConfig config)
 {
     inputBuilder.SetText();
     foreach (var attribute in config.GetAttributes())
     {
         inputBuilder.Attribute(attribute.Key, attribute.Value);
     }
     inputBuilder.AddAttribute("name", config.Name);
     inputBuilder.AddAttribute("placeholder", config.Placeholder);
     inputBuilder.AddAttribute("value", config.Value);
     inputBuilder.AddAttribute("type", config.Type);
     inputBuilder.AddAttribute("[(ngModel)]", config.Model);
     AddValidations(formFieldBuilder, inputBuilder, config);
 }
Пример #41
0
        public override void BuildInput(InputBuilder input)
        {
            base.BuildInput(input);

            if (input.Down(InputButton.Alt1))
            {
                input.ViewAngles = input.ViewAngles.WithYaw(input.ViewAngles.yaw + YawSpeed * Time.Delta);
            }

            if (input.Down(InputButton.Alt2))
            {
                input.ViewAngles = input.ViewAngles.WithYaw(input.ViewAngles.yaw - YawSpeed * Time.Delta);
            }
        }
Пример #42
0
        public override void BuildInput(InputBuilder input)
        {
            var roundMgr = RoundManager.Get();

            if (roundMgr != null && !roundMgr.CanPawnMove(this.Pawn as Pawn))
            {
                input.Clear();
                input.ClearButtons();
            }
            else
            {
                base.BuildInput(input);
            }
        }
Пример #43
0
        public override void BuildInput(InputBuilder builder)
        {
            Host.AssertClient();
            var player = Local.Pawn as TankPlayer;

            builder.InputDirection = builder.AnalogMove;
            if (builder.UsingMouse)
            {
                builder.AnalogLook.pitch *= 1.5f;
            }

            player.CameraOrbitAngle      += builder.AnalogLook;
            player.CameraOrbitAngle.pitch = player.CameraOrbitAngle.pitch.Clamp(0, 89);
            builder.ViewAngles            = player.CameraOrbitAngle;
        }
Пример #44
0
 /// <summary>
 /// Simulates mouse movement to the specified location on the primary display device.
 /// </summary>
 /// <param name="absoluteX">The destination's absolute X-coordinate on the primary display device where 0 is the extreme left hand side of the display device and 65535 is the extreme right hand side of the display device.</param>
 /// <param name="absoluteY">The destination's absolute Y-coordinate on the primary display device where 0 is the top of the display device and 65535 is the bottom of the display device.</param>
 public void MoveMouseTo(double absoluteX, double absoluteY)
 {
     var inputList = new InputBuilder().AddAbsoluteMouseMovement((int)absoluteX, (int)absoluteY).ToArray();
     SendSimulatedInput(inputList);
 }
Пример #45
0
        /// <summary>
        /// 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.
        /// </summary>
        /// <param name="modifierKeyCodes">The list of modifier keys</param>
        /// <param name="keyCode">The key to simulate</param>
        public void ModifiedKeyStroke(IEnumerable<VirtualKeyCode> modifierKeyCodes, VirtualKeyCode keyCode)
        {
            var builder = new InputBuilder();
            var modifierKeyCodesList = modifierKeyCodes.ToList();
            if (modifierKeyCodes != null) modifierKeyCodesList.ForEach(x => builder.AddKeyDown(x));
            builder.AddKeyPress(keyCode);
            if (modifierKeyCodes != null)
            {
                modifierKeyCodesList.Reverse();
                modifierKeyCodesList.ForEach(x => builder.AddKeyUp(x));
            }

            SendSimulatedInput(builder.ToArray());
        }
Пример #46
0
        /// <summary>
        /// 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.
        /// </summary>
        /// <param name="modifierKeyCode">The modifier key</param>
        /// <param name="keyCode">The key to simulate</param>
        public void ModifiedKeyStroke(VirtualKeyCode modifierKeyCode, VirtualKeyCode keyCode)
        {
            var inputList =
                new InputBuilder()
                    .AddKeyDown(modifierKeyCode)
                    .AddKeyPress(keyCode)
                    .AddKeyUp(modifierKeyCode)
                    .ToArray();

            SendSimulatedInput(inputList);
        }
Пример #47
0
 /// <summary>
 /// Simulates a mouse left button up gesture.
 /// </summary>
 public IMouseSimulator LeftButtonUp()
 {
     var inputList = new InputBuilder().AddMouseButtonUp(MouseButton.LeftButton).ToArray();
     SendSimulatedInput(inputList);
     return this;
 }
Пример #48
0
 /// <summary>
 /// Calls the Win32 SendInput method with a stream of KeyDown and KeyUp messages in order to simulate uninterrupted text entry via the keyboard.
 /// </summary>
 /// <param name="text">The text to be simulated.</param>
 public void TextEntry(string text)
 {
     if (text.Length > UInt32.MaxValue / 2) throw new ArgumentException(string.Format("The text parameter is too long. It must be less than {0} characters.", UInt32.MaxValue / 2), "text");
     var inputList = new InputBuilder().AddCharacters(text).ToArray();
     SendSimulatedInput(inputList);
 }
Пример #49
0
 /// <summary>
 /// Simulates a mouse X button double-click gesture.
 /// </summary>
 /// <param name="buttonId">The button id.</param>
 public IMouseSimulator XButtonDoubleClick(int buttonId)
 {
     var inputList = new InputBuilder().AddMouseXButtonDoubleClick(buttonId).ToArray();
     SendSimulatedInput(inputList);
     return this;
 }
Пример #50
0
 /// <summary>
 /// Simulates a mouse left button up gesture.
 /// </summary>
 public void LeftButtonUp()
 {
     var inputList = new InputBuilder().AddMouseButtonUp(MouseButton.LeftButton).ToArray();
     SendSimulatedInput(inputList);
 }
Пример #51
0
 /// <summary>
 /// Simulates mouse vertical wheel scroll gesture.
 /// </summary>
 /// <param name="scrollAmountInClicks">The amount to scroll in clicks. A positive value indicates that the wheel was rotated forward, away from the user; a negative value indicates that the wheel was rotated backward, toward the user.</param>
 public IMouseSimulator VerticalScroll(int scrollAmountInClicks)
 {
     var inputList = new InputBuilder().AddMouseVerticalWheelScroll(scrollAmountInClicks * MouseWheelClickSize).ToArray();
     SendSimulatedInput(inputList);
     return this;
 }
Пример #52
0
 /// <summary>
 /// Simulates a mouse X button up gesture.
 /// </summary>
 /// <param name="buttonId">The button id.</param>
 public void XButtonUp(int buttonId)
 {
     var inputList = new InputBuilder().AddMouseXButtonUp(buttonId).ToArray();
     SendSimulatedInput(inputList);
 }
Пример #53
0
 /// <summary>
 /// Simulates a mouse horizontal wheel scroll gesture. Supported by Windows Vista and later.
 /// </summary>
 /// <param name="scrollAmountInClicks">The amount to scroll in clicks. A positive value indicates that the wheel was rotated to the right; a negative value indicates that the wheel was rotated to the left.</param>
 public void HorizontalScroll(int scrollAmountInClicks)
 {
     var inputList = new InputBuilder().AddMouseHorizontalWheelScroll(scrollAmountInClicks * MouseWheelClickSize).ToArray();
     SendSimulatedInput(inputList);
 }
Пример #54
0
 /// <summary>
 /// Simulates a mouse right button down gesture.
 /// </summary>
 public void RightButtonDown()
 {
     var inputList = new InputBuilder().AddMouseButtonDown(MouseButton.RightButton).ToArray();
     SendSimulatedInput(inputList);
 }
Пример #55
0
 /// <summary>
 /// Simulates mouse movement to the specified location on the Virtual Desktop which includes all active displays.
 /// </summary>
 /// <param name="absoluteX">The destination's absolute X-coordinate on the virtual desktop where 0 is the left hand side of the virtual desktop and 65535 is the extreme right hand side of the virtual desktop.</param>
 /// <param name="absoluteY">The destination's absolute Y-coordinate on the virtual desktop where 0 is the top of the virtual desktop and 65535 is the bottom of the virtual desktop.</param>
 public void MoveMouseToPositionOnVirtualDesktop(double absoluteX, double absoluteY)
 {
     var inputList = new InputBuilder().AddAbsoluteMouseMovementOnVirtualDesktop((int)Math.Truncate(absoluteX), (int)Math.Truncate(absoluteY)).ToArray();
     SendSimulatedInput(inputList);
 }
Пример #56
0
 /// <summary>
 /// Simulates mouse movement by the specified distance measured as a delta from the current mouse location in pixels.
 /// </summary>
 /// <param name="pixelDeltaX">The distance in pixels to move the mouse horizontally.</param>
 /// <param name="pixelDeltaY">The distance in pixels to move the mouse vertically.</param>
 public void MoveMouseBy(int pixelDeltaX, int pixelDeltaY)
 {
     var inputList = new InputBuilder().AddRelativeMouseMovement(pixelDeltaX, pixelDeltaY).ToArray();
     SendSimulatedInput(inputList);
 }
Пример #57
0
 /// <summary>
 /// X button state
 /// </summary>
 /// <param name="btn">id</param>
 /// <param name="isDown">down or up</param>
 public IMouseSimulator XButtonState(MouseButton btn, bool isDown)
 {
     INPUT[] inputList = null;
     if (isDown)
     {
         inputList = new InputBuilder().AddMouseButtonDown(btn).ToArray();
     }
     else
     {
         inputList = new InputBuilder().AddMouseButtonUp(btn).ToArray();
     }
     SendSimulatedInput(inputList);
     return this;
 }
Пример #58
0
        /// <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 void ModifiedKeyStroke(IEnumerable<VirtualKeyCode> modifierKeyCodes, IEnumerable<VirtualKeyCode> keyCodes)
        {
            var builder = new InputBuilder();
            if (modifierKeyCodes != null) modifierKeyCodes.ToList().ForEach(x => builder.AddKeyUp(x));
            if (keyCodes != null) keyCodes.ToList().ForEach(x => builder.AddKeyPress(x));
            if (modifierKeyCodes != null) modifierKeyCodes.Reverse().ToList().ForEach(x => builder.AddKeyUp(x));

            SendSimulatedInput(builder.ToArray());
        }
Пример #59
0
 /// <summary>
 /// Simulates a mouse right button double-click gesture.
 /// </summary>
 public IMouseSimulator RightButtonDoubleClick()
 {
     var inputList = new InputBuilder().AddMouseButtonDoubleClick(MouseButton.RightButton).ToArray();
     SendSimulatedInput(inputList);
     return this;
 }
Пример #60
0
 /// <summary>
 /// Simulates mouse movement to the specified location on the primary display device.
 /// </summary>
 /// <param name="absoluteX">The destination's absolute X-coordinate on the primary display device where 0 is the extreme left hand side of the display device and 65535 is the extreme right hand side of the display device.</param>
 /// <param name="absoluteY">The destination's absolute Y-coordinate on the primary display device where 0 is the top of the display device and 65535 is the bottom of the display device.</param>
 public IMouseSimulator MoveMouseTo(double absoluteX, double absoluteY)
 {
     var inputList = new InputBuilder().AddAbsoluteMouseMovement((int)Math.Truncate(absoluteX), (int)Math.Truncate(absoluteY)).ToArray();
     SendSimulatedInput(inputList);
     return this;
 }