示例#1
0
        public async Task ExecuteLoadPaymentTypesAsync()
        {
            try
            {
                IsBusy = true;

                PaymentTypeList.Clear();

                List <PaymentType> listPaymentType = _userSettings.GetPaymentTypesLocal();
                if (listPaymentType == null)
                {
                    listPaymentType = await _expenseTrackerService.GetPaymentTypeListAsync();
                }

                foreach (PaymentType pt in listPaymentType)
                {
                    PaymentTypeList.Add(pt.Name);
                }
            }
            catch (Exception ex)
            {
                await base.ShowErrorMessageAsync("Error getting payment type list : " + ex.Message);
            }
            finally
            {
                IsBusy = false;
            }
        }
示例#2
0
        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();
        }