예제 #1
0
 protected void OnGetSimInfoFinished(GetInfoCompletedArgs args)
 {
     if (GetBalanceInfoFinished != null)
     {
         GetSimInfoFinished(this, args);
     }
 }
예제 #2
0
 private async void client_GetInfoFinished(object sender, GetInfoCompletedArgs args)
 {
     switch (args.Canceled)
     {
         case true:
             Tools.Tools.SetProgressIndicator(false);
             break;
         case false:
             if (string.IsNullOrEmpty(args.Json))
                 return;
             if (!string.Equals(args.Json, "[]"))
             {
                 try
                 {
                     Usage = (_page == 1) ? JsonConvert.DeserializeObject<Usage[]>(args.Json) : Usage.Concat(JsonConvert.DeserializeObject<Usage[]>(args.Json));
                     await GetUsage(_date1, _date2, ++_page);
                 }
                 catch (Exception)
                 {
                     Tools.Tools.SetProgressIndicator(false);
                     return;
                 }
                 return;
             }
             Tools.Tools.SetProgressIndicator(false);
             break;
     }
     OnGetInfoFinished(args);
 }
예제 #3
0
 protected void OnGetReferralFinished(GetInfoCompletedArgs args)
 {
     if (GetReferralFinished != null)
     {
         GetReferralFinished(this, args);
     }
 }
예제 #4
0
 protected void OnGetLinksFinished(GetInfoCompletedArgs args)
 {
     if (GetLinkFinished != null)
     {
         GetLinkFinished(this, args);
     }
 }
예제 #5
0
 private async void SimViewmodel_GetReferralFinished(object sender, GetInfoCompletedArgs args)
 {
     if(args.Canceled)
         return;
     RefreshListBox();
     ReferralViewer.Visibility = Visibility.Visible;
     Tools.Tools.SetProgressIndicator(false);
     await App.Viewmodel.ProfileViewmodel.GetLinks();
 }
예제 #6
0
 private async void SimViewmodelOnGetInfoFinished(object sender, GetInfoCompletedArgs args)
 {
     if (args.Canceled)
         return;
     RefreshListBox();
     TopUpViewer.Visibility = Visibility.Visible;
     Tools.Tools.SetProgressIndicator(false);
     await App.Viewmodel.SimViewmodel.GetPlan();
 }
예제 #7
0
 private async void SimViewmodel_GetPlanInfoFinished(object sender, GetInfoCompletedArgs args)
 {
     if(args.Canceled)
         return;
     PlanTextBlock.Text = App.Viewmodel.SimViewmodel.Plan.Name;
     RefreshListBoxPlan();
     PricePlan.Visibility = Visibility.Visible;
     Tools.Tools.SetProgressIndicator(false);
     await App.Viewmodel.SimViewmodel.GetSimInfo();
 }
예제 #8
0
 private async void SimViewmodelOnGetStatsFinished(object sender, GetInfoCompletedArgs args)
 {
     if (args.Canceled)
         return;
     Remaining.Text = App.Viewmodel.ProfileViewmodel.Stats.UnusedPoints.ToString();
     Used.Text = App.Viewmodel.ProfileViewmodel.Stats.UsedPoints.ToString();
     Waiting.Text = App.Viewmodel.ProfileViewmodel.Stats.WaitingPoints.ToString();
     Topups.Text = App.Viewmodel.ProfileViewmodel.Stats.Topupsused.ToString();
     Earned.Text = App.Viewmodel.ProfileViewmodel.Stats.EarnedPoints.ToString();
     Tools.Tools.SetProgressIndicator(false);
     StatsPanel.Visibility = Visibility.Visible;
     await App.Viewmodel.ProfileViewmodel.GetReferrals();
 }
예제 #9
0
 void SimViewmodel_GetSimInfoFinished(object sender, GetInfoCompletedArgs args)
 {
     if (args.Canceled)
         return;
     CardNumber.Text = App.Viewmodel.SimViewmodel.Card.CardNumber;
     Pin1.Text = App.Viewmodel.SimViewmodel.Card.Pin1;
     Pin2.Text = App.Viewmodel.SimViewmodel.Card.Pin2;
     Puk1.Text = App.Viewmodel.SimViewmodel.Card.Puk1;
     Puk2.Text = App.Viewmodel.SimViewmodel.Card.Puk2;
     IMSI.Text = App.Viewmodel.SimViewmodel.Card.Imsi;
     CardPanel.Visibility = Visibility.Visible;
     Tools.Tools.SetProgressIndicator(false);
 }
