public NavigationRenderer() : base(typeof(FormsNavigationBar), null) { MessagingCenter.Subscribe<IVisualElementRenderer>(this, UpdateToolbarButtons, sender => { if (!ViewControllers.Any()) return; var parentingViewController = (ParentingViewController)ViewControllers.Last(); parentingViewController?.UpdateLeftBarButtonItem(); }); }
public NavigationRenderer() { MessagingCenter.Subscribe <IVisualElementRenderer>(this, UpdateToolbarButtons, sender => { if (!ViewControllers.Any()) { return; } var parentingViewController = (ParentingViewController)ViewControllers.Last(); UpdateLeftBarButtonItem(parentingViewController); }); }
public override void ViewDidLoad() { base.ViewDidLoad(); if (!ViewControllers.Any()) { return; } var parentingViewController = ViewControllers.Last(); UpdateLeftBarButton(parentingViewController); }
public virtual bool CloseChildViewModel(IMvxViewModel viewModel, MvxBasePresentationAttribute attribute) { if (!ViewControllers.Any()) { return(false); } var toClose = ViewControllers.ToList() .Select(v => v.GetIMvxIosView()) .FirstOrDefault(mvxView => mvxView.ViewModel == viewModel); if (toClose != null) { var newStack = ViewControllers.Where(v => v.GetIMvxIosView() != toClose); ViewControllers = newStack.ToArray(); return(true); } return(false); }
public virtual bool CloseTabViewModel(IMvxViewModel viewModel) { if (ViewControllers == null || !ViewControllers.Any()) { return(false); } // loop through plain Tabs var plainToClose = ViewControllers.Where(v => !(v is UINavigationController)) .Select(v => v.GetIMvxTvosView()) .FirstOrDefault(mvxView => mvxView.ViewModel == viewModel); if (plainToClose != null) { RemoveTabController((UIViewController)plainToClose); return(true); } // loop through nav stack Tabs UIViewController toClose = null; foreach (var vc in ViewControllers.Where(v => v is UINavigationController)) { var root = ((UINavigationController)vc).ViewControllers.FirstOrDefault(); var vcFromRoot = root.GetIMvxTvosView(); if (root != null && vcFromRoot.ViewModel == viewModel) { toClose = root; break; } } if (toClose != null) { RemoveTabController((UIViewController)toClose); return(true); } return(false); }
private void ReloadViewControllers() { if (DataSource == null) { throw new NullReferenceException("DataSource cannot be null"); } else { ViewControllers = DataSource.ViewControllersForPagerTabStrip(this); // viewControllers if (!ViewControllers.Any()) { throw new Exception("ViewControllersForPagerTabStrip should provide at least one child view controller"); } foreach (UIViewController childController in ViewControllers) { if (!(childController is IIndicatorInfoProvider)) { throw new Exception("Every view controller provided by PagerTabStripDataSource's viewControllersForPagerTabStrip method must conform to InfoProvider"); } } } }
public virtual void PushView(IMXView view) { PushViewController(TouchFactory.GetNativeObject <UIViewController>(view, "view"), ViewControllers.Any(vc => !(vc is VanityView))); }