public void NavigateToTab(ENavigationTabs tabToNavigate, bool needRefreshAreas = false) { if (!(Activity is MainActivity)) { return; } if (needRefreshAreas && tabToNavigate == ENavigationTabs.FEED) { (Activity as MainActivity).SetFeedCurrentTabWithRefresh(); return; } if (tabToNavigate == ENavigationTabs.FEED) { (Activity as MainActivity).SetRequiredCurrentTab(0); } if (tabToNavigate == ENavigationTabs.POINTS) { (Activity as MainActivity).SetRequiredCurrentTab(1); } if (tabToNavigate == ENavigationTabs.REWARDS) { (Activity as MainActivity).SetRequiredCurrentTab(2); } if (tabToNavigate == ENavigationTabs.CHALLENGES) { (Activity as MainActivity).SetRequiredCurrentTab(3); } if (tabToNavigate == ENavigationTabs.MORE) { (Activity as MainActivity).SetRequiredCurrentTab(4); } }
//public void SwapInViewController(string storyboard, string viewController, ENavigationTabs tab, bool animated = true) //{ // if (TabLookUp != null) // { // int index = TabLookUp[tab]; // SwapInViewController(storyboard, viewController, index, animated); // } // else // Debug.WriteLine(@"Attempted to swapin tab by enum before tablookup built, make sure to build before calling or swap in by index if cant build before"); //} //public override void ItemSelected(UITabBar tabbar, UITabBarItem item) //{ // if (this.ViewControllers[2].GetType() != typeof(RewardCollectionViewController)) // { // UIViewController parentController = Platform.RootViewController; // if (parentController?.GetType() == typeof(SLNavigationController)) // { // var child = parentController.ChildViewControllers[0]; // (child as MainViewController).SwapInViewController("Rewards", "RewardCollectionViewController", ENavigationTabs.REWARDS); // return; // } // } //} //void SwapInViewController(string storyboard, string viewController, int index, bool animated = true) //{ // UIViewController[] controllers = this.ViewControllers; // if (0 <= index && index < controllers.Length) // { // UIStoryboard board = UIStoryboard.FromName(storyboard, null); // if (board != null) // { // UIViewController controller = (UIViewController)board.InstantiateViewController(viewController); // if (controller != null) // { // Debug.WriteLine(@"Starting Swap in " + storyboard + " " + viewController + " at " + index); // controller.TabBarItem = controllers[index].TabBarItem; // controller.Title = controllers[index].Title; // controllers[index] = controller; // this.SetViewControllers(controllers, animated); // Debug.WriteLine(@"Completed Swap in " + storyboard + " " + viewController + " at " + index); // } // } // } //} //public void SwapInViewController(UIViewController controller, int index, bool animated = true) //{ // UIViewController[] controllers = this.ViewControllers; // if (0 <= index && index < controllers.Length) // { // if (controller != null) // { // Debug.WriteLine(@"Starting Swap in " + controller.Title + " at " + index); // controller.TabBarItem = controllers[index].TabBarItem; // controller.Title = controllers[index].Title; // controllers[index] = controller; // this.SetViewControllers(controllers, animated); // Debug.WriteLine(@"Completed Swap in " + controller.Title + " at " + index); // } // } //} public void SelectTab(ENavigationTabs tab) { if (TabLookUp != null) { this.SelectedIndex = TabLookUp[tab]; } else { Debug.WriteLine(@"Attempted to select tab by type befre tablookup table exists"); } }
public void NavigateToTab(ENavigationTabs tabToNavigate, bool needRefreshAreas = false) { }
public void NavigateToTab(ENavigationTabs tabToNavigate) { }
private void NavigateByAction(string storyboardName, string viewControllerName, ENavigationTabs tabToNavigate) { UIStoryboard storyboard = UIStoryboard.FromName(storyboardName, null); Platform.PreselectedMainViewTab = tabToNavigate; SLNavigationController parentController = Platform.RootViewController as SLNavigationController; if (parentController != null) //if (parentController?.GetType() == typeof(SLNavigationController)) { var child = parentController.ChildViewControllers[0]; (child as MainViewController).SelectedIndex = (int)tabToNavigate; PopToViewControllerIfNeeded(child as MainViewController); return; } parentController = Platform.TopViewController as SLNavigationController; if (parentController != null) //if (parentController?.GetType() == typeof(SLNavigationController)) { var child = parentController.ChildViewControllers[0]; (child as MainViewController).SelectedIndex = (int)tabToNavigate; PopToViewControllerIfNeeded(child as MainViewController); return; } SLNavigationController viewController = storyboard.InstantiateViewController(viewControllerName) as SLNavigationController; parentController.PresentViewController(viewController, false, null); }
private void NavigateByAction(string storyboardName, string viewControllerName, ENavigationTabs tabToNavigate) { _platformNavigationService.NavigateToTab(tabToNavigate); }