예제 #1
0
 protected void SetPackager(VisualElementPackager packager)
 {
     _packager = packager;
     packager.Load();
 }
예제 #2
0
        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 (AppCompat.Platform.GetRenderer(Element) == this)
                    {
                        AppCompat.Platform.SetRenderer(Element, null);
                    }

                    Element = null;
                }
            }

            base.Dispose(disposing);
        }