Ejemplo n.º 1
0
        private void CoalesceEvents(InteropTouchEventArgs e)
        {
            TimeSpan span  = DateTime.Now - lastEventTime;
            Vector   delta = e.Location - 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 = e.Location;
                lastEventTime     = DateTime.Now;
                lastEventType     = EventType.TouchMove;

                this.lastEventArgs = e;
                this.ReportMove();
            }
        }
Ejemplo n.º 2
0
        private void TouchMove(InteropTouchEventArgs e)
        {
            if (!this.IsActive)
            {
                return;
            }

            CoalesceEvents(e);
        }
Ejemplo n.º 3
0
        static void TouchDown(object sender, InteropTouchEventArgs e)
        {
            NativeTouchDevice device = null;

            if (!deviceDictionary.Keys.Contains(e.Id))
            {
                device = new NativeTouchDevice(e);
                deviceDictionary.Add(e.Id, device);
            }

            if (device != null)
            {
                device.TouchDown(e);
            }
        }
Ejemplo n.º 4
0
        static void TouchMove(object sender, InteropTouchEventArgs e)
        {
            int id = e.Id;

            if (!deviceDictionary.Keys.Contains(id))
            {
                TouchDown(sender, e);
            }

            NativeTouchDevice device = deviceDictionary[id];

            if (device != null)
            {
                device.TouchMove(e);
            }
        }
Ejemplo n.º 5
0
        private void TouchDown(InteropTouchEventArgs e)
        {
            if (lastEventType != EventType.TouchMoveIntermediate)
            {
                intermediateEvents.Clear();
            }

            this.lastEventArgs = e;
            lastEventPosition  = e.Location;
            lastEventTime      = DateTime.Now;
            lastEventType      = EventType.TouchDown;

            this.SetActiveSource(e.ActiveSource);
            this.Activate();
            this.ReportDown();
        }
Ejemplo n.º 6
0
        private void TouchUp(InteropTouchEventArgs e)
        {
            if (lastEventType != EventType.TouchMoveIntermediate)
            {
                intermediateEvents.Clear();
            }

            if (!this.IsActive)
            {
                return;
            }

            this.lastEventArgs = e;

            this.ReportUp();
            this.Deactivate();
            lastEventType = EventType.TouchUp;
        }
Ejemplo n.º 7
0
 public NativeTouchDevice(InteropTouchEventArgs e) :
     base(e.Id)
 {
     lastEventArgs = e;
 }