Пример #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            //Button Two is for testing
            CalendarClass newCalendar = new CalendarClass();

            EntityClass newEntity    = new EntityClass(0, ECallType.stereo);
            EventClass  newCallEvent = new EventClass(newEntity, EEventType.CallArrive, 0);

            newCalendar.addEvent(newCallEvent);

            /*EntityClass newEntity1 = new EntityClass(1, ECallType.other);
             * EventClass newCallEvent1 = new EventClass(newEntity1, EEventType.CompleteServiceCall, 100);
             * newCalendar.addEvent(newCallEvent1);
             *
             * EntityClass newEntity2 = new EntityClass(2, ECallType.other);
             * EventClass newCallEvent2 = new EventClass(newEntity2, EEventType.CompleteIVR, 50);
             * newCalendar.addEvent(newCallEvent2);
             *
             * newCalendar.displayCalendar(listBox1);*/

            //VARS

            /*activeEvent = mainCalendar.getTopEvent();
             * activeEntity = activeEvent.currentEntity;
             * int currentTime = 0;
             *
             * //While Loop to see what the simulation will load (call Types)
             * while (activeEvent.currentEventType != EEventType.EndSim)
             * {
             *  //Update the System Time
             *  currentTime = activeEvent.schedualedTime;
             *  //If conditions (UPDATE TO CASE STATEMENTS)
             *  if (activeEvent.currentEventType == EEventType.CallArrive)
             *  {
             *      //Process the call
             *      simClass.ProcessCallArrive();
             *      //Console.WriteLine("ONE");
             *  }
             *  if (activeEvent.currentEventType == EEventType.CompleteIVR)
             *  {
             *      //Process the Switch
             *      simClass.CompleteIVR();
             *      Console.WriteLine("TWO");
             *  }
             *  if (activeEvent.currentEventType == EEventType.CompleteServiceCall)
             *  {
             *      //Process the Completed call
             *      simClass.CompleteServiceCall();
             *      Console.WriteLine("THREE");
             *  }
             *  if (activeEvent.currentEventType == EEventType.EndSim)
             *  {
             *      //End the Simulation
             *      simClass.EndSim();
             *      Console.WriteLine("FOUR");
             *  }
             * }*/
            newCalendar.displayCalendar(listBox1);
        }
Пример #2
0
        public void RunSim()
        {
            activeEvent  = mainCalendar.getTopEvent();
            activeEntity = activeEvent.currentEntity;

            while (activeEvent.currentEventType != EEventType.EndSim)
            {
                //update the system time.
                currentTime = activeEvent.schedualedTime;
                if (activeEvent.currentEventType == EEventType.CallArrive)
                {
                    //Process the call.
                    ProcessCallArrive();
                }
                if (activeEvent.currentEventType == EEventType.CompleteIVR)
                {
                    //Process the switch.
                    CompleteIRV();
                }
                if (activeEvent.currentEventType == EEventType.CompleteServiceCall)
                {
                    //Process the completion of the service call.
                    CompleteServiceCall();
                }
                if (activeEvent.currentEventType == EEventType.EndSim)
                {
                    //End the simulation.
                    EndSim();
                }

                activeEvent  = mainCalendar.getTopEvent();
                activeEntity = activeEvent.currentEntity;

                mainCalendar.displayCalendar(box);
                box.Items.Add("-----------------------------");
                onlyLable.Text  = "" + hangupCount + " people hung up.";
                queueCount.Text = "" + mainQueue.totalLengthOfQueue();

                //FOR DEBUGGING
                box2.Items.Add("-----------------------------");
                box2.Items.Add("Active Entity: " + activeEvent.currentEntity.entityID);
                box2.Items.Add("Active Event: " + activeEvent.currentEventType);
                box2.Items.Add("Time: " + activeEvent.schedualedTime);
                box2.Items.Add("-----------------------------");

                mainForm.Refresh();
            }
        }