Exemple #1
0
        public static void SendMouse(MouseEventType type, Point2d?location = null)
        {
#if WINDOWS_OS
            WindowInput[] inputs = new WindowInput[]
            {
                new WindowInput()
                {
                    type = (int)WindowInputType.Mouse,
                    u    = new WindowInputMessage()
                    {
                        mi = new WindowMouseInput()
                        {
                            dwFlags     = (uint)type.ToWindowsMouseEvent(),
                            dwExtraInfo = GetMessageExtraInfo()
                        }
                    }
                }
            };
            if (location != null)
            {
                SetCursorPosition(location.Value);
            }
            SendInput(1, inputs, Marshal.SizeOf <WindowInput>());
#endif
        }
 public override void Update(float dt)
 {
     if (CurrentScene != null)
     {
         CurrentScene.Update(dt);
     }
     WindowInput.Update();
 }
Exemple #3
0
 private WindowDragBehaviour(Placement placement)
 {
     this.placement  = placement;
     windowPlacement = DockManager.Instance.Model.GetWindowByPlacement(placement);
     ((WindowWidget)WidgetContext.Current.Root).Tasks.Add(MoveTask());
     Input = CommonWindow.Current.Input;
     Application.Input.Simulator.SetKeyState(Key.Mouse0, true);
 }
Exemple #4
0
        public static void SendKey(KeyboardEventType type, KeyCode key)
        {
#if WINDOWS_OS
            WindowInput[] inputs = new WindowInput[]
            {
                new WindowInput()
                {
                    type = (int)WindowInputType.Keyboard,
                    u    = new WindowInputMessage()
                    {
                        ki = new WindowKeyboardInput()
                        {
                            wVk         = 0,
                            wScan       = (ushort)key.ToScanCode(),
                            dwFlags     = (uint)(type.ToWindowsKeyEvent() | KeyEventF.Scancode),
                            dwExtraInfo = GetMessageExtraInfo()
                        }
                    }
                }
            };
            SendInput(1, inputs, Marshal.SizeOf <WindowInput>());
#endif
        }
Exemple #5
0
        public static void MoveMouse(Point2d location, bool drag = false)
        {
#if WINDOWS_OS
            WindowInput[] inputs = new WindowInput[]
            {
                new WindowInput()
                {
                    type = (int)WindowInputType.Mouse,
                    u    = new WindowInputMessage()
                    {
                        mi = new WindowMouseInput()
                        {
                            dx          = location.X,
                            dy          = location.Y,
                            dwFlags     = (uint)(MouseEventF.Absolute | MouseEventF.Move | (drag ? MouseEventF.LeftDown : 0x00)),
                            dwExtraInfo = GetMessageExtraInfo()
                        }
                    }
                }
            };
            SendInput(1, inputs, Marshal.SizeOf <WindowInput>());
#endif
        }
 private static void InitializeInput()
 {
     WindowInput = new WindowInput(Window);
 }