Пример #1
0
        public static Account GetAccount(string id)
        {
            var values = ApplicationData.Current.LocalSettings.Values;
            var value  = (ApplicationDataCompositeValue)values[id];

            if (value == null)
            {
                return(null);
            }

            Account account;

            switch ((Carrier)(byte)value["CR"])
            {
            case Carrier.ZZ:
                account = new ZZAccount(id);
                break;

            case Carrier.Bite:
                account = new BiteAccount(id);
                break;

            case Carrier.OKarte:
                account = new OAccount(id);
                break;

            default: return(null);
            }

            account.Caption         = (string)value["CN"];
            account.RefreshInterval = TimeSpan.FromMinutes((double)value["RI"]);

            LoadBalances(account);
            return(account);
        }
Пример #2
0
        public static async Task <BiteAccount> Login(ProperHttpClient client, string number, string password)
        {
            var response = await CallService <BiteLogin>(client, 102, new BiteRequest {
                method  = "authPassword",
                @params = new Dictionary <string, string>(2)
                {
                    { "password", password },
                    { "msisdn", "371" + number }
                }
            });

            if (response == null)
            {
                return(null);
            }
            var account = new BiteAccount(null);

            account.Token = response.result.securityKey;
            System.Diagnostics.Debug.WriteLine("Bite token " + account.Token);
            return(account);
        }