Esempio n. 1
0
        protected virtual void OnRemoveRequested(NavigationRequestedEventArgs e)
        {
            var page = e.Page;

            var renderer       = Platform.GetRenderer(page);
            var viewController = renderer?.ViewController;

            if (viewController == null && _trackers.ContainsKey(page))
            {
                viewController = _trackers[page].ViewController;
            }

            if (viewController != null)
            {
                if (viewController == TopViewController)
                {
                    e.Animated = false;
                    OnPopRequested(e);
                }

                if (ViewControllers.Contains(viewController))
                {
                    ViewControllers = ViewControllers.Remove(viewController);
                }

                DisposePage(page);
            }
        }
Esempio n. 2
0
        void DisposePage(IPage page, bool calledFromDispose = false)
        {
            if (_trackers.TryGetValue(page, out var tracker))
            {
                if (!calledFromDispose && tracker.ViewController != null && ViewControllers.Contains(tracker.ViewController))
                {
                    ViewControllers = ViewControllers.Remove(_trackers[page].ViewController);
                }

                _trackers.Remove(page);
            }
        }
Esempio n. 3
0
 public nfloat OffsetForChildViewController(UIViewController viewController)
 {
     if (!ViewControllers.Contains(viewController))
     {
         //Throw exception view controller not contained in tab strip
         throw new ViewControllerNotFoundException("The view controller is not contained in the tab strip");
     }
     else
     {
         int index = Array.IndexOf(ViewControllers, viewController);
         return(OffsetForChildIndex((uint)index));
     }
 }
Esempio n. 4
0
 public override UIViewController[] PopToViewController(UIViewController viewController, bool animated)
 {
     if (VisibleViewController != viewController)
     {
         regularPop = TopViewController != viewController;
         if (ViewControllers.Contains(viewController))
         {
             return(base.PopToViewController(viewController, animated));
         }
         else
         {
             return(PopToRootViewController(animated));
         }
     }
     return(null);
 }
Esempio n. 5
0
        void DisposePage(Page page, bool calledFromDispose = false)
        {
            if (_trackers.TryGetValue(page, out var tracker))
            {
                if (!calledFromDispose && tracker.ViewController != null && ViewControllers.Contains(tracker.ViewController))
                {
                    ViewControllers = ViewControllers.Remove(_trackers[page].ViewController);
                }

                tracker.Dispose();
                _trackers.Remove(page);
            }


            var renderer = Platform.GetRenderer(page);

            if (renderer != null)
            {
                renderer.Dispose();
                page.ClearValue(Platform.RendererProperty);
            }
        }