Пример #1
0
        public void StartSimulation(int counterAmount)
        {
            //Add terminals with their destination
            terminals.Add(new Terminal("Terminal1", "CPH"));
            terminals.Add(new Terminal("Terminal2", "STO"));
            terminals.Add(new Terminal("Terminal3", "LDN"));

            FlightScheduler scheduler = new FlightScheduler(terminals);
            scheduler.CreateSchedules();

            //Add amount of counters requested
            for (int i = 1; i <= counterAmount; i++)
            {
                counters.Add(new Counter("Counter" + i, splitter));
            }

            //Start threads and add them to thread list
            foreach (var item in counters)
            {
                threads.Add(item.Start());
                //Subscribe to event
                item.LuggageCreated += Counter_LuggageCreated;
            }
            //Start terminal threads, and subscribe to event
            foreach (var item in terminals)
            {
                threads.Add(item.Start());
                item.PlaneDepartured += Item_PlaneDepartured;
                item.PlaneWaiting += Item_PlaneWaiting;
            }
        }
Пример #2
0
 public Terminal(string name, string dest)
 {
     this.name        = name;
     this.Destination = dest;
     //Set capacity
     IncomingLuggage = new Queue <Luggage>(50);
     //Get the list with schedules for current terminal
     flightplan = FlightScheduler.ReadTerminalSchedules(this).OrderBy(x => x.Departure).ToList();
 }