/// <summary> /// Processes the accounts. /// </summary> protected async override void ProcessAccounts() { var defaultAccount = GetDefaultAccount(); //There's no accounts... or something bad has happened to the default if (Application.Accounts.Count == 0 || defaultAccount == null) { var login = new AccountTypeViewController(); login.NavigationItem.LeftBarButtonItem = null; var navCtrl = new CustomNavigationController(this, login); Transitions.TransitionToController(navCtrl); return; } //Don't remember, prompt for password if (defaultAccount.DontRemember) { ShowAccountsAndSelectedUser(defaultAccount); } //If the user wanted to remember the account else { try { await Utils.Login.LoginAccount(defaultAccount, this); } catch (Exception e) { //Wow, what a surprise that there's issues using await and a catch here... MonoTouch.Utilities.ShowAlert("Error".t(), e.Message, () => ShowAccountsAndSelectedUser(defaultAccount)); } } }
/// <summary> /// Processes the accounts. /// </summary> protected override void ProcessAccounts() { var defaultAccount = GetDefaultAccount(); //There's no accounts... or something bad has happened to the default if (Application.Accounts.Count == 0 || defaultAccount == null) { var login = new LoginViewController(); login.NavigationItem.LeftBarButtonItem = null; login.Login = (username, password) => { Utils.Login.LoginAccount(username, password, login); }; var navCtrl = new CustomNavigationController(this, login); Transitions.TransitionToController(navCtrl); return; } //Don't remember, prompt for password if (defaultAccount.DontRemember) { ShowAccountsAndSelectedUser(defaultAccount.Username); } //If the user wanted to remember the account else { Utils.Login.LoginAccount(defaultAccount.Username, defaultAccount.Password, this, (ex) => { ShowAccountsAndSelectedUser(defaultAccount.Username); }); } }
/// <summary> /// Presents login screen using the specified <paramref name="viewController"/>. /// </summary> /// <param name="viewController">Used to present login screen.</param> public static void Activate(UIViewController viewController) { var loginScreen = new LoginViewController(new TCredentialsProvider(), new TMessages()); var navigationController = new CustomNavigationController(loginScreen); loginScreen.SetCompletionHandler(() => navigationController.DismissViewController(true, null)); viewController.PresentViewController(navigationController, true, null); }
private void ShowAccountsAndSelectedUser(GitHubAccount account) { var accountsController = new AccountsViewController(); accountsController.NavigationItem.LeftBarButtonItem = null; var login = new LoginViewController(account); var navigationController = new CustomNavigationController(this, accountsController); navigationController.PushViewController(login, false); Transitions.TransitionToController(navigationController); }
private void ShowAccountsAndSelectedUser(string user) { var accountsController = new AccountsController(); accountsController.NavigationItem.LeftBarButtonItem = null; var login = new LoginViewController { Username = user }; login.Login = (username, password) => { Utils.Login.LoginAccount(username, password, login); }; var navigationController = new CustomNavigationController(this, accountsController); navigationController.PushViewController(login, false); Transitions.TransitionToController(navigationController); }
public override void ViewDidLoad() { base.ViewDidLoad(); this.View.BackgroundColor = UIColor.White; this.Title = "Custom Navigation Bar"; if (this.NavigationController != null && this.NavigationController is CustomNavigationController) { NavController = (CustomNavigationController)this.NavigationController; NavController.ActiveNavigationBarTitle = "Choose Menu Items"; this.NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Add, DidSelectShow); } }
protected UINavigationController CreateNavigationController(UIColor color) { var navigationController = new CustomNavigationController(color); return(navigationController); }