예제 #10
0
 void client_GetSimInfoFinished(object sender, GetInfoCompletedArgs args)
 {
     switch (args.Canceled)
     {
         case true:
             Tools.Tools.SetProgressIndicator(false);
             break;
         case false:
             if (string.IsNullOrEmpty(args.Json) || string.Equals(args.Json, "[]"))
                 return;
             try
             {
                 Sims = JsonConvert.DeserializeObject<Sim[]>(args.Json);
             }
             catch (Exception)
             {
                 Tools.Tools.SetProgressIndicator(false);
                 return;
             }
             Tools.Tools.SetProgressIndicator(false);
             break;
     }
     OnGetSimInfoFinished(args);
 }
예제 #11
0
 void client_GetDataFinished(object sender, GetInfoCompletedArgs args)
 {
     switch (args.Canceled)
     {
         case true:
             Tools.Tools.SetProgressIndicator(false);
             break;
         case false:
             if (string.IsNullOrEmpty(args.Json) || string.Equals(args.Json, "[]"))
                 return;
             try
             {
                 Balance.Load(args.Json);
             }
             catch (Exception)
             {
                 Tools.Tools.SetProgressIndicator(false);
                 return;
             }
             Tools.Tools.SetProgressIndicator(false);
             break;
     }
     OnGetBalanceInfoFinished(args);
 }
예제 #12
0
 void client_GetSimInfoFinished(object sender, GetInfoCompletedArgs args)
 {
     switch (args.Canceled)
     {
         case true:
             Tools.Tools.SetProgressIndicator(false);
             break;
         case false:
             if (string.IsNullOrEmpty(args.Json) || string.Equals(args.Json, "[]"))
                 return;
             try
             {
                 var sims = JsonConvert.DeserializeObject<Sim[]>(args.Json);
                 Deployment.Current.Dispatcher.BeginInvoke(() =>
                 {
                     Sims.Clear();
                     foreach (var sim in sims)
                     {
                         Sims.Add(sim.msisdn);
                     }
                     ShowHideDefaultSim(Sims.Count() > 1);
                     _starting = false;
                 });
                 
             }
             catch (Exception e)
             {
                 Tools.Tools.SetProgressIndicator(false);
             }
             break;
     }
 }
예제 #13
0
        public async Task<bool> GetInfo(AccessToken token, string path, CancellationTokenSource cts)
        {
            var args = new GetInfoCompletedArgs();
            if (NetworkInterface.NetworkInterfaceType == NetworkInterfaceType.None)
            {
                args.Canceled = true;
                OnGetInfoFinished(args);
                return true;
            }
            try
            {
                using (var client = OAuthUtility.CreateOAuthClient(ConsumerKey, ConsumerSecret, token))
                {
                    if (!Cts.Token.IsCancellationRequested)
                    {
                        using (Cts.Token.Register(() => client.CancelPendingRequests()))
                        {

                            args.Json = await client.GetStringAsync(BaseUrl + path);
                            args.Canceled = false;
                        }
                        OnGetInfoFinished(args);
                    }
                }
            }
            catch (Exception)
            {
                CancelTask();
                args.Canceled = true;
                OnGetInfoFinished(args);
            }
            return true;
        }
예제 #14
0
 private void client_GetPlanInfoFinished(object sender, GetInfoCompletedArgs args)
 {
     switch (args.Canceled)
     {
         case true:
             Tools.Tools.SetProgressIndicator(false);
             break;
         case false:
             if (string.IsNullOrEmpty(args.Json))
                 return;
             if (!string.Equals(args.Json, "[]"))
             {
                 try
                 {
                     Plan = JsonConvert.DeserializeObject<PricePlan>(args.Json);
                 }
                 catch (Exception)
                 {
                     Tools.Tools.SetProgressIndicator(false);
                     return;
                 }
             }
             break;
     }
     OnGetPlanInfoFinished(args);
 }
예제 #15
0
 private void DetailsViewmodel_GetInfoFinished(object sender, GetInfoCompletedArgs args)
 {
     if (args.Canceled)
         return;
     if (_calendar)
     {
         ResetAppbar();
     }
     _calendar = false;
     RefreshListBox();
     Viewer.IsEnabled = true;
     Viewer.Visibility = Visibility.Visible;
     if (App.Viewmodel.UsageViewmodel.Usage == null)
     {
         Message.ShowToast(AppResources.ToastNoDataForPeriod);
         return;
     }
     Viewer.ScrollIntoView(App.Viewmodel.UsageViewmodel.Usage.ElementAt(0));
 }
예제 #16
0
 void SimViewmodel_GetLinksFinished(object sender, GetInfoCompletedArgs args)
 {
     if (args.Canceled)
         return;
     ((ApplicationBarIconButton)ApplicationBar.Buttons[1]).IsEnabled = true;
     Tools.Tools.SetProgressIndicator(false);
 }