Base class for engine handlers.
示例#1
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));
        }