private void btn_Delete_Click(object sender, EventArgs e) { if (Lb_MaterialsList.SelectedItem != null) { _ListComposites.Remove(_ListComposites[Lb_MaterialsList.SelectedIndex]); Lb_MaterialsList.Items.Remove(Lb_MaterialsList.SelectedItem); Lb_MaterialsList.Update(); } }
private void btn_ClearAll_Click(object sender, EventArgs e) { if (Lb_MaterialsList.Items.Count > 0) { _ListComposites.Clear(); Lb_MaterialsList.Items.Clear(); Lb_MaterialsList.Update(); } }
private void btn_Change_Click(object sender, EventArgs e) { if (Lb_MaterialsList.SelectedItem != null) { CreateMaterial_Form createMaterial_Form = new CreateMaterial_Form(true, _ListComposites[Lb_MaterialsList.SelectedIndex]); this.Hide(); createMaterial_Form.ShowDialog(); if (createMaterial_Form.MyComposite.Name != null) { _ListComposites[Lb_MaterialsList.SelectedIndex] = createMaterial_Form.MyComposite; Lb_MaterialsList.Items[Lb_MaterialsList.SelectedIndex] = createMaterial_Form.MyComposite.Name; } createMaterial_Form.Dispose(); Lb_MaterialsList.Update(); Lb_MaterialsList.Hide(); Lb_MaterialsList.Show(); this.Show(); } }