// Function that handles multiple calls needed to update process lists and grid values public void ExecuteTimeChanges(PipelineControl pc, int time) { ClearDataGrid(false); CreateOriginalProcessesClone(); processesAtSpecificTime = pc.GetDataFromSpecificTime(time); CreateAndFillDataGrid(gridDynamicDataDisplay, processesAtSpecificTime, true); textBlockDynamicDataSetTimeValue.Text = pc.TimeCounter.ToString(); }
// This events generates a PipelineControl dependent on the CPU_Count and algorithm selected // In this case PipelineControl will be rendered completed private void buttonRunAll_Click(object sender, RoutedEventArgs e) { List <List <Object> > pipelineToBeSent = new List <List <Object> >(); string strToBeSent = null; int timeToBeSent = -1; bool stopFlag = false; CPU_Count = comboBoxCPU.SelectedIndex + 1; ClearPipelines(); if (comboBoxAlg.SelectedIndex == 0) { RunFCFS(); pipelineToBeSent = pipelinesFCFS; strToBeSent = "First Come First Serve"; timeToBeSent = totalTimeFCFS; } else if (comboBoxAlg.SelectedIndex == 1) { RunSJN(); pipelineToBeSent = pipelinesSJN; strToBeSent = "Shortest Job First"; timeToBeSent = totalTimeSJN; } else if (comboBoxAlg.SelectedIndex == 2) { RunPS(); pipelineToBeSent = pipelinesPS; strToBeSent = "Priority Scheduling"; timeToBeSent = totalTimePS; } else if (comboBoxAlg.SelectedIndex == 3) { if (isTimeQuantumValid) { RunRR(); pipelineToBeSent = pipelinesRR; strToBeSent = "Round Robin"; timeToBeSent = totalTimeRR; } else { stopFlag = true; } } if (stopFlag == false) { PipelineControl pc = new PipelineControl(CPU_Count, pipelineToBeSent, originalProcesses, strToBeSent, timeToBeSent); pc.VerticalAlignment = VerticalAlignment.Top; pc.HorizontalAlignment = HorizontalAlignment.Left; sPanel.Children.Add(pc); AdjustPipelineControlWidth(); lastCreated = pc; } }
// This function handles the logic needed to select or deselect a PipelineControl public void SelectAndHighlightPC(PipelineControl pc, Grid mainGrid, FrameworkElement clickedElement) { if (pc.IsSelected == false) { DeselectAllPipelineControls(); pc.IsSelected = true; // Add a glow effect AddPipelineControlGlow(mainGrid); // Update lists and grids on UI ExecuteTimeChanges(pc, pc.TimeCounter); } else { // Remove effect if PipelineControl is deselected mainGrid.Effect = null; pc.IsSelected = false; } }