Exemplo n.º 1
0
        private void SimulateTouch(int x, int y)
        {
            // Touch Down Simulate
            PointerTouchInfo contact = MakePointerTouchInfo(x, y, 5, 1);
            PointerFlags     oFlags  = PointerFlags.DOWN | PointerFlags.INRANGE | PointerFlags.INCONTACT;

            contact.PointerInfo.PointerFlags = oFlags;
            bool bIsSuccess = TouchInjector.InjectTouchInput(1, new[] { contact });

            // Touch Move Simulate
            int nMoveIntervalX = this.GetRandomSeed().Next(-60, 60);
            int nMoveIntervalY = this.GetRandomSeed().Next(-60, 60);

            contact.Move(nMoveIntervalX, nMoveIntervalY);
            oFlags = PointerFlags.INRANGE | PointerFlags.INCONTACT | PointerFlags.UPDATE;
            contact.PointerInfo.PointerFlags = oFlags;
            TouchInjector.InjectTouchInput(1, new[] { contact });

            // Touch Up Simulate
            contact.PointerInfo.PointerFlags = PointerFlags.UP;
            TouchInjector.InjectTouchInput(1, new[] { contact });
        }