Example #1
0
 public async Task<bool> GetData(string msisdn)
 {
     try
     {
         Tools.Tools.SetProgressIndicator(true);
         SystemTray.ProgressIndicator.Text = "fetching data";
         var client = new VikingsApi();
         OAuthUtility.ComputeHash = (key, buffer) =>
         {
             using (var hmac = new HMACSHA1(key))
             {
                 return hmac.ComputeHash(buffer);
             }
         };
         string json = await client.GetInfo(new AccessToken((string) IsolatedStorageSettings.ApplicationSettings["tokenKey"], (string) IsolatedStorageSettings.ApplicationSettings["tokenSecret"]), client.Balance, new KeyValuePair {name = "msisdn", content = msisdn});
         if (Error.HandleError(json, "there seems to be no connection"))
             return false;
         Tools.Tools.SetProgressIndicator(false);
         Balance = new UserBalance(json);
         return true;
     }
     catch (Exception)
     {
         Message.ShowToast("Could not load bundle info, please try again later");
         return false;
     }
 }
Example #2
0
 public MainPivotViewmodel()
 {
     Balance = new UserBalance();
 }