// private methods private async void AddCategory() { var category = new Category(); var dialog = new ContentDialogCategories($"Add {CategoryName}", category); var result = await dialog.ShowAsync(); if (result == ContentDialogResult.Primary) { MainModelView.Current.AddCategory(category, categories); } }
private async Task AddProvier() { var category = new Category(); var dialog = new ContentDialogCategories("Add Ingredient Provider", category); var result = await dialog.ShowAsync(); if (result == ContentDialogResult.Primary) { MainModelView.Current.AddCategory(category, MainModelView.Current.IngredientProviders); } }
private async void EditCategory() { if (!(this.ListViewMain.SelectedItem is Category category)) { return; } string oldName = category.Name; var dialog = new ContentDialogCategories($"Edit {CategoryName}", category); var result = await dialog.ShowAsync(); if (result == ContentDialogResult.Primary) { MainModelView.Current.UpdateCategory(category, categories, oldName); } }