Exemple #1
0
        private void Logout()
        {
            Application.Account.Delete();
            Application.SetUser(null);

            var login = new GitHubLoginController();
            login.LoginComplete = (a) => {
                Application.SetUser(a);
                login.DismissViewController(true, () => {
                    NavigationController.PushViewController(new MyGistsController(), true);
                });
            };
            PresentViewController(new UINavigationController(login), true, null);
        }
Exemple #2
0
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);
            var root = new RootElement(Title);

            var accountSection = new Section("Accounts");

            root.Add(accountSection);
            foreach (var account in Application.Accounts)
            {
                var thisAccount = account;
                var t           = new AccountElement(thisAccount);
                t.Tapped += () => {
                    Application.SetUser(thisAccount);
                    DismissModalViewControllerAnimated(true);
                };

                //Check to see if this account is the active account. Application.Account could be null
                //so make it the target of the equals, not the source.
                if (thisAccount.Equals(Application.Account))
                {
                    t.Accessory = UITableViewCellAccessory.Checkmark;
                }
                accountSection.Add(t);
            }

            var addAccount = new StyledElement("Add Account", () => {
                var ctrl           = new GitHubLoginController();
                ctrl.LoginComplete = (a) => NavigationController.PopToViewController(this, true);
                NavigationController.PushViewController(ctrl, true);
            });

            //addAccount.Image = Images.CommentAdd;
            accountSection.Add(addAccount);

            var supportSection = new Section("Support");

            root.Add(supportSection);
            supportSection.Add(new StyledElement("Feedback & Support", OpenUserVoice));

            var aboutSection = new Section("About", "Thank you for downloading. Enjoy!");

            root.Add(aboutSection);
            aboutSection.Add(new StyledElement("Follow On Twitter", () => UIApplication.SharedApplication.OpenUrl(new NSUrl("https://twitter.com/Codebucketapp"))));
            aboutSection.Add(new StyledElement("Rate This App", () => UIApplication.SharedApplication.OpenUrl(new NSUrl("https://itunes.apple.com/us/app/codebucket/id551531422?mt=8"))));
            aboutSection.Add(new StyledElement("App Version", NSBundle.MainBundle.InfoDictionary.ValueForKey(new NSString("CFBundleVersion")).ToString()));

            //Assign the root
            Root = root;
        }
Exemple #3
0
        /// <summary>
        /// Processes the accounts.
        /// </summary>
        public void ProcessAccounts()
        {
            //There's no accounts...
            if (GetDefaultAccount() == null)
            {
                var login = new GitHubLoginController { LoginComplete = delegate { ShowMainWindow(); }};

                //Make it so!
                _window.RootViewController = new UINavigationController(login);
            }
            else
            {
                ShowMainWindow();
            }
        }
Exemple #4
0
        private void Logout()
        {
            Application.Account.Delete();
            Application.SetUser(null);

            var login = new GitHubLoginController();

            login.LoginComplete = (a) => {
                Application.SetUser(a);
                login.DismissViewController(true, () => {
                    NavigationController.PushViewController(new MyGistsController(), true);
                });
            };
            PresentViewController(new UINavigationController(login), true, null);
        }
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);
			var root = new RootElement(Title);

            var accountSection = new Section("Accounts");
			root.Add(accountSection);
            foreach (var account in Application.Accounts)
            {
                var thisAccount = account;
				var t = new AccountElement(thisAccount);
                t.Tapped += () => { 
                    Application.SetUser(thisAccount);
                    DismissModalViewControllerAnimated(true);
                };
                
				//Check to see if this account is the active account. Application.Account could be null 
				//so make it the target of the equals, not the source.
                if (thisAccount.Equals(Application.Account))
                    t.Accessory = UITableViewCellAccessory.Checkmark;
                accountSection.Add(t);
            }

            var addAccount = new StyledElement("Add Account", () => {
				var ctrl = new GitHubLoginController();
				ctrl.LoginComplete = (a) => NavigationController.PopToViewController(this, true);
				NavigationController.PushViewController(ctrl, true);
			});
            //addAccount.Image = Images.CommentAdd;
            accountSection.Add(addAccount);

            var supportSection = new Section("Support");
			root.Add (supportSection);
            supportSection.Add(new StyledElement("Feedback & Support", OpenUserVoice));

            var aboutSection = new Section("About", "Thank you for downloading. Enjoy!");
			root.Add(aboutSection);
            aboutSection.Add(new StyledElement("Follow On Twitter", () => UIApplication.SharedApplication.OpenUrl(new NSUrl("https://twitter.com/Codebucketapp"))));
            aboutSection.Add(new StyledElement("Rate This App", () => UIApplication.SharedApplication.OpenUrl(new NSUrl("https://itunes.apple.com/us/app/codebucket/id551531422?mt=8"))));
            aboutSection.Add(new StyledElement("App Version", NSBundle.MainBundle.InfoDictionary.ValueForKey(new NSString("CFBundleVersion")).ToString()));

			//Assign the root
			Root = root;
        }