public RelayCommand GetStartCommand()
        {
            return(startCommand ??
                   (startCommand = new RelayCommand(obj =>
            {
                InjectedInputPoint injectedInputPoint = new InjectedInputPoint();
                injectedInputPoint.PositionX = 1817;
                injectedInputPoint.PositionY = 0;
                //injectedInputPoint.PointerOptions.

                CoreWindow.GetForCurrentThread().PointerPosition = new Point(injectedInputPoint.PositionX, injectedInputPoint.PositionY);
                //InjectedInputMouseOptions.Absolute(); Cursor.Position = new Point(400, 700);
                InputInjector inputInjector = InputInjector.TryCreate();
                var down = new InjectedInputMouseInfo();
                down.MouseOptions = InjectedInputMouseOptions.LeftDown;
                var up = new InjectedInputMouseInfo();
                up.MouseOptions = InjectedInputMouseOptions.LeftUp;
                Task.Delay(1500);
                inputInjector.InjectMouseInput(new[] { down, up });
                injectedInputPoint.PositionX = 0;
                injectedInputPoint.PositionY = 0;
                CoreWindow.GetForCurrentThread().PointerPosition = new Point(injectedInputPoint.PositionX, injectedInputPoint.PositionY);
                Task.Delay(15000);
                inputInjector.InjectMouseInput(new[] { down });
                injectedInputPoint.PositionX = 879;
                injectedInputPoint.PositionY = 115;
                CoreWindow.GetForCurrentThread().PointerPosition = new Point(injectedInputPoint.PositionX, injectedInputPoint.PositionY);
                inputInjector.InjectMouseInput(new[] { down, up });
                inputInjector.InjectMouseInput(new[] { down, up });
            })));
        }
Exemplo n.º 2
0
        private int Touch(int type, double X, double Y)
        {
            InjectedInputPointerOptions pointerOption;
            Double pressure;        // 0.0~ 1.0 (1024단계)

            switch (type)
            {
            case 0:
                pointerOption = InjectedInputPointerOptions.InRange;
                pressure      = 1.0;
                break;

            case 1:
                pointerOption = InjectedInputPointerOptions.InContact;
                pressure      = 1.0;
                break;

            case 2:
                pointerOption = InjectedInputPointerOptions.PointerUp;
                pressure      = 0;
                break;

            default:
                return(-1);
            }
            var location = new InjectedInputPoint {
                PositionX = (int)X, PositionY = (int)Y
            };

            try
            {
                inputInjector.InjectTouchInput
                (
                    new List <InjectedInputTouchInfo>
                {
                    new InjectedInputTouchInfo
                    {
                        Contact = new InjectedInputRectangle
                        {
                            Top    = 50,
                            Bottom = 50,
                            Left   = 40,
                            Right  = 40
                        },
                        PointerInfo = new InjectedInputPointerInfo
                        {
                            PixelLocation  = location,
                            PointerOptions = pointerOption,
                            PointerId      = 1,
                        },
                        Pressure        = pressure,
                        TouchParameters =
                            InjectedInputTouchParameters.Pressure |
                            InjectedInputTouchParameters.Contact
                    }
                }
                );
                return(1);
            }
            catch (Exception e)
            {
                return(-2);
            }
        }