Example #1
0
        public async void OnAddCategoryClick(object sender, RoutedEventArgs e)
        {
            var newCategory    = new CategoryDialogViewModel(_model.CreateNewCategory());
            var categoryDialog = new CategoryDialog(newCategory)
            {
                PrimaryButtonText = _localizationService.GetTranslateByKey(Localization.Save),
                CloseButtonText   = _localizationService.GetTranslateByKey(Localization.Cancel)
            };

            await categoryDialog.ShowAsync();

            if (categoryDialog.Result == DialogResult.Save)
            {
                await _model.SaveCategory(newCategory.Model, GetCancellationToken());
                await UpdateCategories();
            }
        }