예제 #1
0
        /// <summary>
        /// Shows the FoodForm and stores the recepie in the manager and displays it.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnAddFood_Click(object sender, RoutedEventArgs e)
        {
            var food = new FoodForm();

            food.ShowDialog();
            if (food.DialogResult.HasValue && food.DialogResult.Value)
            {
                Recepie newRecepie = new Recepie();
                newRecepie.Name        = food.Recepie.Name;
                newRecepie.Ingredients = food.Recepie.Ingredients;
                recepieManager.Add(newRecepie);
            }
            lstRecepie.Items.Clear();
            foreach (var item in recepieManager.ToStringList())
            {
                lstRecepie.Items.Add(item);
            }
        }
예제 #2
0
 public FoodForm(Recepie recepie)
 {
     InitializeComponent();
     Recepie = recepie;
 }
예제 #3
0
 public FoodForm()
 {
     InitializeComponent();
     Recepie = new Recepie();
 }