/// <summary> /// Updates all the statistics that are monitored /// </summary> /// <param name="sender">The object that triggered this event, usually args</param> /// <param name="e">The EventArgs</param> void UpdateStatistics(object sender, Simulator.SimulationEventArgs e) { //Get the processed event Event processed = e.ProcessedEvent; //If the event was a CallArriveEvent if (processed is CallArriveEvent) { CallArrive((CallArriveEvent)processed); } else //It was a different event { //If the event was a completed service event if (processed is CompletedServiceEvent) { ServiceComplete((CompletedServiceEvent)processed); } else //It was either EndReplication or something else { //If the event was an End Replication event if (processed is EndReplicationEvent) { //Write the results of this run to a new file OutputToFile(); } } } //Update all the time based statistics UpdateTimeBasedStatistics(processed); //Trigger the StatisticsUpdated event OnStatisticsUpdated(); }
/// <summary> /// Updates the Display to represent the current state of the Simulator /// </summary> /// <param name="sender">The Simulator that triggered this event</param> /// <param name="e">The events SimulationEventArgs</param> void UpdateDisplay(object sender, Simulator.SimulationEventArgs e) { //Update the clock text label lblClock.Text = sim.Clock.ToLongTimeString(); //Update the Calendar Tab UpdateCalendar(); //Update the queues tabs UpdateQueues(); //Updates the Visual Display tab UpdateGraphicalTab(); //Do events just to make sure that the controls update Application.DoEvents(); }