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); } }
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); } }
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)); } }
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); }
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); } }