コード例 #1
0
        public void ServeFood(int tableNumber)
        {
            StartAction("Sert les plats à la table " + tableNumber, 2);
            Table tableToServe = diningRoom.Tables.Find(t => t.TableNumber == tableNumber);

            tableToServe.LastTimeOrderWasTakenCareOf = SimulationClock.GetInstance().SimulationDateTime;
            //List<Plate> platesReadyToServe = diningRoom.Countertop.PlatesToServe;
            //foreach (var plate in pTS)
            //{
            //    diningRoom.Countertop.Orders.First(x => x.Orders.Values.ToList()
            //    .ForEach(i => { if (i.DishName.Equals(plate.Dish.DishName) && x.CourseType.Equals(plate.Dish.CourseType)) { pTS.Remove(plate); } }));
            //}
            foreach (var order in tableToServe.OrderedDishes.Where(x => x.CourseType == tableToServe.NextCourseToServe))
            {
                lock (Countertop.LockObjPlatesToServe)
                {
                    foreach (var plat in diningRoom.Countertop.PlatesToServe)
                    {
                        if (order.DishName == plat.Dish.DishName)
                        {
                            tableToServe.ServedFood.Add(plat);
                            diningRoom.Countertop.PlatesToServe.Remove(plat);
                            break;
                        }
                    }
                }
            }
            tableToServe.NextCourseToServe++;
            EndAction();
            //Passer au CourseType suivant
        }
コード例 #2
0
        public void TakeOrders(int tableNumber)
        {
            StartAction("Prend les commandes à la table " + tableNumber, 1);
            Table table = diningRoom.Tables.First(x => x.TableNumber == tableNumber);

            foreach (var customer in table.SeatedCustomers)
            {
                customer.ChooseRecipes(table.OrderedDishes);
            }
            GiveOrdersToKitchen(tableNumber);
            table.LastTimeOrderWasTakenCareOf = SimulationClock.GetInstance().SimulationDateTime;
            EndAction();
        }
コード例 #3
0
 public ControllerFacade(IModel model, IView view)
 {
     this.model      = model;
     this.view       = view;
     simulationClock = SimulationClock.GetInstance();
     simulationClock.ChangeSimulationSpeed(RealSecondsFor1MinuteInSimulation);
     while (view.MainWindow?.settings?.parameters == null)
     {
     }
     model.DiningRoom.Countertop.SubscribeToNewPlateIsReady(this);
     view.MainWindow.SubscribeToUserInputObserve(this);
     view.MainWindow.settings.parameters.SubscribeToParametersConfigured(this);
     SimulationTimeOfServiceStart = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 19, 0, 0);
 }