示例#1
0
 /// <summary>
 /// Start the central manager
 /// </summary>
 public void StartAll()
 {
     CounterManager.StartThreads();
     GateManager.StartThreads();
     SortingMachine.Start();
     ScheduleManager.Start();
     PersonsManager.Start();
 }
示例#2
0
        //Constucter for ViewModel
        public ViewModel()
        {
            //Creates a new CheckIn
            CheckIn checkIn1 = new CheckIn();

            //Subscribes OnSuitCaseArrived to checkin.SuitcaseArrived
            checkIn1.SuitcaseArrived += OnSuitcaseArrived;
            //Creates the ObservableColection with the Checkin LuggageQueue
            Suitcases = new ObservableCollection <Luggage>();



            SortingMachine sorter = new SortingMachine(checkIn1.luggageQueue);

            sorter.SuitcaseSorted  += OnSuitcaseSorted;
            SortedSuitcasesBornholm = new ObservableCollection <Luggage>();
            SortedSuitcasesKairo    = new ObservableCollection <Luggage>();
            SortedSuitcasesParis    = new ObservableCollection <Luggage>();
            SortedSuitcasesRom      = new ObservableCollection <Luggage>();
            LoadedSuitcases         = new ObservableCollection <Luggage>();

            LoadLuggage loader = new LoadLuggage();

            loader.LuggageLoaded += OnLuggageLoaded;


            //Task to generate new Luggage
            Task t1 = new Task(checkIn1.GenerateLuggage);
            Task t2 = new Task(checkIn1.GenerateLuggage);
            //Task to sort luggage into destinationqueues
            Task t3 = new Task(sorter.Sort);
            //Task to dequeue from destinationqueues
            Task t4 = new Task(delegate { loader.Load(sorter.Bornholm); });
            Task t5 = new Task(delegate { loader.Load(sorter.Kairo); });
            Task t6 = new Task(delegate { loader.Load(sorter.Paris); });
            Task t7 = new Task(delegate { loader.Load(sorter.Rom); });

            //Starts the Tasks
            t1.Start();
            t2.Start();
            t3.Start();
            t4.Start();
            t5.Start();
            t6.Start();
            t7.Start();
        }