/// <summary> /// Return coressponding page with name of selected button /// </summary> /// <param name="selectedButton"> Current selected button </param> /// <returns></returns> private Page getPageFromButton(Button selectedButton) { Page result = new HomePage(); if (selectedButton.Name == homePageButton.Name) { result = new HomePage(); ((HomePage)result).ShowRecipeDetailPage += MainScreen_ShowRecipeDetailPage; } else if (selectedButton.Name == favPageButton.Name) { result = new HomePage(true); ((HomePage)result).ShowRecipeDetailPage += MainScreen_ShowRecipeDetailPage; } else if (selectedButton.Name == addRecipePageButton.Name) { result = new AddRecipePage(); ((AddRecipePage)result).BackToHome += MainScreen_BackToHome; } else if (selectedButton.Name == shoppingPageButton.Name) { result = new ShoppingPage(); } else if (selectedButton.Name == helpPageButton.Name) { result = new HelpPage(); } else if (selectedButton.Name == aboutPageButton.Name) { result = new AboutPage(); } return(result); }
private void add_recipe_Click(object sender, EventArgs e) { AddRecipePage Recipe_Form = new AddRecipePage(); Recipe_Form.Show(); }