//After pressing "Add ingrediens" button, there will be open new window private void buttonAddIngrediens_Click(object sender, EventArgs e) { FormIngrediens dlg = new FormIngrediens(currRecipe, numOfIngrediens); int selectedIndex = listBoxRecipes.SelectedIndex; if (selectedIndex >= 0) { Recipe editingRecipe = recipeMngr.GetRecipeAt(selectedIndex); dlg.showIngredients(editingRecipe); } DialogResult dlgResult = dlg.ShowDialog(); printAllRecipes(); }
//Open new window to add ingredients to recipe private void ButtonAddIngrediens_Click(object sender, EventArgs e) { FormIngrediens dlg = new FormIngrediens(currentRecipe, numberOfIngrediens); int selectedIndex = listBoxRecipes.SelectedIndex; if (selectedIndex >= 0) { Recipe editingRecipe = recipeManager.GetRecipeAt(selectedIndex); dlg.ShowIngredients(editingRecipe); } _ = dlg.ShowDialog(); ShowAllRecipes(); }