public void UpdateMenu(object send, EventArgs e) { Console.WriteLine("Menu Update"); ObjectEventArgs oe = (ObjectEventArgs)e; List <Recipe> AllAvailableRecipe = (List <Recipe>)oe.receiveObject; List <Recipe> Starter = AllAvailableRecipe.Where(o => o.Type == RecipeType.STARTER).ToList(); List <Recipe> Main = AllAvailableRecipe.Where(o => o.Type == RecipeType.MAIN).ToList(); List <Recipe> Dessert = AllAvailableRecipe.Where(o => o.Type == RecipeType.DESSERT).ToList(); this.Menu[0] = Starter; this.Menu[1] = Main; this.Menu[2] = Dessert; }
public void Receive(string datas) { Console.WriteLine("Reception"); datas = datas.Substring(0, datas.Length - 5); if (datas.IndexOf("<MENU>") > -1) { datas = datas.Substring(0, datas.Length - "<MENU>".Length); ObjectEventArgs args = new ObjectEventArgs(datas, typeof(List <Recipe>)); OnMenuReception(args); } else if (datas.IndexOf("<ORDER_READY>") > -1) { ObjectEventArgs args = new ObjectEventArgs(datas, typeof(Order)); OnOrderReadyReception(args); } }