public void UpdateTuioCursor(TuioCursor tuioCursor)
        {
            _refreshTimer.Stop();

            int pid = tuioCursor.getCursorID();

            int i = _pointerTouchInfos.FindIndex(pti => pti.PointerInfo.PointerId == pid);

            if (i != -1)
            {
                int x = (int)((tuioCursor.getX() * (_screenRect.Width + _calibrationBuffer.Width)) + _calibrationBuffer.Left + _screenRect.Left);
                int y = (int)((tuioCursor.getY() * (_screenRect.Height + _calibrationBuffer.Height)) + _calibrationBuffer.Top + _screenRect.Top);

                PointerTouchInfo pointerTouchInfo = _pointerTouchInfos[i];
                pointerTouchInfo.PointerInfo.PointerFlags    = PointerFlags.UPDATE | PointerFlags.INRANGE | ((this.IsContactEnabled) ? PointerFlags.INCONTACT : PointerFlags.NONE);
                pointerTouchInfo.PointerInfo.PtPixelLocation = new PointerTouchPoint {
                    X = x, Y = y
                };
                pointerTouchInfo.ContactArea = new ContactArea
                {
                    Left   = x - CONTACT_AREA_RADIUS,
                    Right  = x + CONTACT_AREA_RADIUS,
                    Top    = y - CONTACT_AREA_RADIUS,
                    Bottom = y + CONTACT_AREA_RADIUS
                };
                _pointerTouchInfos[i] = pointerTouchInfo;

                Trace.WriteLine(string.Format("set cur {0} ({1}) {2} {3} {4} {5}", pid, tuioCursor.getSessionID(), x, y, tuioCursor.getMotionSpeed(), tuioCursor.getMotionAccel()), "TUIO");
            }
        }
 public void removeTuioCursor(TuioCursor tcur)
 {
     lock (cursorSync)
     {
         cursorList.Remove(tcur.getSessionID());
     }
     Console.WriteLine("del cur " + tcur.getCursorID() + " (" + tcur.getSessionID() + ")");
 }
        public void addTuioCursor(TuioCursor tcur)
        {
            lock (cursorSync)
            {
                cursorList.Add(tcur.getSessionID(), tcur);
            }

            Console.WriteLine("add cur " + tcur.getCursorID() + " (" + tcur.getSessionID() + ") " + tcur.getX() + " " + tcur.getY());
            //  VisualFeedback.InvalidateVisual();
        }
        public static void addTuioCursor(TuioCursor c)
        {
            TUIOTouchDevice device = null;

            if (!deviceDictionary.Keys.Contains(c.getCursorID()))
            {
                device = new TUIOTouchDevice(c.getCursorID());
                deviceDictionary.Add(c.getCursorID(), device);
            }

            if (device != null)
            {
                device.OriginalPosition = new Point(c.getX(), c.getY());

                device.SetActiveSource(PresentationSource.FromVisual(_root));
                device.Activate();
                device.ReportDown();
            }
        }
        public static void updateTuioCursor(TuioCursor c)
        {
            int id = c.getCursorID();

            if (!deviceDictionary.Keys.Contains(id))
            {
                addTuioCursor(c);
            }
            TUIOTouchDevice device = deviceDictionary[id];

            if (device != null)
            {
                device.OriginalPosition = new Point(c.getX(), c.getY());
                device.ReportMove();
            }
        }
        public void RemoveTuioCursor(TuioCursor tuioCursor)
        {
            _refreshTimer.Stop();

            int pid = tuioCursor.getCursorID();

            int i = _pointerTouchInfos.FindIndex(pti => pti.PointerInfo.PointerId == pid);

            if (i != -1)
            {
                PointerTouchInfo pointerTouchInfo = _pointerTouchInfos[i];
                pointerTouchInfo.PointerInfo.PointerFlags = PointerFlags.UP;
                _pointerTouchInfos[i] = pointerTouchInfo;

                Trace.WriteLine(string.Format("del cur {0} ({1})", pid, tuioCursor.getSessionID()), "TUIO");
            }
        }
        public void AddTuioCursor(TuioCursor tuioCursor)
        {
            _refreshTimer.Stop();

            int pid = tuioCursor.getCursorID();

            int i = _pointerTouchInfos.FindIndex(pti => pti.PointerInfo.PointerId == pid);

            if (i != -1)
            {
                _pointerTouchInfos.RemoveAt(i);
            }

            int x = (int)((tuioCursor.getX() * (_screenRect.Width + _calibrationBuffer.Width)) + _calibrationBuffer.Left + _screenRect.Left);
            int y = (int)((tuioCursor.getY() * (_screenRect.Height + _calibrationBuffer.Height)) + _calibrationBuffer.Top + _screenRect.Top);

            _pointerTouchInfos.Add
            (
                new PointerTouchInfo()
            {
                TouchFlags  = TouchFlags.NONE,
                Orientation = TOUCH_ORIENTATION,
                Pressure    = TOUCH_PRESSURE,
                TouchMasks  = TouchMask.CONTACTAREA | TouchMask.ORIENTATION | TouchMask.PRESSURE,
                PointerInfo = new PointerInfo
                {
                    PointerInputType = PointerInputType.TOUCH,
                    PointerFlags     = PointerFlags.DOWN | PointerFlags.INRANGE | ((this.IsContactEnabled) ? PointerFlags.INCONTACT : PointerFlags.NONE),
                    PtPixelLocation  = new PointerTouchPoint {
                        X = x, Y = y
                    },
                    PointerId = (uint)pid
                },
                ContactArea = new ContactArea
                {
                    Left   = x - CONTACT_AREA_RADIUS,
                    Right  = x + CONTACT_AREA_RADIUS,
                    Top    = y - CONTACT_AREA_RADIUS,
                    Bottom = y + CONTACT_AREA_RADIUS
                }
            }
            );

            Trace.WriteLine(string.Format("add cur {0} ({1}) {2} {3}", pid, tuioCursor.getSessionID(), x, y), "TUIO");
        }
 public void updateTuioCursor(TuioCursor tcur)
 {
     Console.WriteLine("set cur " + tcur.getCursorID() + " (" + tcur.getSessionID() + ") " + tcur.getX() + " " + tcur.getY() + " " + tcur.getMotionSpeed() + " " + tcur.getMotionAccel());
 }