private void addProcessButton_Click(object sender, RoutedEventArgs e) { if (continueSimulation) { if (!P1.Continue()) { P1 = new Pro(); queue.Enqueue(P1); updateGui(); } else if(!P2.Continue()) { P2 = new Pro(); queue.Enqueue(P2); updateGui(); } else if(!P3.Continue()) { P3 = new Pro(); queue.Enqueue(P3); updateGui(); } else if (!P4.Continue()) { P4 = new Pro(); queue.Enqueue(P4); updateGui(); } else { MessageBox.Show("Can't add new process to a full queue."); } } }
private void bt1_Click(object sender, RoutedEventArgs e) { queue.Clear(); continueSimulation = true; //initialize processes P1 = new Pro(); P2 = new Pro(); P3 = new Pro(); P4 = new Pro(); //Add processes to the queue queue.Enqueue(P1); queue.Enqueue(P2); queue.Enqueue(P3); queue.Enqueue(P4); initializeGui(); }