private void ClearElement(MainPage element)
        {
            if (_currentPage == null)
            {
                return;
            }
            var renderer = Platform.GetRenderer(_currentPage);

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

                _currentPage = null;
            }

            if (_bottomBar == null)
            {
                return;
            }
            _bottomBar.RemoveFromParent();
            _bottomBar.Dispose();
            _bottomBar = null;
        }
Exemple #2
0
        private void ClearElement()
        {
            if (Element != null)
            {
                foreach (var elementChild in Element.Children)
                {
                    var rendererChild = Platform.GetRenderer(elementChild);
                    rendererChild?.View?.RemoveFromParent();
                    Platform.SetRenderer(elementChild, null);
                }
                if (_currentPage != null)
                {
                    IVisualElementRenderer renderer = Platform.GetRenderer(_currentPage);

                    if (renderer != null)
                    {
                        renderer.View?.RemoveFromParent();
                        _currentPage = null;
                    }
                }

                if (_bottomBar != null)
                {
                    _bottomBar.RemoveFromParent();
                    _bottomBar.Dispose();
                    _bottomBar = null;
                }
            }
        }
Exemple #3
0
        void ReleaseDesignerOutlets()
        {
            if (BottomBar != null)
            {
                BottomBar.Dispose();
                BottomBar = null;
            }

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

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

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

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

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

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

            if (UserName != null)
            {
                UserName.Dispose();
                UserName = null;
            }
        }
        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();
                    }

                    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);
        }
Exemple #5
0
        private void ClearElement(IndexPage element)
        {
            if (_currentPage != null)
            {
                IVisualElementRenderer renderer = Platform.GetRenderer(_currentPage);

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

                    _currentPage = null;
                }

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