Esempio n. 1
0
        /// <summary>
        /// Send mouse move event to the streaming PC
        /// </summary>
        private void MouseMove(object sender, PointerRoutedEventArgs e)
        {
            var pointerCollection = e.GetIntermediatePoints(null);
            // TODO what the heck is this even giving me
            // TODO check for default value??
            var first = pointerCollection.FirstOrDefault();
            var last  = pointerCollection.LastOrDefault();

            // TODO is this check redundant? Will the event trigger lie to me frequently enough (if ever) that it'll be an issue?
            if (first.Position.X != last.Position.X || first.Position.Y != last.Position.Y)
            {
                short x = (short)(last.Position.X - first.Position.X);
                short y = (short)(last.Position.Y - first.Position.Y);
                Debug.WriteLine(x + " and " + y);
                hasMoved = true;
                // Send the values to the streaming PC so it can register mouse movement
                LimelightCommonRuntimeComponent.SendMouseMoveEvent((short)(x), (short)(y));
            }
            // TODO what even am I doing
        }
        /// <summary>
        /// Send mouse move event to the streaming PC
        /// </summary>
        private void MouseMove(object sender, PointerRoutedEventArgs e)
        {
            PointerPoint ptrPt  = e.GetCurrentPoint(StreamDisplay);
            short        eventX = (short)ptrPt.Position.X;
            short        eventY = (short)ptrPt.Position.Y;

            if (eventX != lastX || eventY != lastY)
            {
                hasMoved = true;
                short xToSend = (short)(eventX - lastX);
                short yToSend = (short)(eventY - lastY);
                // Send the values to the streaming PC so it can register mouse movement
                LimelightCommonRuntimeComponent.SendMouseMoveEvent(xToSend, yToSend);

                lastX = eventX;
                lastY = eventY;
            }

            // Prevent most handlers along the event route from handling the same event again.
            e.Handled = true;
        }