private void First_Click(object sender, EventArgs e) { List <node> List2 = list_hole.ConvertAll(x => new node(x)); Best page = new Best(flag, List2, mem_size, number); this.Hide(); page.Show(); }
private void Hole2_Load(object sender, EventArgs e) { Best.Hide(); first.Hide(); Worest.Hide(); textBox1.Text = "0"; Label k = new Label(); Label k2 = new Label(); Point kp = new Point(640, 22); Y = (int)((30 + (mem_size * 3 / 10))); Point kp2 = new Point(600, Y); //k.Location = kp; k2.Location = kp2; //k.Text = "0"; k2.Text = "" + (mem_size - 1); // this.Controls.Add(k); this.Controls.Add(k2); }
private void ADD_Click(object sender, EventArgs e) { bool flags = false; if (i <= number) { node H = new node(); H.limit = long.Parse(textBox3.Text); H.start = long.Parse(textBox2.Text); H.name = "hole" + i; rest -= H.limit; if (rest >= 0 && (H.start + H.limit <= mem_size - 1)) { foreach (node G in list_hole) { if ((H.start > (G.start) && H.start < (G.start + G.limit)) || (H.start < (G.start) && (H.start + H.limit) > G.start) || (H.start == G.start)) { DialogResult re; re = MessageBox.Show("Error1"); flags = true; break; } } if (!flags) { list_hole.Add(H); status = true; panel2.Refresh(); i++; textBox1.Text = "" + i; } if (i == number) { F = 1; textBox1.Hide(); textBox2.Hide(); textBox3.Hide(); label1.Hide(); label2.Hide(); label3.Hide(); int index = 0; list_sort(list_hole); for (int i = 0; i < list_hole.Count() - 1; i++) { if ((list_hole[i].start + list_hole[i].limit) == list_hole[i + 1].start) { list_hole[i].limit += list_hole[i + 1].limit; list_hole.Remove(list_hole[i + 1]); i--; } } if (list_hole[0].start != 0) { node H2 = new node(); H2.start = 0; H2.limit = list_hole[0].start; H2.name = "old" + index; list_hole.Insert(0, H2); index++; } for (int j = 0; j < list_hole.Count() - 1; j++) { if ((list_hole[j].start + list_hole[j].limit) < list_hole[j + 1].start) { node H3 = new node(); H3.start = (list_hole[j].start + list_hole[j].limit); H3.limit = list_hole[j + 1].start - H3.start; H3.name = "old" + index; list_hole.Insert(j, H3); index++; j++; } } if ((list_hole[list_hole.Count() - 1].start + list_hole[list_hole.Count() - 1].limit) < (mem_size - 1)) { node H4 = new node(); H4.start = (list_hole[list_hole.Count() - 1].start + list_hole[list_hole.Count() - 1].limit); H4.limit = mem_size - 1 - H4.start; H4.name = "old" + index; list_hole.Insert(list_hole.Count() - 1, H4); } list_sort(list_hole); panel2.Refresh(); ADD.Hide(); Best.Show(); first.Show(); Worest.Show(); } else if (F == 1) { textBox1.ReadOnly = false; textBox1.Text = " "; label1.Text = "Process Name"; } } else { rest += H.limit; } } else { DialogResult re; re = MessageBox.Show("Error1"); } textBox2.Clear(); textBox3.Clear(); }