Example #1
0
 public void setEnableButtonMenu()
 {
     // Start All Button disenabled.
     // Enible button for button user choose only.
     if (myScheduling.getFlagFCFS())
     {
         btn_FCFS.Enabled = true;;
     }
     if (myScheduling.getFlagPriority_P())
     {
         btn_Priority_P.Enabled = true;
     }
     if (myScheduling.getFlagPriority_N())
     {
         btn_Priority_N.Enabled = true;
     }
     if (myScheduling.getFlagSJF_P())
     {
         btn_SJF_P.Enabled = true;
     }
     if (myScheduling.getFlagSJF_N())
     {
         btn_SJF_N.Enabled = true;
     }
     if (myScheduling.getFlagRR())
     {
         btn_RR.Enabled = true;
     }
 }
Example #2
0
 public void setContent()
 {
     // Set value in content form Object.
     numeric_numProcess.Value    = myScheduling.getNumberProcess();
     checkBox_FCFS.Checked       = myScheduling.getFlagFCFS();
     checkBox_SJF_P.Checked      = myScheduling.getFlagSJF_P();
     checkBox_SJF_N.Checked      = myScheduling.getFlagSJF_N();
     checkBox_Priority_P.Checked = myScheduling.getFlagPriority_P();
     checkBox_Priority_N.Checked = myScheduling.getFlagPriority_N();
     checkBox_RR.Checked         = myScheduling.getFlagRR();
 }
        public void setData()
        {
            int num = myScheduling.getNumberProcess();

            for (int i = 0; i < num; i++)
            {
                label_Aviral[i].Text   = myScheduling.getArrivalTime(i).ToString();
                label_Burst[i].Text    = myScheduling.getBrustTime(i).ToString();
                label_Priority[i].Text = myScheduling.getPriority(i).ToString();
            }

            if (myScheduling.getFlagFCFS())
            {
                lbl_avg_FCFS.Text           = "" + myScheduling.getAVG_waitingTimeFCFS().ToString("0.00");
                lbl_contextSwitch_FCFS.Text = "" + myScheduling.getContextSwitch_FCFS();
            }
            if (myScheduling.getFlagSJF_P())
            {
                lbl_avg_SJF_P.Text           = "" + myScheduling.getAVG_waitingTimePriority_P().ToString("0.00");
                lbl_contextSwitch_SJF_P.Text = "" + myScheduling.getContextSwitch_SJF_P();
            }
            if (myScheduling.getFlagSJF_N())
            {
                lbl_avg_SJF_N.Text           = "" + myScheduling.getAVG_waitingTimeSJF_N().ToString("0.00");
                lbl_contextSwitch_SJF_N.Text = "" + myScheduling.getContextSwitch_SJF_N();
            }
            if (myScheduling.getFlagPriority_P())
            {
                lbl_avg_Priority_P.Text           = "" + myScheduling.getAVG_waitingTimePriority_P().ToString("0.00");
                lbl_contextSwitch_Priority_P.Text = "" + myScheduling.getContextSwitch_Priority_P();
            }
            if (myScheduling.getFlagPriority_N())
            {
                lbl_avg_Priority_N.Text           = "" + myScheduling.getAVG_waitingTimePriority_N().ToString("0.00");
                lbl_contextSwitch_Priority_N.Text = "" + myScheduling.getContextSwitch_Priority_N();
            }
            if (myScheduling.getFlagRR())
            {
                lbl_avg_RR.Text           = "" + myScheduling.getAVG_waitingTimeRR().ToString("0.00");
                lbl_contextSwitch_RR.Text = "" + myScheduling.getContextSwitch_RR();
                lbl_quantumTime.Text      = "" + myScheduling.getQuantumTime().ToString();
            }
        }
        private void button2_Click(object sender, EventArgs e)
        {
            // Add value to object.
            addDatatoObjectScheduling();
            myScheduling.clearContextSwitch();
            myScheduling.clearArrayData();
            //MessageBox.Show(""+myScheduling.getBrustTime(0)+"  "+myScheduling.getBrustTime(1)+"  "+myScheduling.getBrustTime(2));
            if (myScheduling.getFlagFCFS())
            {
                myScheduling.computeFCFS();
            }
            if (myScheduling.getFlagSJF_N())
            {
                myScheduling.computeSJF_N();
            }
            if (myScheduling.getFlagPriority_N())
            {
                myScheduling.computePriority_N();
            }
            if (myScheduling.getFlagSJF_P())
            {
                myScheduling.computeSJF_P();
            }
            if (myScheduling.getFlagPriority_P())
            {
                myScheduling.computePriority_P();
            }
            if (myScheduling.getFlagRR())
            {
                myScheduling.setQuantunTime((int)numericUpDown_QuantumTime.Value);
                myScheduling.computeRR();
            }
            // MessageBox.Show("" + myScheduling.Debug_FCFS());
            //MessageBox.Show("" + myScheduling.waitingTime_FCFS[0] +" " +myScheduling.waitingTime_FCFS[1] + "  " + myScheduling.waitingTime_FCFS[2]);

            Result_form1 form2 = new Result_form1(myScheduling);

            form2.Show();
            form2.Location = this.Location;
            Hide();
        }
