/// <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); } }
public FoodForm(Recepie recepie) { InitializeComponent(); Recepie = recepie; }
public FoodForm() { InitializeComponent(); Recepie = new Recepie(); }