protected VisualElementRenderer(Context context) : base(context)
 {
     _gestureManager = new GestureManager(this);
 }
        protected override void Dispose(bool disposing)
        {
            if (CheckFlagsForDisposed())
            {
                return;
            }

            _flags |= VisualElementRendererFlags.Disposed;

            if (disposing)
            {
                SetOnClickListener(null);
                SetOnTouchListener(null);

                EffectUtilities.UnregisterEffectControlProvider(this, Element);

                if (Element != null)
                {
                    Element.PropertyChanged -= _propertyChangeHandler;
                }

                if (Tracker != null)
                {
                    Tracker.Dispose();
                    Tracker = null;
                }

                if (_packager != null)
                {
                    _packager.Dispose();
                    _packager = null;
                }

                if (_gestureManager != null)
                {
                    _gestureManager.Dispose();
                    _gestureManager = null;
                }

                if (ManageNativeControlLifetime)
                {
                    while (ChildCount > 0)
                    {
                        AView child = GetChildAt(0);
                        child.RemoveFromParent();
                        child.Dispose();
                    }
                }

                if (Element != null)
                {
                    if (Platform.GetRenderer(Element) == this)
                    {
                        Platform.SetRenderer(Element, null);
                    }

                    Element = null;
                }
            }

            base.Dispose(disposing);
        }
Exemplo n.º 3
0
 protected VisualElementRenderer() : base(Forms.Context)
 {
     _gestureManager = new GestureManager(this);
 }