public queue() { length = 0; pro_name = 0; wait = new process[100]; now_process = null; }
private void button1_Click(object sender, EventArgs e) { int i = 0,j=0; Int32.TryParse(textBox1.Text,out i); Int32.TryParse(textBox2.Text,out j); if(i>=0&&j>=0){ process p = new process(++qwait.pro_name, Int32.Parse(textBox1.Text), time_pass, Int32.Parse(textBox2.Text)); qwait.add(p); textBox1.Text = null; textBox2.Text = null; textBox3.Text += "add job" + p.num.ToString()+"\r\n"; textBox4.Text = qwait.now_wait(); }else MessageBox.Show("输入整数!"); }
public void del_anyone(process p) { if (length > 1) { int i = 0; while (p != wait[i] && i < length) i++; for (; i < length - 1; i++) { wait[i] = wait[i + 1]; } length--; } else length--; }
public void add(process p) { wait[length] = p; length++; }