Beispiel #1
0
 void OnAddingDish(object sender, DishEventArgs args)
 {
     try
     {
         _model.AddDish(args.dish);
     }
     catch (Exception)
     {
         throw new FormatException("Couldn't add dish");
     }
 }
Beispiel #2
0
        private void btnAddDish_Click(object sender, EventArgs e)
        {
            Dish newDish = new Dish(menu.Dishes.Count + 1, tbDishName.Text, int.Parse(tbDishTime.Text), DishWeight);

            newDish.ingridients = SelectedIngredients;
            DishEventArgs args = new DishEventArgs();

            args.dish = newDish;
            try
            {
                AddingDish(this, args);
            }catch (FormatException q)
            {
                MessageBox.Show(q.Message);
            }
            RefreshingMenu(this, EventArgs.Empty);
            refreshMenu();
            clearAll();
        }