Example #1
0
 public async Task<bool> GetReferrals(int page = 1)
 {
     if (page == 1)
     {
         _page = page;
     }
     var pair = new[]
     {
         new KeyValuePair{Content = "100", Name = "page_size"},
         new KeyValuePair{Content = page, Name = "page"}
     };
     Tools.Tools.SetProgressIndicator(true);
     SystemTray.ProgressIndicator.Text = AppResources.ProgressRetrievingReferrals;
     using (var client = new VikingsApi())
     {
         client.GetInfoFinished += client_GetReferralFinished;
         OAuthUtility.ComputeHash = (key, buffer) =>
         {
             using (var hmac = new HMACSHA1(key))
             {
                 return hmac.ComputeHash(buffer);
             }
         };
         await client.GetInfo(new AccessToken((string)IsolatedStorageSettings.ApplicationSettings["tokenKey"], (string)IsolatedStorageSettings.ApplicationSettings["tokenSecret"]), client.Referrals, pair, Cts);
     }
     return true;
 }
Example #2
0
 public async Task<bool> GetUsage(DateTime fromDate, DateTime untilDate, int page = 1)
 {
     if (page == 1)
     {
         _page = page;
         _date1 = fromDate;
         _date2 = untilDate;
         Usage = null;
     }
     var pair = new[]
     {
         new KeyValuePair{Content = Msisdn, Name = VikingApi.Json.Usage.Msisdn},
         new KeyValuePair{Content = fromDate.ToVikingApiTimeFormat(), Name = VikingApi.Json.Usage.FromDate},
         new KeyValuePair{Content = untilDate.ToVikingApiTimeFormat(), Name = VikingApi.Json.Usage.UntilDate},
         new KeyValuePair{Content = "100", Name = VikingApi.Json.Usage.PageSize},
         new KeyValuePair{Content = page, Name = VikingApi.Json.Usage.Page},
     };
     Tools.Tools.SetProgressIndicator(true);
     SystemTray.ProgressIndicator.Text = AppResources.ProgressRetrievingUsage;
     var client = new VikingsApi();
     client.GetInfoFinished += client_GetInfoFinished;
     OAuthUtility.ComputeHash = (key, buffer) =>
     {
         using (var hmac = new HMACSHA1(key))
         {
             return hmac.ComputeHash(buffer);
         }
     };
     await client.GetInfo(new AccessToken((string)IsolatedStorageSettings.ApplicationSettings["tokenKey"], (string)IsolatedStorageSettings.ApplicationSettings["tokenSecret"]), client.Usage, pair, Cts);
     return true;
 }
Example #3
0
 public async Task<bool> GetData(string msisdn)
 {
     Tools.Tools.SetProgressIndicator(true);
     SystemTray.ProgressIndicator.Text = AppResources.ProgressFetchingData;
     using (var client = new VikingsApi())
     {
         client.GetInfoFinished += client_GetDataFinished;
         OAuthUtility.ComputeHash = (key, buffer) =>
         {
             using (var hmac = new HMACSHA1(key))
             {
                 return hmac.ComputeHash(buffer);
             }
         };
         await client.GetInfo(new AccessToken((string)IsolatedStorageSettings.ApplicationSettings["tokenKey"], (string)IsolatedStorageSettings.ApplicationSettings["tokenSecret"]), client.Balance, new KeyValuePair { Name = "msisdn", Content = msisdn }, Cts);
     }
     return true;
 }
Example #4
0
 public async Task<bool> GetSimInfo()
 {
     Tools.Tools.SetProgressIndicator(true);
     SystemTray.ProgressIndicator.Text = AppResources.ProgressLoadingSims;
     using (var client = new VikingsApi())
     {
         client.GetInfoFinished += client_GetSimInfoFinished;
         OAuthUtility.ComputeHash = (key, buffer) =>
         {
             using (var hmac = new HMACSHA1(key))
             {
                 return hmac.ComputeHash(buffer);
             }
         };
         await client.GetInfo(new AccessToken((string)IsolatedStorageSettings.ApplicationSettings["tokenKey"], (string)IsolatedStorageSettings.ApplicationSettings["tokenSecret"]), client.Sim, new KeyValuePair { Content = "1", Name = "alias" }, Cts);
     }return true;
 }
Example #5
0
 public async Task<bool> GetLinks()
 {
     Tools.Tools.SetProgressIndicator(true);
     SystemTray.ProgressIndicator.Text = AppResources.ProgressFetchingLinks;
     using (var client = new VikingsApi())
     {
         client.GetInfoFinished += client_GetLinksFinished;
         OAuthUtility.ComputeHash = (key, buffer) =>
         {
             using (var hmac = new HMACSHA1(key))
             {
                 return hmac.ComputeHash(buffer);
             }
         };
         await client.GetInfo(new AccessToken((string)IsolatedStorageSettings.ApplicationSettings["tokenKey"], (string)IsolatedStorageSettings.ApplicationSettings["tokenSecret"]), client.Links, Cts);
     }
     return true;
 }