Engine handler for engines that needs more than one touch point to recognize gestures (e.g. DoubleTap)
Since this handler requires more than one touch point in order to recognize gestures it is not possible for it to simultaniously detect parallell gestures (like e.g. two DoubleTap gestures occurring at the same time).
Inheritance: EngineHandlerBase
        protected override void OnAttached()
        {
            base.OnAttached();
            var handler = new MultiEngineHandler(() => new DoubleTapGestureEngine(MinMilliseconds, GapMilliseconds, MaxMilliseconds, MaxMovement), base.AssociatedObject, HandlesTouches);

            handler.GestureCompleted += (s, e) => OnDoubleTap();
        }
Ejemplo n.º 2
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));
    }
Ejemplo n.º 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));
        }