public void AddCategory() { var dialog = new ActionCategoryInput(); dialog.Closing += (sender, args) => { if (dialog.DataContext is CategoryInputViewModel vm && vm.PocketCategory.Id > 0) { PocketCategories.Add(vm.PocketCategory); SelectedPocketCategory = vm.PocketCategory; } }; dialog.ShowDialogWindow(new CategoryInputViewModel(dialog), mWindow); }
public void LoadPocketCategories() { using var db = new AppDbContext(); PocketCategories = db.PocketCategories.ToObservableCollection(); SelectedPocketCategory = PocketCategories.FirstOrDefault(); }