private void OnCloseRecipeDetailTabExecute(IRecipeDetailViewModel?recipeDetailViewModel) { if (recipeDetailViewModel is not null) { // TODO: Check if the Detail has changes and ask user to cancel RecipeDetailViewModels.Remove(recipeDetailViewModel); } }
private void OnCloseRecipeDetailTabExecute(object parameter) { if (parameter is IRecipeDetailViewModel recipeDetailViewModel) { // TODO: Check if the Detail has changes and ask user to cancel RecipeDetailViewModels.Remove(recipeDetailViewModel); } }
private void OnRecipeDeleted(DeleteMessage <RecipeWrapper> message) { var recipe = RecipeDetailViewModels.SingleOrDefault(i => i.Model.Id == message.Id); if (recipe != null) { RecipeDetailViewModels.Remove(recipe); } }
private void SelectRecipe(Guid id) { var recipeDetailViewModel = RecipeDetailViewModels.SingleOrDefault(vm => vm.Model.Id == id); if (recipeDetailViewModel == null) { recipeDetailViewModel = _recipeDetailViewModelFactory.Create(); RecipeDetailViewModels.Add(recipeDetailViewModel); recipeDetailViewModel.Load(id); } SelectedRecipeDetailViewModel = recipeDetailViewModel; }
private void SelectRecipe(Guid?id) { if (id is null) { SelectedRecipeDetailViewModel = null; } else { var recipeDetailViewModel = RecipeDetailViewModels.SingleOrDefault(vm => vm.Model?.Id == id); if (recipeDetailViewModel == null) { recipeDetailViewModel = _recipeDetailViewModelFactory.Create(); RecipeDetailViewModels.Add(recipeDetailViewModel); recipeDetailViewModel.LoadAsync(id.Value); } SelectedRecipeDetailViewModel = recipeDetailViewModel; } }