Beispiel #1
0
        /// <summary>
        /// btnAddRecipe click handler, calls the addRecipe form
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddRecipe_Click(object sender, RoutedEventArgs e)
        {
            AddRecipe addRecipe = new AddRecipe();

            addRecipe.ShowDialog();
            refreshRecipies();
        }
Beispiel #2
0
        //opens the edit recipe window and allows user to edit the recipe before printing

        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            AddRecipe addRecipe = new AddRecipe(recipe.RecipeId);

            addRecipe.labelNewRecipe.Content = "Edit Recipe";
            addRecipe.Title = "Edit Recipe";
            var result = addRecipe.ShowDialog();

            //if user edits recipe the load recipe method is called so that the recipe will be updated in display window
            loadRecipe(recipe.RecipeId);
        }
Beispiel #3
0
 /// <summary>
 /// btnUpdateRecipe click handler, calls the addRecipe form and passes the selected recipe ID to be updated
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnUpdateRecipe_Click(object sender, RoutedEventArgs e)
 {
     if (dgRecipes.SelectedItem != null)
     {
         AddRecipe addRecipe = new AddRecipe((dgRecipes.SelectedItem as dynamic).RecipeId);
         addRecipe.labelNewRecipe.Content = "Edit Recipe";
         addRecipe.Title = "Edit Recipe";
         addRecipe.ShowDialog();
         refreshRecipies();
     }
     else
     {
         MessageBox.Show("Please select a recipe to update.", "Update Recipe");
     }
 }
Beispiel #4
0
 // method called when an item is selected from the Recipe Carousel and the user try to edit this item
 private void EditRecipeButton_Click(object sender, RoutedEventArgs e)
 {
     if (RecipesCarousel.SelectedItem != null)
     {
         AddRecipe addRecipe = new AddRecipe((RecipesCarousel.SelectedItem as MediaData).Id);
         addRecipe.labelNewRecipe.Content = "Edit Recipe";
         addRecipe.Title = "Edit Recipe";
         addRecipe.ShowDialog();
         refreshRecipies();
     }
     else
     {
         MessageBox.Show("Please select a recipe to update.", "Update Recipe");
     }
 }