Example #1
0
        Section MakeAccounts()
        {
            var section = new Section(Locale.GetText("Accounts"));

            lock (Database.Main){
                foreach (var account in Database.Main.Query <TwitterAccount> ("SELECT * from TwitterAccount"))
                {
                    var copy    = account;
                    var element = new AccountElement(account);
                    element.Tapped += delegate {
                        DismissModalViewControllerAnimated(true);

                        TwitterAccount.SetDefault(copy);
                        AppDelegate.MainAppDelegate.Account = copy;
                    };
                    section.Add(element);
                }
                ;
            }
            var addAccount = new StringElement(Locale.GetText("Add account"));

            addAccount.Tapped += delegate {
                AppDelegate.MainAppDelegate.AddAccount(this, delegate {
                    DismissModalViewControllerAnimated(false);
                });
            };
            section.Add(addAccount);
            return(section);
        }
Example #2
0
        public void SetDefaultAccount(OAuthAuthorizer oauth)
        {
            var newAccount = TwitterAccount.Create(oauth);

            TwitterAccount.SetDefault(newAccount);
            Account = newAccount;
        }