示例#1
0
        protected override void OnAttached()
        {
            Console.WriteLine("In OnAttached");
            // Get the Android View corresponding to the Element that the effect is attached to
            view = Control == null ? Container : Control;

            // Get access to the TouchEffect class in the .NET Standard library
            Is_This_Vegan.Backend.TouchEffect touchEffect =
                (Is_This_Vegan.Backend.TouchEffect)Element.Effects.
                FirstOrDefault(e => e is Is_This_Vegan.Backend.TouchEffect);

            if (touchEffect != null && view != null)
            {
                viewDictionary.Add(view, this);

                formsElement = Element;

                libTouchEffect = touchEffect;

                // Save fromPixels function
                fromPixels = view.Context.FromPixels;

                // Set event handler on View
                view.Touch += OnTouch;
            }
        }
示例#2
0
        public TouchRecognizer(Element element, UIView view, Is_This_Vegan.Backend.TouchEffect touchEffect)
        {
            this.element     = element;
            this.view        = view;
            this.touchEffect = touchEffect;

            viewDictionary.Add(view, this);
        }
示例#3
0
        protected override void OnAttached()
        {
            // Get the Windows FrameworkElement corresponding to the Element that the effect is attached to
            frameworkElement = Control == null ? Container : Control;

            // Get access to the TouchEffect class in the .NET Standard library
            effect = (Is_This_Vegan.Backend.TouchEffect)Element.Effects.
                     FirstOrDefault(e => e is TouchEffect);

            if (effect != null && frameworkElement != null)
            {
                // Save the method to call on touch events
                onTouchAction = effect.OnTouchAction;

                // Set event handlers on FrameworkElement
                frameworkElement.PointerEntered  += OnPointerEntered;
                frameworkElement.PointerPressed  += OnPointerPressed;
                frameworkElement.PointerMoved    += OnPointerMoved;
                frameworkElement.PointerReleased += OnPointerReleased;
                frameworkElement.PointerExited   += OnPointerExited;
                frameworkElement.PointerCanceled += OnPointerCancelled;
            }
        }