示例#1
0
        protected override void 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
            var touchEffect =
                (CrossTouchEffect)Element.Effects.
                FirstOrDefault(e => e is CrossTouchEffect);

            if (touchEffect != null && view != null)
            {
                _ = _viewDictionary.TryAdd(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, CrossTouchEffect touchEffect)
        {
            _element     = element;
            _view        = view;
            _touchEffect = touchEffect;

            _viewDictionary.Add(view, this);
        }