// method called when an item is selected from the Recipe Carousel private void ViewRecipeButton_Click(object sender, RoutedEventArgs e) { if (RecipesCarousel.SelectedItem != null) { PrintRecipe printRecipe = new PrintRecipe((RecipesCarousel.SelectedItem as MediaData).Id); printRecipe.ShowDialog(); } }
// method called when an item is selected from the Recipe Carousel private void InspectRecipe(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { if (RecipesCarousel.SelectedItem != null) // checking if there is a selected item { // creates a new instance of the PrintRecipe page PrintRecipe printRecipe = new PrintRecipe((RecipesCarousel.SelectedItem as MediaData).Id); printRecipe.ShowDialog(); // show the Print Recipe with all the data about the recipe refreshRecipies(); } }
//This method calls a new window that displays the selected recipe private void btnPrintRecipe_Click(object sender, RoutedEventArgs e) { if (dgRecipes.SelectedItem != null) { PrintRecipe printRecipe = new PrintRecipe((dgRecipes.SelectedItem as dynamic).RecipeId); string recipeName = (dgRecipes.SelectedItem as dynamic).Name; printRecipe.Title = recipeName; printRecipe.ShowDialog(); } else { MessageBox.Show("Please select a recipe to print.", "Print Recipe"); } }