Example #5
0
        public Result_form1(ProcessesScheduling myScheduling)
        {
            InitializeComponent();
            this.myScheduling = myScheduling;

            panelExColorProcess   = new Panel[10];
            processWaitingTime    = new Label[10];
            processTurnaroundTime = new Label[10];
            label_process         = new Label[10];

            accessContent();
            setVisibleContent();
            setVisibleLanguageBar();

            //set init Language.
            if (myScheduling.language == "EN")
            {
                comboBox_language.SelectedIndex = 0;
            }
            else if (myScheduling.language == "TH")
            {
                comboBox_language.SelectedIndex = 1;
            }

            setLanguage();



            panelArray      = new Panel[myScheduling.number_ganttChart];
            valueGanttChart = new Label[myScheduling.number_ganttChart];

            setEnableButtonMenu();
            setColorButtonMenu();
            setVisibleQuantumTime(false);

            // Check want display Gantt Chart.
            if (myScheduling.getFlagDisplayChart())
            {
                DrawGanttChart();
            }

            if (myScheduling.getFlagFCFS())
            {
                btn_FCFS.BackColor = color_btn_choose;
                if (myScheduling.getFlagDisplayChart())
                {
                    putColorInPanel("FCFS");
                }
                displayFCFS();
            }
            else if (myScheduling.getFlagSJF_P())
            {
                btn_SJF_P.BackColor = color_btn_choose;
                if (myScheduling.getFlagDisplayChart())
                {
                    putColorInPanel("SJF_P");
                }
                displaySJF_P();
            }
            else if (myScheduling.getFlagSJF_N())
            {
                btn_SJF_N.BackColor = color_btn_choose;
                if (myScheduling.getFlagDisplayChart())
                {
                    putColorInPanel("SJF_N");
                }
                displaySJF_N();
            }
            else if (myScheduling.getFlagPriority_P())
            {
                btn_Priority_P.BackColor = color_btn_choose;
                if (myScheduling.getFlagDisplayChart())
                {
                    putColorInPanel("Priority_P");
                }
                displayPriority_P();
            }
            else if (myScheduling.getFlagPriority_N())
            {
                btn_Priority_N.BackColor = color_btn_choose;
                if (myScheduling.getFlagDisplayChart())
                {
                    putColorInPanel("Priority_N");
                }
                displayPriority_N();
            }
            else if (myScheduling.getFlagRR())
            {
                setVisibleQuantumTime(true);
                numeric_quantumTime.Value = myScheduling.getQuantumTime();
                btn_RR.BackColor          = color_btn_choose;
                if (myScheduling.getFlagDisplayChart())
                {
                    putColorInPanel("RR");
                }
                displayRR();
            }
        }