protected void OnGetInfoFinished(GetInfoCompletedArgs args) { if (GetInfoFinished != null) { GetInfoFinished(this, args); } }
private void client_GetSimInfoFinished(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 { Card = JsonConvert.DeserializeObject <SimCard>(args.Json); } catch (Exception) { Tools.Tools.SetProgressIndicator(false); return; } } break; } OnGetSimInfoFinished(args); }
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); }
void client_GetDataFinished(object sender, GetInfoCompletedArgs args) { if (args.Canceled) { SetTile(true, "unavailable"); return; } if (string.IsNullOrEmpty(args.Json) || string.Equals(args.Json, "[]")) { return; } try { _balance.Load(args.Json); SetTile(false, string.Empty); } catch (Exception) { SetTile(true, "error"); } #if (DEBUG) Debug.WriteLine("Live tile: Tile has been updated"); #endif _running = false; }
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); }
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; } }
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); }
void SimViewmodel_GetLinksFinished(object sender, GetInfoCompletedArgs args) { if (args.Canceled) { return; } ((ApplicationBarIconButton)ApplicationBar.Buttons[1]).IsEnabled = true; Tools.Tools.SetProgressIndicator(false); }
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(); }
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(); }
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(); }
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(); }
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); }
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)); }