Beispiel #1
0
        private static void Init()
        {
            if (Account == null)
            {
                if (AccountStore == null)
                {
                    AccountStore = Xamarin.Auth.AccountStore.Create();
                }

                if (AccountStore == null)
                {
                    throw new Exception("Account Store not Supported");
                }

                try
                {
                    Account = AccountStore.FindAccountsForService(APP_NAME_KEY).FirstOrDefault();
                }
                catch
                {
                    Account = null;
                }

                if (Account == null)
                {
                    Account = new Xamarin.Auth.Account
                    {
                        Username = USERNAME_FOR_SS
                    };

                    AccountStore.Save(Account, APP_NAME_KEY);
                }
            }
        }
Beispiel #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.

            Xamarin.Auth.AccountStore accountStore = Xamarin.Auth.AccountStore.Create();
            var accounts = accountStore.FindAccountsForService("someid");

            return;
        }
        public List <Account> FindAccountsForService(string serviceId)
        {
            IEnumerable <Xamarin.Auth.Account> xaccounts = xAccountStore.FindAccountsForService(serviceId);
            List <Account> accounts = new List <Account>();

            foreach (Xamarin.Auth.Account xaccount in xaccounts)
            {
                accounts.Add(new Account(xaccount, xaccount.Properties, xaccount.Username));
            }
            return(accounts);
        }