void PresentFamilyPage_Internal(Rock.Client.Family family) { // display the view controller. Ignore requests to re-view the same family (which we key off the ID to know) if (CurrentFamilyInfoViewController == null || CurrentFamilyInfoViewController.Family.Id != family.Id) { // first, clear out whatever our current is, because that's changing CurrentFamilyInfoViewController = null; // now, see if this family is already in a controller within the stack foreach (UIViewController controller in SubNavigationController.ChildViewControllers) { // is it a match? FamilyInfoViewController currController = controller as FamilyInfoViewController; if (currController != null && currController.Family == family) { // then pop to it, and take it as our current reference SubNavigationController.PopToViewController(currController, true); CurrentFamilyInfoViewController = currController; break; } } // if this is still null, it isn't in our stack, so we can go ahead and push a new one. if (CurrentFamilyInfoViewController == null) { CurrentFamilyInfoViewController = new FamilyInfoViewController(this, family); SubNavigationController.PushViewController(CurrentFamilyInfoViewController, true); } HomeButton.Enabled = true; AddFamilyButton.Enabled = true; } }
public void ActivateTask(Task task) { // reset our stack and remove all current view controllers // before changing activities SubNavigationController.ClearViewControllerStack( ); if (CurrentTask != null) { CurrentTask.MakeInActive( ); } _CurrentTask = task; CurrentTask.MakeActive(SubNavigationController, SubNavToolbar, View.Bounds); }
public override void ViewDidLoad() { base.ViewDidLoad(); // First setup the SpringboardReveal button, which rests in the upper left // of the MainNavigationUI. (We must do it here because the ContainerViewController's // NavBar is the active one.) NSString buttonLabel = new NSString(""); HomeButton = new UIButton(UIButtonType.System); HomeButton.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont("Bh", 36); HomeButton.SetTitle(buttonLabel.ToString( ), UIControlState.Normal); HomeButton.SetTitleColor(Theme.GetColor(Config.Instance.VisualSettings.TopHeaderTextColor), UIControlState.Normal); HomeButton.SetTitleColor(UIColor.DarkGray, UIControlState.Disabled); // determine its dimensions CGSize buttonSize = buttonLabel.StringSize(HomeButton.Font); HomeButton.Bounds = new CGRect(0, 0, buttonSize.Width, buttonSize.Height); // set its callback HomeButton.TouchUpInside += (object sender, EventArgs e) => { // clear any current family VC CurrentFamilyInfoViewController = null; // reset our stack SubNavigationController.PopToRootViewController(true); SubNavigationController.View.SetNeedsLayout( ); // turn off the home button HomeButton.Enabled = false; // and enable the add family button AddFamilyButton.Enabled = true; }; // set the "Add Family" button buttonLabel = new NSString(""); AddFamilyButton = new UIButton(UIButtonType.System); AddFamilyButton.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont("Bh", 36); AddFamilyButton.SetTitle(buttonLabel.ToString( ), UIControlState.Normal); AddFamilyButton.SetTitleColor(Theme.GetColor(Config.Instance.VisualSettings.TopHeaderTextColor), UIControlState.Normal); AddFamilyButton.SetTitleColor(UIColor.DarkGray, UIControlState.Disabled); // determine its dimensions buttonSize = buttonLabel.StringSize(HomeButton.Font); AddFamilyButton.Bounds = new CGRect(0, 0, buttonSize.Width, buttonSize.Height); // set its callback AddFamilyButton.TouchUpInside += (object sender, EventArgs e) => { // clear any current family VC CurrentFamilyInfoViewController = null; // and present a new family page PresentNewFamilyPage( ); }; UIBarButtonItem[] leftItems = new UIBarButtonItem[] { new UIBarButtonItem(HomeButton), new UIBarButtonItem(AddFamilyButton) }; this.NavigationItem.SetLeftBarButtonItems(leftItems, false); CreateSubNavigationController( ); SearchFamiliesViewController = new SearchFamiliesViewController(this); SubNavigationController.PushViewController(SearchFamiliesViewController, true); HomeButton.Enabled = false; SettingsViewController = new SettingsViewController(this); // set our theme CoreViewController.ApplyTheme(this); }