CCT.NUI.WPFSamples.TouchController.Touch C# (CSharp) Method

Touch() public static method

public static Touch ( int x, int y ) : void
x int
y int
return void
        public static void Touch(int x, int y)
        {
            bool flag = false;
            flag = InitializeTouchInjection(10, TOUCH_FEEDBACK_DEFAULT);

            POINTER_TOUCH_INFO contacts = new POINTER_TOUCH_INFO();


            contacts.pointerInfo.pointerType = POINTER_INPUT_TYPE.PT_TOUCH;
            contacts.touchFlags = TOUCH_FLAGS.TOUCH_FLAGS_NONE;

            contacts.orientation = 90;
            contacts.pressure = 32000;
            contacts.pointerInfo.pointerFlags = POINTER_FLAGS.POINTER_FLAG_DOWN | POINTER_FLAGS.POINTER_FLAG_INRANGE | POINTER_FLAGS.POINTER_FLAG_INCONTACT;
            contacts.touchMasks = TOUCH_MASK.TOUCH_MASK_CONTACTAREA | TOUCH_MASK.TOUCH_MASK_ORIENTATION | TOUCH_MASK.TOUCH_MASK_PRESSURE;
            contacts.pointerInfo.ptPixelLocation.x = x;
            contacts.pointerInfo.ptPixelLocation.y = y;
            contacts.pointerInfo.pointerId = 1;

            Rect touchArea = new Rect();
            touchArea.left = x - 2;
            touchArea.right = x + 2;
            touchArea.top = y - 2;
            touchArea.bottom = y + 2;
            contacts.rcContact = touchArea;

            flag = InjectTouchInput(1, ref contacts);

            contacts.pressure = 0;
            if (flag)
            {
                contacts.pointerInfo.pointerFlags = POINTER_FLAGS.POINTER_FLAG_UP;
                InjectTouchInput(1, ref contacts);
            }
        }