private void bBegin_Click(object sender, EventArgs e) { // Rollback OneTact.Stop(); lTasks.Items.Clear(); lQueue.Items.Clear(); tasks.Clear(); current_tact = 0; number = 0; now_working_with_task = -1; is_free = true; waited_sum = 0; tasks_sum = 0; bStart.Enabled = true; bStop.Enabled = false; lAverage.Text = ""; }
private void bStop_Click(object sender, EventArgs e) { OneTact.Stop(); // Calculating average waiting time for (int i = 0; i < tasks.Count; i++) { if (tasks[i].completed_on != -1) { waited_sum += tasks[i].tacts_waited; tasks_sum++; } } lAverage.Text = String.Format("Average waiting time is " + (waited_sum / (double)tasks_sum).ToString("0.00") + " tacts"); bStart.Enabled = true; bStop.Enabled = false; }