public async Task ExecuteLoadCategoriesAsync() { try { IsBusy = true; CategoryList.Clear(); List <Category> listCat = _userSettings.GetCategoriesLocal(); if (listCat == null) { listCat = await _expenseTrackerService.GetCategoryListAsync(); } foreach (Category cat in listCat) { CategoryList.Add(cat.Name); } } catch (Exception ex) { await base.ShowErrorMessageAsync("Error getting category list : " + ex.Message); } finally { IsBusy = false; } }
public async Task ExecuteRefreshCachedLists() { IsBusy = true; try { _userSettings.SetCategoriesLocal(await _expenseTrackerService.GetCategoryListAsync()); _userSettings.SetPaymentTypesLocal(await _expenseTrackerService.GetPaymentTypeListAsync()); await base.ShowMessageAsync("Cached Lists Updated!"); } catch (Exception ex) { _telemetry.LogError("ExecuteRefreshCachedLists error", ex); await base.ShowErrorMessageAsync("Error."); } finally { IsBusy = false; } }
public async void OnNavigatedTo(NavigationParameters parameters) { categories = _userSettings.GetCategoriesLocal(); if (categories == null) { categories = await _expenseTrackerService.GetCategoryListAsync(); _userSettings.SetCategoriesLocal(categories); } paymentTypes = _userSettings.GetPaymentTypesLocal(); if (paymentTypes == null) { paymentTypes = await _expenseTrackerService.GetPaymentTypeListAsync(); _userSettings.SetPaymentTypesLocal(paymentTypes); } await ExecuteLoadExpensesAsync(); Xamarin.Forms.DependencyService.Get <IKeyboardHelper>().HideKeyboard(); }