public void SetSim(StoreSimulation.SimModels.Simulation sim) { this.sim = sim; this.sim.getStore().ClientAddedToQueue += new Store.ClientAddedToQueueEventHandler(ClientAddedToQueue); this.sim.getStore().ClientRemovedFromQueue += new Store.ClientRemovedFromQueueEventHandler(ClientRemovedFromQueue); this.sim.getStore().ClientInFrontOfQueue += new Store.ClientInFrontOfQueueEventHandler(ClientInFrontOfQueue); this.sim.getStore().ClientEnteredStore += new Store.ClientEnteredStoreEventHandler(ClientEnteredStore); this.sim.getStore().ClientLeftStore += new Store.ClientLeftStoreEventHandler(ClientLeftStore); }
public MainView() { InitializeComponent(); client_args = new List<ClientStoreArg>(); SP_args = new List<SPStoreArg>(); output = new TextBoxStreamWriter(this.tbOutput); sim = new StoreSimulation.SimModels.Simulation(); simView = new LoggingView(sim, (System.IO.TextWriter)output); Timer.TimerTicked += new Timer.TimerTickedEventHandler(updateTimerLbl); this.init(); //event handlers //Store.ServicePointOpened += new Store.ServicePointOpenedEventHandler(onServicePointCreatedHandler); }
public LoggingView(StoreSimulation.SimModels.Simulation sim, TextWriter output) { this.sim = sim; this.output = output; Logger.changeOutput(this.output); //adding event listeners this.sim.getStore().ClientAddedToQueue += new Store.ClientAddedToQueueEventHandler(ClientAddedToQueue); this.sim.getStore().ClientRemovedFromQueue += new Store.ClientRemovedFromQueueEventHandler(ClientRemovedFromQueue); this.sim.getStore().ClientInFrontOfQueue += new Store.ClientInFrontOfQueueEventHandler(ClientInFrontOfQueue); this.sim.getStore().ClientEnteredStore += new Store.ClientEnteredStoreEventHandler(ClientEnteredStore); this.sim.getStore().ClientLeftStore += new Store.ClientLeftStoreEventHandler(ClientLeftStore); Store.ServicePointOpened += new Store.ServicePointOpenedEventHandler(ServicePointOpened); Store.ServicePointClosed += new Store.ServicePointClosedEventHandler(ServicePointClosed); ServicePoint.ClientEnteredCashier += new ServicePoint.ClientEnteredCashierEventHandler(ClientEnteredServicePoint); ServicePoint.ClientExitCashier += new ServicePoint.ClientExitCashierEventHandler(ClientExitServicePoint); ServicePoint.ClientInFrontOfQueueCashier += new ServicePoint.ClientInFrontOfQueueCashierEventHandler(ClientInFrontOfQueueCashier); }
public void init() { cbSupStrats.Items.Clear(); lbQueues.Items.Clear(); tbOutput.Clear(); Timer.Reset(); Client.CUSTOMERID = 0; client_args = new List<ClientStoreArg>(); SP_args = new List<SPStoreArg>(); output = new TextBoxStreamWriter(this.tbOutput); sim = new StoreSimulation.SimModels.Simulation(); simView.SetSim(sim); List<SupervisorStrategy> strats = this.sim.getStore().getSupervisor().getStrategies(); foreach (SupervisorStrategy strat in strats) { this.cbSupStrats.Items.Add(strat.ToString()); } this.cbSupStrats.SelectedIndex = 0; lbQueues.Items.Add("MainQueue_Queue"); lbQueues.SelectedIndex = 0; }