Пример #1
0
        protected override void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            if (disposing)
            {
                var viewsToLookAt = new FormsStack <NSView>(Subviews);
                while (viewsToLookAt.Count > 0)
                {
                    var view             = viewsToLookAt.Pop();
                    var viewCellRenderer = view as ViewCellNSView;
                    if (viewCellRenderer != null)
                    {
                        viewCellRenderer.RemoveFromSuperview();
                        viewCellRenderer.Dispose();
                    }
                    else
                    {
                        foreach (var child in view.Subviews)
                        {
                            viewsToLookAt.Push(child);
                        }
                    }
                }
            }
            _disposed = true;

            base.Dispose(disposing);
        }
Пример #2
0
        protected override void Dispose(bool disposing)
        {
            if (disposing && _insetTracker != null)
            {
                _insetTracker.Dispose();
                _insetTracker = null;

                var viewsToLookAt = new FormsStack <UIView>(Subviews);
                while (viewsToLookAt.Count > 0)
                {
                    var view             = viewsToLookAt.Pop();
                    var viewCellRenderer = view as ViewCellRenderer.ViewTableCell;
                    if (viewCellRenderer != null)
                    {
                        viewCellRenderer.Dispose();
                    }
                    else
                    {
                        foreach (var child in view.Subviews)
                        {
                            viewsToLookAt.Push(child);
                        }
                    }
                }
            }

            base.Dispose(disposing);
        }
Пример #3
0
        static void FrameBeginBody(
            string name,
            string id,
            int line)
        {
            if (!Stopwatch.IsRunning)
            {
                Stopwatch.Start();
            }

            Stack.Push(new Profile(name, id, line));
        }
        async Task <bool> AddPage(Page page, bool animated)
        {
            if (page == null)
            {
                throw new ArgumentNullException(nameof(page));
            }

            Page oldPage = null;

            if (_currentStack.Count >= 1)
            {
                oldPage = _currentStack.Peek().Page;
            }

            _currentStack.Push(new NavigationChildPageWrapper(page));

            var vc = CreateViewControllerForPage(page);

            vc.SetElementSize(new Size(View.Bounds.Width, View.Bounds.Height));
            page.Layout(new Rectangle(0, 0, View.Bounds.Width, View.Frame.Height));

            if (_currentStack.Count == 1 || !animated)
            {
                vc.NativeView.WantsLayer = true;
                AddChildViewController(vc.ViewController);
                View.AddSubview(vc.NativeView);
                if (oldPage != null)
                {
                    HideView(Platform.GetRenderer(oldPage)?.ViewController);
                }
                return(true);
            }
            var vco = Platform.GetRenderer(oldPage);

            AddChildViewController(vc.ViewController);

            var transitionStyle = NavigationPage.OnThisPlatform().GetNavigationTransitionPushStyle();

            return(await this.HandleAsyncAnimation(vco.ViewController, vc.ViewController,
                                                   ToViewControllerTransitionOptions(transitionStyle), () =>
            {
                HideView(vco.ViewController);
                page?.SendAppearing();
            }, true));
        }