コード例 #1
0
 private void dgRecipeList_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if ((Recipe)dgRecipeList.SelectedItem != null)
     {
         var detailForm = new frmCreateRecipe((Recipe)dgRecipeList.SelectedItem, _user);
         var result     = detailForm.ShowDialog();
         _recipes = _recipeManager.RetrieveAllRecipes();
         dgRecipeList.ItemsSource = _recipes;
     }
     else
     {
         MessageBox.Show("You must select a recipe first.");
     }
 }
コード例 #2
0
        /// <summary>
        /// Jared Greenfield
        /// Created: 2019/02/07
        ///
        /// Allows the user to create a new Recipe.
        /// </summary>
        private void BtnCreateRecipe_Click(object sender, RoutedEventArgs e)
        {
            var createForm = new frmCreateRecipe(_user);
            var result     = createForm.ShowDialog();

            if (result == true)
            {
                MessageBox.Show("Recipe created.");
            }
            else
            {
                MessageBox.Show("Recipe creation cancelled or failed.");
            }
            try
            {
                setupBrowsePage();
            }
            catch (Exception ex)
            {
                MessageBox.Show("There was an error updating the page: " + ex.Message);
            }
        }