Exemple #1
0
        protected override void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            _disposed = true;

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

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

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

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

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

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

                if (Element != null)
                {
                    if (Platform.GetRenderer(Element) == this)
                    {
                        Element.ClearValue(Platform.RendererProperty);
                    }
                }
            }

            base.Dispose(disposing);
        }
        protected override void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            _disposed = true;

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

                BackgroundManager.Dispose(this);
                if (_visualElementTracker != null)
                {
                    _visualElementTracker.Dispose();
                    _visualElementTracker = null;
                }

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

                _spannableString?.Dispose();

                if (Element != null)
                {
                    if (Platform.GetRenderer(Element) == this)
                    {
                        Element.ClearValue(Platform.RendererProperty);
                    }
                }
            }

            base.Dispose(disposing);
        }
Exemple #3
0
        protected override void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            _disposed = true;

            if (disposing)
            {
                if (_element != null)
                {
                    _element.PropertyChanged -= OnElementPropertyChanged;
                }

                ImageElementManager.Dispose(this);
                BackgroundManager.Dispose(this);

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

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

                if (_element != null)
                {
                    if (AppCompat.Platform.GetRenderer(_element) == this)
                    {
                        _element.ClearValue(AppCompat.Platform.RendererProperty);
                    }
                }
            }

            base.Dispose(disposing);
        }