Esempio n. 1
0
        public async Task Initialization()
        {
            IsProgressShow = true;
            RaisePropertyChanged(nameof(IsProgressShow));

            try
            {
                await _model.UpdateOperations(GetCancellationToken());
            }
            catch
            {
                _toastService.ShowNotification("SoS", _localizationService.GetTranslateByKey(Localization.OopsError));
            }

            Operations.Clear();

            foreach (var operation in _model.Operations)
            {
                Operations.Add(new OperationListViewItemViewModel(operation, _localizationService));
            }


            IsProgressShow = false;

            RaisePropertyChanged(nameof(IsProgressShow));
            RaisePropertyChanged(nameof(CanNextButtonClick));
            RaisePropertyChanged(nameof(CanPreviousButtonClick));
        }
Esempio n. 2
0
        public async Task Initialization()
        {
            IsProgressShow = true;
            RaisePropertyChanged(nameof(IsProgressShow));

            try
            {
                await _model.UpdateUser(GetCancellationToken());
            }
            catch
            {
                _toastService.ShowNotification("SoS", _localizationService.GetTranslateByKey(Localization.OopsError));
            }

            Email    = _model.Email;
            Currency = _model.Currency;
            UserName = _model.Login;

            RaisePropertyChanged(nameof(Email));
            RaisePropertyChanged(nameof(Currency));
            RaisePropertyChanged(nameof(UserName));
            RaisePropertyChanged(nameof(IsDarkModeEnabled));

            IsProgressShow = false;
            RaisePropertyChanged(nameof(IsProgressShow));
        }
Esempio n. 3
0
        public async void OnLoaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            var token = GetCancellationToken();

            try
            {
                await Model.UpdateData(token);

                await Model.UpdateAccounts(!Model.IsNew, token);

                await Model.UpdateCategories(!Model.IsNew, token);
            }
            catch
            {
                _toastService.ShowNotification("SoS", _localizationService.GetTranslateByKey(Localization.OopsError));
            }

            Accounts = Model.Accounts;

            if (IsExpense)
            {
                Categories = Model.Categories.Where(c => c.Type == CategoryType.Expense).ToList();
            }

            if (IsIncome)
            {
                Categories = Model.Categories.Where(c => c.Type == CategoryType.Income).ToList();
            }

            RaisePropertyChanged(nameof(Accounts));
            RaisePropertyChanged(nameof(Categories));

            _selectedFromAccount = Accounts.FirstOrDefault(a => a.Id == Model.AccountId);
            _selectedCategory    = Categories.FirstOrDefault(c => c.Id == Model.CategoryId);
            _selectedToAccount   = Accounts.FirstOrDefault(a => a.Id == Model.ToAccountId);

            RaisePropertyChanged(nameof(SelectedFromAccount));
            RaisePropertyChanged(nameof(SelectedCategory));
            RaisePropertyChanged(nameof(SelectedToAccount));
        }
Esempio n. 4
0
        private async Task UpdateCategories()
        {
            try
            {
                await _model.UpdateCategories(GetCancellationToken());
            }
            catch
            {
                _toastService.ShowNotification("SoS", _localizationService.GetTranslateByKey(Localization.OopsError));
            }

            List.Clear();

            foreach (var account in _model.Categories)
            {
                List.Add(new CategoryListViewItemViewModel(account, _localizationService));
            }
        }
Esempio n. 5
0
        private async Task UpdateAccounts()
        {
            try
            {
                await _model.UpdateAccounts(GetCancellationToken());
            }
            catch
            {
                _toastService.ShowNotification("SoS", _localizationService.GetTranslateByKey(Localization.OopsError));
            }

            List.Clear();

            foreach (var account in _model.Accounts)
            {
                List.Add(new AccountListViewItemViewModel(account, _localizationService));
            }

            TotalBalanceTitle = $"{_model.TotalAmount} {_model.CurrencyBase}";
            RaisePropertyChanged(nameof(TotalBalanceTitle));
        }
Esempio n. 6
0
        public async Task Initialization()
        {
            IsProgressShow = true;
            RaisePropertyChanged(nameof(IsProgressShow));

            try
            {
                await _model.UpdateReports(GetCancellationToken());
            }
            catch
            {
                _toastService.ShowNotification("SoS", _localizationService.GetTranslateByKey(Localization.OopsError));
            }

            ExpenseReport = new ReportViewModel(_model.ExpenseReport, _localizationService.GetTranslateByKey(Localization.Expense));
            IncomeReport  = new ReportViewModel(_model.IncomeReport, _localizationService.GetTranslateByKey(Localization.Income));

            RaisePropertyChanged(nameof(ExpenseReport));
            RaisePropertyChanged(nameof(IncomeReport));

            IsProgressShow = false;
            RaisePropertyChanged(nameof(IsProgressShow));
        }