// Заполнить combobox с названиями компонентов public static void FillComponentNameComboBox(ComboBox componentName) { componentName.Items.Clear(); componentsData = xmlFile.LoadComponents(); foreach (Component item in componentsData) { componentName.Items.Add(item.name); } componentName.SelectedIndex = 0; }
private void ComponentsEditor_Load(object sender, EventArgs e) { XmlFile xmlFile = new XmlFile(); List <Component> components = xmlFile.LoadComponents(); FillComponentsData(components); CheckCanDelete(); }
private void deleteComponentButton_Click(object sender, EventArgs e) { XmlFile xmlFile = new XmlFile(); foreach (DataGridViewRow item in componentsData.SelectedRows) { string componentName = item.Cells[0].Value.ToString(); componentsData.Rows.RemoveAt(item.Index); xmlFile.RemoveComponent(componentName); } componentsData.Rows.Clear(); List <Component> components = xmlFile.LoadComponents(); FillComponentsData(components); MainForm.FillComponentNameComboBox(_mainForm.componentName); }