/// <summary> /// Creates an Event of the designated type, to occure at a specified time, and bound to a given entity /// </summary> /// <param name="eventType">The type of event to create</param> /// <param name="eventTime">The time the event will occur</param> /// <param name="entity">The Call this event is bound to (Can be null)</param> /// <returns></returns> public Event CreateEvent(EEventType eventType, DateTime eventTime, Call entity) { //Create an event to return Event eve = null; //Switch on the possible event types switch (eventType) { case EEventType.CallArrive: eve = new CallArriveEvent(entity, eventTime); break; case EEventType.SwitchCompleted: eve = new SwitchCompletedEvent(entity, eventTime); break; case EEventType.CompletedService: eve = new CompletedServiceEvent(entity, eventTime); break; case EEventType.EndReplication: eve = new EndReplicationEvent(eventTime); break; } return(eve); }
/// <summary> /// Updates the statisics affected by a CallArriveEvent /// </summary> /// <param name="callArriveEvent">The Event that occured</param> /// <exception cref="System.ArgumentNullException">Thrown when the given event is null</exception> private void CallArrive(CallArriveEvent callArriveEvent) { //Check that the given event is not null if (callArriveEvent != null) { //If the event ended in a hangup if (callArriveEvent.HangUp == true) { //Increase the number of busy signals busySignalCount++; } } else // given event was null throw exception { throw new ArgumentNullException("callArriveEvent", "Attempted to pass null CallArriveEvent to StatisticsManagager.CallArrive"); } }
/// <summary> /// Updates the call arrival panel /// </summary> private void UpdateCallArrivalPanel() { //Get the next CallArriveEvent from the calendar CallArriveEvent nextCAE = sim.Calendar.NextEventOfType(EEventType.CallArrive) as CallArriveEvent; //Refresh the panel pnlCallArrive.Refresh(); //Check that it is not null if (nextCAE != null) { //Draw the call int centerX = pnlCallArrive.Width / TWO; int centerY = pnlCallArrive.Height / TWO; DrawCall(nextCAE.Entity, new Point(centerX, centerY), panelBuffers[pnlCallArrive]); } }