Ejemplo n.º 1
0
        /// <summary>
        /// Shows the <see cref="NewIngredientDialog"/> when the <see cref="AddIngredientButton"/> is clicked.
        /// </summary>
        /// <param name="sender"><see cref="AddIngredientButton"/></param>
        /// <param name="e">Event arguments</param>
        private void AddIngredient_Click(object sender, RoutedEventArgs e)
        {
            NewIngredientDialog newIngredientDialog = new NewIngredientDialog(
                true,
                this.HandleDialogClosing);

            this.ShowDialog(newIngredientDialog);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Displays the <see cref="NewIngredientDialog"/>, when an existing ingredient in the <see cref="AllIngredientsListBox"/> is double clicked.
        /// </summary>
        /// <param name="sender"><see cref="AllIngredientsListBox"/></param>
        /// <param name="e"> event arguments</param>
        private void AllIngredientsListBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            // casting the SelectedItem within the ingredients listbox to an Ingredient (from a basic object) and storing the casted
            // value in a newly declared local Ingredient typed variable named 'ingredient'.
            Ingredient          ingredient          = this.AllIngredientsListBox.SelectedItem as Ingredient;
            NewIngredientDialog newIngredientDialog = new NewIngredientDialog(
                ingredient,
                this.HandleQuantityDialogClosing);

            this.ShowDialog(newIngredientDialog);
        }