void Main(string[] args) { Model theModel = new Model(); //assigning OnStartRun event/handler from simulation to a method in the model class theSimulation.OnStartSimulation += new StartSimulationHandler(SimulationStart); //assigning OnStartRun event/handler from simulation to a method in the model class theSimulation.OnStartRun += new StartRunHandler(RunStart); //assigning OnFinishRun event/handler from simulation to a method in the model class theSimulation.OnFinishRun += new FinishRunHandler(RunFinished); //assigning OnFinishSimulation event/handler from simulation to a method in the model class theSimulation.OnFinishSimulation += new FinishSimulationHandler(SimulationFinish); //assigning OnCompletionThreePhases event/handler from simulation to a method in the model class //theSimulationOnCompleteThreePhases += new CompleteThreePhasesHandler (CompletionThreePhases); theSimulation.EntityAndResourceManager.AddEntity(emergencyArrivalMachine); theSimulation.EntityAndResourceManager.AddEntity(electiveArrivalMachine); theSimulation.EntityAndResourceManager.AddResource(beds); theSimulation.EventAndActivityManager.AddEvent(emergencyArrive); theSimulation.EventAndActivityManager.AddEvent(electiveArrive); theSimulation.EventAndActivityManager.AddEvent(emergencyEndOccupyBed); theSimulation.EventAndActivityManager.AddEvent(electiveEndOccupyBed); theSimulation.EventAndActivityManager.AddActivity(emergencyBeginOccupyBed); theSimulation.EventAndActivityManager.AddActivity(electiveBeginOccupyBed); theModel.SettingSimulationParameters(); theModel.SettingEmergencyPatientGroup(); theModel.SettingElectivePatientGroup(); theModel.SettingCareUnit(); Console.WriteLine("******** Critical Care Unit Model version 1.0 *********"); Console.WriteLine("* *"); Console.WriteLine("* (using ThreePhaseSharpLib version 2.0) *"); Console.WriteLine("* *"); Console.WriteLine("* by Andre X. Costa *"); Console.WriteLine("* July 2017 *"); Console.WriteLine("*******************************************************"); Console.WriteLine(); string reply = ""; bool exit = false; do { Console.WriteLine("*******************************************************"); Console.WriteLine(" Options: "); Console.WriteLine(" "); Console.WriteLine(" R (or r): Run Simulation and View Results on screen "); Console.WriteLine(" X (or x): Exit program "); Console.WriteLine(" "); Console.Write(" Enter your option and press <Enter>: "); reply = Console.ReadLine(); if (reply.Length > 0) { reply = reply.Substring(0, 1).ToUpper(); } if (reply == "R") { try { Console.WriteLine("*******************************************************"); Console.WriteLine(); Console.WriteLine("======================================================="); Console.WriteLine("Simulation Results"); Console.WriteLine("======================================================="); Console.WriteLine(); Console.WriteLine("Run Duration: {0} hours (365 days)", RunDuration); Console.WriteLine("Number of Runs: {0}", NumberOfRuns); Console.WriteLine(); theSimulation.Run(); } catch (Exception ex) { Console.WriteLine(ex.Message); } } else if (reply == "X") { Console.WriteLine("*******************************************************"); Console.WriteLine(); exit = true; } else { Console.WriteLine(" Invalid Option! "); Console.WriteLine("*******************************************************"); } } while (!exit); }