protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                Element.ChildAdded        -= PagesChanged;
                Element.ChildRemoved      -= PagesChanged;
                Element.ChildrenReordered -= PagesChanged;

                if (_rootLayout != null)
                {
                    RemoveAllViews();
                    foreach (Page pageToRemove in Element.Children)
                    {
                        var pageRenderer = Platform.GetRenderer(pageToRemove);
                        if (pageRenderer != null)
                        {
                            pageRenderer.View.RemoveFromParent();
                            pageRenderer.Dispose();
                        }
                    }

                    if (_bottomNav != null)
                    {
                        _bottomNav.SetOnNavigationItemSelectedListener(null);
                        _bottomNav.Dispose();
                        _bottomNav = null;
                    }
                    _rootLayout.Dispose();
                    _rootLayout = 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.ViewGroup.RemoveFromParent();
                        pageRenderer.Dispose();
                    }
                }

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

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

            base.Dispose(disposing);
        }
示例#3
0
        protected override void Dispose(bool disposing)
        {
            if (disposing && Element != null)
            {
                Element.ChildAdded        -= PagesChanged;
                Element.ChildRemoved      -= PagesChanged;
                Element.ChildrenReordered -= PagesChanged;

                if (rootLayout != null)
                {
                    //TODO Cleanup
                    RemoveAllViews();
                    foreach (Page pageToRemove in Element.Children)
                    {
                        IVisualElementRenderer pageRenderer = Platform.GetRenderer(pageToRemove);

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

                    if (bottomNav != null)
                    {
                        bottomNav.SetOnNavigationItemSelectedListener(null);
                        bottomNav.Dispose();
                        bottomNav = null;
                    }
                    rootLayout.Dispose();
                    rootLayout = null;
                }
            }

            base.Dispose(disposing);
        }
 public override void OnDestroy()
 {
     _bottomNavigationView?.Dispose();
     base.OnDestroy();
 }