상속: System.EventArgs
        public MotionTrackingTouchDevice(HandPointEventArgs e, Window window, MotionTrackingScreen screen)
            : base(e.Id)
        {
            lastEventArgs = e;

            if (window == null)
                throw new ArgumentNullException("window");
            if (screen == null)
                throw new ArgumentNullException("screen");

            this.screen = screen;
            this.rootWindow = window;
        }
예제 #2
0
 private void UpdateProperties(HandPointEventArgs e)
 {
     ShouldPromoteToTouch = false;
     this.lastHandPointEventArgs = e;
     this.Session = e.Session;
     this.Id = e.Id;
     lastEventInBounds = currentPositionInBounds;
     currentPositionInBounds = screen.IsSessionInBounds(e.Session);
     if (currentPositionInBounds)
     {
         currentPosition = screen.MapPositionToScreen(e.Session);
         UpdateDirectlyOver();
     }
 }
예제 #3
0
 internal void ReportMotionTrackingUpdated(HandPointEventArgs e)
 {
     UpdateProperties(e);
     if (!currentPositionInBounds)
     {
         if (lastEventInBounds)
         {
             ProcessMotionTrackingLost();
         }
         return;
     }
     if (!lastEventInBounds)
     {
         ProcessMotionTrackingStarted();
     }
     ProcessMotionTrackingUpdated();
 }
예제 #4
0
 internal void ReportMotionTrackingLost(HandPointEventArgs e)
 {
     UpdateProperties(e);
     if (!lastEventInBounds)
     {
         return;
     }
     ProcessMotionTrackingLost();
 }
예제 #5
0
        internal void HandPointGenerator_PointUpdated(object sender, HandPointEventArgs e)
        {
            if (Window == null)
                return;

            if (!Window.CheckAccess())
            {
                Window.Dispatcher.Invoke(new EventHandler<HandPointEventArgs>(HandPointGenerator_PointUpdated), System.Windows.Threading.DispatcherPriority.Input, sender, e);
                return;
            }

            int id = e.Id;
            if (!deviceDictionary.Keys.Contains(id))
            {
                HandPointGenerator_PointCreated(sender, e);
            }

            MotionTrackingDevice device = deviceDictionary[id];
            if (device != null)
            {
                device.ReportMotionTrackingUpdated(e);
            }
        }
예제 #6
0
        internal void HandPointGenerator_PointCreated(object sender, HandPointEventArgs e)
        {
            if (Window == null)
                return;

            if (!Window.CheckAccess())
            {
                Window.Dispatcher.Invoke(new EventHandler<HandPointEventArgs>(HandPointGenerator_PointCreated), System.Windows.Threading.DispatcherPriority.Input, sender, e);
                return;
            }

            MotionTrackingDevice device = null;
            if (!deviceDictionary.Keys.Contains(e.Id))
            {
                device = new MotionTrackingDevice(Window, Screen);
                deviceDictionary.Add(e.Id, device);
            }

            if (device != null)
            {
                device.ReportMotionTrackingStarted(e);
            }
        }
        private void CoalesceEvents(HandPointEventArgs e)
        {
            TimeSpan span = DateTime.Now - lastEventTime;
            Vector delta = screen.MapPositionToScreen(e.Session) - lastEventPosition;

            if (lastEventType != EventType.TouchMoveIntermediate)
            {
                intermediateEvents.Clear();
            }

            if (span.TotalMilliseconds < timeThreshold ||
                Math.Ceiling(delta.Length) < movementThreshold)
            {
                intermediateEvents.Add(e);
                lastEventType = EventType.TouchMoveIntermediate;
                //Debug.WriteLine("Event NO: " + touch.TouchDevice.Id + " " + point.Position.ToString() + " " + touch.Timestamp.ToString());
            }
            else
            {
                //Debug.WriteLine("Event go: " + touch.TouchDevice.Id + " " + point.Position.ToString() + " " + touch.Timestamp.ToString());

                lastEventPosition = screen.MapPositionToScreen(e.Session);
                lastEventTime = DateTime.Now;
                lastEventType = EventType.TouchMove;

                this.lastEventArgs = e;
                this.ReportMove();

            }
        }
        internal void TouchUp(HandPointEventArgs e)
        {
            if (lastEventType != EventType.TouchMoveIntermediate)
            {
                intermediateEvents.Clear();
            }

            if (!this.IsActive)
            {
                return;
            }

            this.lastEventArgs = e;
            this.Session = null;
            this.ReportUp();
            this.Deactivate();
            lastEventType = EventType.TouchUp;
        }
 internal void TouchMove(HandPointEventArgs e)
 {
     if (!this.IsActive)
     {
         return;
     }
     this.Session = e.Session;
     CoalesceEvents(e);
 }
        internal void TouchDown(HandPointEventArgs e)
        {
            if (lastEventType != EventType.TouchMoveIntermediate)
            {
                intermediateEvents.Clear();
            }

            this.lastEventArgs = e;
            lastEventPosition = screen.MapPositionToScreen(e.Session);
            lastEventTime = DateTime.Now;
            lastEventType = EventType.TouchDown;
            this.Session = e.Session;
            var source = PresentationSource.FromVisual(this.rootWindow);
            this.SetActiveSource(source);
            this.Activate();
            this.ReportDown();
        }
예제 #11
0
 private static void HandPointGenerator_PointUpdated(object sender, HandPointEventArgs e)
 {
     List<MotionTrackingClient> clientsCopy = new List<MotionTrackingClient>();
     lock (clients)
     {
         clientsCopy.AddRange(clients);
     }
     foreach (var client in clientsCopy)
     {
         client.HandPointGenerator_PointUpdated(sender, e);
     }
 }