示例#1
0
        protected override void Dispose(bool disposing)
        {
            if (disposing && !_disposed)
            {
                _disposed = true;

                RemoveAllViews();

                foreach (Page pageToRemove in Element.Children)
                {
                    IVisualElementRenderer pageRenderer = Platform.GetRenderer(pageToRemove);

                    if (pageRenderer != null)
                    {
                        pageRenderer.ViewGroup.RemoveFromParent();
                        pageRenderer.Dispose();
                    }
                }

                if (_bottomBar != null)
                {
                    _bottomBar.SetOnTabClickListener(null);
                    _bottomBar.Dispose();
                    _bottomBar = null;
                }

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

            base.Dispose(disposing);
        }
示例#2
0
        protected override void Dispose(bool disposing)
        {
            if (disposing && !_disposed)
            {
                _disposed = true;

                RemoveAllViews();

                foreach (Page pageToRemove in Element.Children)
                {
                    IVisualElementRenderer pageRenderer = Platform.GetRenderer(pageToRemove);

                    if (pageRenderer != null)
                    {
                        pageRenderer.View.RemoveFromParent();
                        try
                        {
                            pageRenderer.Dispose();
                        }
                        catch (Exception ex)
                        {
                            ;
                        }
                    }

                    pageToRemove.PropertyChanged -= OnPagePropertyChanged;
                    // pageToRemove.ClearValue (Platform.RendererProperty);
                }

                if (_badges != null)
                {
                    _badges.Clear();
                    _badges = null;
                }

                if (_bottomBar != null)
                {
                    _bottomBar.SetOnTabClickListener(null);
                    _bottomBar.Dispose();
                    _bottomBar = null;
                }

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

                /*if (Element != null) {
                 *      PageController.InternalChildren.CollectionChanged -= OnChildrenCollectionChanged;
                 * }*/
            }

            base.Dispose(disposing);
        }
        protected override void Dispose(bool disposing)
        {
            if (disposing && !_disposed)
            {
                _disposed = true;

                RemoveAllViews();

                foreach (Page pageToRemove in Element.Children)
                {
                    IVisualElementRenderer pageRenderer = Platform.GetRenderer(pageToRemove);

                    if (pageRenderer != null)
                    {
#pragma warning disable CS0618 // Type or member is obsolete
                        pageRenderer.ViewGroup.RemoveFromParent();
#pragma warning restore CS0618 // Type or member is obsolete
                        pageRenderer.Dispose();
                    }

                    pageToRemove.PropertyChanged -= OnPagePropertyChanged;
                    // pageToRemove.ClearValue (Platform.RendererProperty);
                }

                if (_badges != null)
                {
                    _badges.Clear();
                    _badges = null;
                }

                if (_bottomBar != null)
                {
                    _bottomBar.SetOnTabClickListener(null);
                    _bottomBar.Dispose();
                    _bottomBar = null;
                }

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

                /*if (Element != null) {
                 *      PageController.InternalChildren.CollectionChanged -= OnChildrenCollectionChanged;
                 * }*/
            }

            base.Dispose(disposing);
        }