async Task ExecuteLoadItemsCommand() // Will load the items in this section { if (IsBusy) { return; } IsBusy = true; try { PaymentItems.Clear(); // Get Paymethods from the Logged in user ListPaymentItems = App.LoggedInUser.Payments; var paymentitems = ListPaymentItems; foreach (var paymethod in paymentitems) { PaymentItems.Add(paymethod); } } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
private void OnRefreshCommandExecute() { switch (SelectedTab) { case ClaimsTabIndex: AppService.ReloadClaims(); break; case DownloadsTabIndex: var worker = new BackgroundWorker(); worker.DoWork += (i, j) => { var list = AppService.GetDownloads(); DispatcherHelper.CheckBeginInvokeOnUI(() => { DownloadItems.Clear(); foreach (var item in list) { DownloadItems.Add(item); } }); }; worker.RunWorkerAsync(); break; case PaymentsTabIndex: worker = new BackgroundWorker(); worker.DoWork += (i, j) => { var list = AppService.GetPayments(); DispatcherHelper.CheckBeginInvokeOnUI(() => { PaymentItems.Clear(); foreach (var item in list) { PaymentItems.Add(item); } }); }; worker.RunWorkerAsync(); break; default: throw new ArgumentOutOfRangeException(); } }