Exemplo n.º 1
0
        private void SendTouch(float x, float y, int state)
        {
            try
            {
                if (Manipulator.ReadInt32(TOUCH_PANEL_CONNECTION_STATE) != 1)
                {
                    Manipulator.WriteInt32(TOUCH_PANEL_CONNECTION_STATE, 1);
                }

                if (_isTouching)
                {
                    var mousePos = new POINT((int)x, (int)y);
                    var relPos   = Manipulator.GetMouseRelativePos(mousePos);

                    Manipulator.WriteSingle(TOUCH_PANEL_X_POSITION, relPos.X);
                    Manipulator.WriteSingle(TOUCH_PANEL_Y_POSITION, relPos.Y);
                }
                Manipulator.WriteInt32(TOUCH_PANEL_CONTACT_TYPE, state);
                float pressure = state != 0 ? 1 : 0;
                Manipulator.WriteSingle(TOUCH_PANEL_PRESSURE, pressure);
            }
            catch (Exception)
            {
                Stop();
            }
        }