/// <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 Switch panel /// </summary> private void UpdateSwitchPanel() { //Get the next SwitchCompletedEvent from the calendar SwitchCompletedEvent nextSCE = sim.Calendar.NextEventOfType(EEventType.SwitchCompleted) as SwitchCompletedEvent; //Refresh the panel pnlSwitch.Refresh(); //If their was a scheduled SwitchCompletedEvent if (nextSCE != null) { //Draw the call int centerX = pnlSwitch.Width / TWO; int centerY = pnlSwitch.Height / TWO; DrawCall(nextSCE.Entity, new Point(centerX, centerY), panelBuffers[pnlSwitch]); } //Draw the SwitchRectangle Pen squarePen = new Pen(Color.Red, LINE_THICKNESS); panelBuffers[pnlSwitch].DrawRectangle(squarePen, 0, 0, pnlSwitch.Width, pnlSwitch.Height); }