General purpose engine handler for gestures that only involve a single touch point (like "Tap" and "Hold")
This handler can simultaniously recognize gestures on different touch points since each contact is handled separately.
Inheritance: EngineHandlerBase
        protected override void OnAttached()
        {
            base.OnAttached();
            var handler = new EngineHandler(() => new TapGestureEngine(MinMilliseconds, MaxMilliseconds, MaxMovement), base.AssociatedObject, HandlesTouches);

            handler.GestureCompleted += (s, e) => OnTap();
        }
Example #2
0
        protected override void OnAttached()
        {
            base.OnAttached();
            var handler = new EngineHandler(() => new HoldGestureEngine(HoldTimeout, MaxMovement), base.AssociatedObject);

            handler.GestureCompleted += (s, e) => this.InvokeActions(null);
        }
Example #3
0
    /// <summary>
    /// Registers a framework element for gesture recognition. Any element below the root element will be eligable for gesture events and events bubble through the tree like normal routed events
    /// </summary>
    /// <param name="root">The root element where gesture support should be supported. This element and any element below it in the tree will get gesture support</param>
    public static void RegisterGestureEventSupport(FrameworkElement root)
    {
      // TODO: should we allow an element to unregister?
      EngineHandlerBase engine = null;
      engine = new EngineHandler(() => new HoldGestureEngine(HoldGestureTimeout, HoldMaxMovement), root, false);
      engine.GestureCompleted += (s, e) => e.Source.RaiseEvent(new GestureEventArgs(HoldGestureEvent, e.TouchDevice));

      engine = new EngineHandler(() => new TapGestureEngine(TapMinMilliseconds, TapMaxMilliseconds, TapMaxMovement), root, false);
      engine.GestureCompleted += (s, e) => e.Source.RaiseEvent(new GestureEventArgs(TapGestureEvent, e.TouchDevice));

      engine = new MultiEngineHandler(() => new DoubleTapGestureEngine(TapMinMilliseconds, DoubleTapGapMilliseconds, TapMaxMilliseconds, TapMaxMovement), root, false);
      engine.GestureCompleted += (s, e) => e.Source.RaiseEvent(new GestureEventArgs(DoubleTapGestureEvent, e.TouchDevice));
    }
Example #4
0
        /// <summary>
        /// Registers a framework element for gesture recognition. Any element below the root element will be eligable for gesture events and events bubble through the tree like normal routed events
        /// </summary>
        /// <param name="root">The root element where gesture support should be supported. This element and any element below it in the tree will get gesture support</param>
        public static void RegisterGestureEventSupport(FrameworkElement root)
        {
            // TODO: should we allow an element to unregister?
            EngineHandlerBase engine = null;

            engine = new EngineHandler(() => new HoldGestureEngine(HoldGestureTimeout, HoldMaxMovement), root, false);
            engine.GestureCompleted += (s, e) => e.Source.RaiseEvent(new GestureEventArgs(HoldGestureEvent, e.TouchDevice));

            engine = new EngineHandler(() => new TapGestureEngine(TapMinMilliseconds, TapMaxMilliseconds, TapMaxMovement), root, false);
            engine.GestureCompleted += (s, e) => e.Source.RaiseEvent(new GestureEventArgs(TapGestureEvent, e.TouchDevice));

            engine = new MultiEngineHandler(() => new DoubleTapGestureEngine(TapMinMilliseconds, DoubleTapGapMilliseconds, TapMaxMilliseconds, TapMaxMovement), root, false);
            engine.GestureCompleted += (s, e) => e.Source.RaiseEvent(new GestureEventArgs(DoubleTapGestureEvent, e.TouchDevice));
        }