Esempio n. 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);
        }
Esempio n. 2
0
        public static async Task <OAccount> Login(ProperHttpClient client, string number, string password)
        {
            // Ar pieteikšanos pietiktu numura un paroles pārbaudei, bet vajag atsijāt pastāvīgā pieslēguma īpašniekus, jo tiem atlikums izskatās savādāk un pašlaik netiek atbalstīts.
            var balance = await GetBalance(client, number, password);

            if (balance == null)
            {
                return(null);
            }
            var account = new OAccount(null)
            {
                Token             = number + password,
                Balance           = balance,
                balanceSetInLogin = true
            };

            return(account);
        }