示例#1
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);
 }
示例#2
0
        public void UserInputReceived(Order userOrder, double newSimulationSpeed = -1, int scenarioId = -1)
        {
            switch (userOrder)
            {
            case Order.LaunchSimulation:
                Console.WriteLine("Début simu");
                new Thread(delegate()
                {
                    StartSimulation();
                }).Start();
                break;

            case Order.StartNewScenario:
                Console.WriteLine("Début scenario " + scenarioId);
                new Thread(delegate()
                {
                    ExecuteScenario(startingScenarioId);
                }).Start();
                break;

            case Order.PauseSimulation:
                simulationClock.PauseSimulation();
                break;

            case Order.UnpauseSimulation:
                simulationClock.UnpauseSimulation();
                break;

            case Order.ChangeSimulationSpeed:
                simulationClock.ChangeSimulationSpeed(newSimulationSpeed);
                break;

            default:
                break;
            }
        }