コード例 #1
0
ファイル: MainForm.cs プロジェクト: MrDiz2112/Ecology
        // Заполнить 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;
        }
コード例 #2
0
        private void ComponentsEditor_Load(object sender, EventArgs e)
        {
            XmlFile          xmlFile    = new XmlFile();
            List <Component> components = xmlFile.LoadComponents();

            FillComponentsData(components);

            CheckCanDelete();
        }
コード例 #3
0
        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);
        }