public void Reset_btn_Click(object sender, EventArgs e) { Clear_btn_Click(Clear_btn, e); Memory_size.Enabled = true; Memory_size.Clear(); No_hole.Enabled = true; No_hole.Clear(); starting_add.Clear(); Hole_size.Clear(); Holes_box.Enabled = true; No_seg.Clear(); No_seg.Enabled = true; Seg_name.Clear(); Seg_size.Clear(); Segments_box.Enabled = false; Allocation_list.SelectedItem = null; Allocation_list.Text = "Method Of Allocation"; Deallocate_box.SelectedItem = null; Deallocate_box.Text = "Process"; MEMORY.RemoveRange(0, MEMORY.Count); count = 0; start = 0; old_process_count = 0; process_count = 1; segment_count = 0; txtBox_count = 0; Label_count = 0; Deallocate_box.Items.Clear(); }
private void Submit_btn2_Click(object sender, EventArgs e) { int valid; if (Allocation_list.SelectedItem == null) { MessageBox.Show("Please Choose Method Of Allocation"); return; } if (MEMORY.Find(X => X.Name == "Hole") == null) { MessageBox.Show(" Memory is Busy , There's no Holes"); No_seg.Clear(); Seg_name.Clear(); Seg_size.Clear(); return; } if (int.TryParse(No_seg.Text, out valid)) { Number_seg = int.Parse(No_seg.Text); No_seg.Enabled = false; } else { MessageBox.Show("Please Enter The Correct Number of Segments"); return; } if (Seg_name.Text == "") { MessageBox.Show("please enter Segment Name"); return; } else { Name_seg = Seg_name.Text; Seg_name.Clear(); } if (int.TryParse(Seg_size.Text, out valid)) { size_seg = int.Parse(Seg_size.Text); Seg_size.Clear(); } else { MessageBox.Show("Please Enter The Correct Number Of Segment Size"); return; } allocate_segment(); if (segment_count == 0) { No_seg.Clear(); Segments_box.Enabled = false; return; } if (segment_count == Number_seg) { Segments_box.Enabled = false; Deallocate_box.Items.Add("P" + process_count); segment_count = 0; process_count++; } }