예제 #1
0
 public Pub(UIUpdater uiUpdater)
 {
     this.uiUpdater = uiUpdater;
     bouncer        = new Bouncer(uiUpdater, allPatrons, PatronProcess);
     bartender      = new Bartender(uiUpdater, glassesInShelf, queueToBar, allPatrons);
     waiter         = new Waiter(uiUpdater, glassesInShelf, glassesOnTables, allPatrons);
 }
예제 #2
0
        public Bar(MainWindow mainWindow)
        {
            this.mainWindow = mainWindow;
            shelf           = new ConcurrentStack <BeerGlass>();
            table           = new ConcurrentStack <BeerGlass>();
            chair           = new ConcurrentStack <Chair>();
            guest           = new ConcurrentQueue <Patron>();
            glasses         = new ConcurrentStack <BeerGlass>();
            patronList      = new List <Patron>();
            var bouncer   = new Bouncer(this);
            var waitress  = new Waitress(this);
            var bartender = new Bartender(this);


            for (int i = 0; i < MaxNumOfGlasses; i++)
            {
                shelf.Push(new BeerGlass());
            }
            for (int i = 0; i < MaxNumOfChairs; i++)
            {
                chair.Push(new Chair());
            }

            BarInfo();
        }
예제 #3
0
 public SimulationManager(SimulationState stateToRun, double simulationSpeed)
 {
     timer         = new DispatcherTimer();
     establishment = GetEstablishment(stateToRun, simulationSpeed);
     window        = (MainWindow)App.Current.MainWindow;
     bouncer       = new Bouncer(establishment);
     bartender     = new Bartender(establishment);
     waitress      = new Waitress(establishment);
     logManager    = new LogManager(window, this);
 }
예제 #4
0
 public Bar(BarController barController)
 {
     BarController   = barController;
     currentBarState = BarState.Open;
     GenerateGlasses();
     GenerateChairs();
     Bartender = new Bartender(this);
     Bouncer   = new Bouncer(this);
     Waitress  = new Waitress(this);
 }
예제 #5
0
 void InitLogManager(MainWindow view, SimulationManager simulationManager)
 {
     startTime                         = DateTime.UtcNow;
     LogManager.view                   = view;
     bouncer                           = simulationManager.GetBouncer();
     waitress                          = simulationManager.GetWaitress();
     bartender                         = simulationManager.GetBartender();
     waitressLogMessages               = new List <string>();
     bartenderLogMessages              = new List <string>();
     patronLogMessages                 = new List <string>();
     view.WaitressListbox.ItemsSource  = waitressLogMessages;
     view.BartenderListbox.ItemsSource = bartenderLogMessages;
     view.PatronsListbox.ItemsSource   = patronLogMessages;
     SubscribeToEvents();
 }
예제 #6
0
 public void StartAgents()
 {
     Bartender.Run(this);
     Bouncer.Run(this);
     Waitress.Run(this);
 }