private void SubmitOrderButton_Click(object sender, EventArgs e) { var res = new List <String>(); foreach (ListViewItem item in Bucket.Items) { res.Add(item.SubItems[0].Text); } Bucket.Items.Clear(); Bucket.Refresh(); res.Remove(res[res.Count - 1]); var order = formLogic.CreateOrder(res.ToArray()); kitchen.AddOrder(order); textB.Text = kitchen.GetOrders()[0].GetDishesS(); if (FormLogic.isKitchenStarted) { kitchen.Continue(order); } else { kitchen.SetTimePoint(); kitchen.Start(); FormLogic.KitchenStarted(); } }
public static List <Order> DeserializeList(string lines, Kitchen kitchen) { var orderList = new List <Order>(); string[] splittedLines = lines.Split('\n'); foreach (var line in splittedLines) { if (line != "") { string[] splittedLine = line.Split('-'); Order order = new Order(int.Parse(splittedLine[0])); string[] dishesLines = splittedLine[1].Split(','); foreach (var dishLine in dishesLines) { if (dishLine != "") { var newdish = DeserializeDish(dishLine, kitchen); order.AddDish(newdish); } } orderList.Add(order); } } kitchen.AddOrder(orderList.ToArray()); return(orderList); }