private void customComboBox1_SelectedIndexChanged(object sender, EventArgs e) { var item = (sBuildingType)customComboBox1.SelectedItem; if (item != null) { customComboBox2.DataSource = Data_BuildingType.GetDataByIndex(item.index); customComboBox2.DisplayMember = "Name"; customComboBox2.ValueMember = "index"; } }
private void InitComboBoxes(int ind) { if (ind == 1) { bool IsEnable = false; roundEdit1._RichTextBox.Enabled = !IsEnable; roundEdit1.Enabled = !IsEnable; customComboBox1.SelectedIndex = -1; customComboBox2.SelectedIndex = -1; customComboBox1.Enabled = IsEnable; customComboBox2.Enabled = IsEnable; roundPanel1.Enabled = IsEnable; roundPanel2.Enabled = IsEnable; customComboBox1.DataSource = null; customComboBox2.DataSource = null; roundEdit1.Focus(); radioButton1.Focus(); richTextBox1.Clear(); } if (ind == 2) { bool IsEnable = true; roundEdit1._RichTextBox.Enabled = !IsEnable; roundEdit1.Enabled = !IsEnable; roundEdit1._RichTextBox.Text = ""; customComboBox1.Enabled = IsEnable; customComboBox2.Enabled = IsEnable; roundPanel1.Enabled = IsEnable; roundPanel2.Enabled = IsEnable; customComboBox1.DataSource = Data_BuildingType.GetData(); customComboBox1.DisplayMember = "Name"; customComboBox1.ValueMember = "index"; customComboBox1.SelectedIndex = 0; customComboBox2.DataSource = Data_BuildingType.GetDataByIndex(0); customComboBox1.Focus(); } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Helper.WriteLog("---------------------------------------------"); Helper.WriteLog("Запуск программы " + Application.StartupPath); dtEnd = new DateTime(2018, 10, 20); if (DateTime.Now > dtEnd || DateTime.Now < dt) { MessageBox.Show("Бета версия приложения закончилась. Обратитесь к разработчику"); return; } try { if (!Data_BuildingType.InitData()) { throw new Exception("Ошибка инициализации данных"); } } catch (Exception ex) { string message = ex.Message; message += "\r\n\r\nОшибка чтение данных из файла TypeBuildings.xml\r\nПриложение будет закрыто!"; MessageBox.Show(message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); Helper.WriteLog(message); Application.Exit(); return; } try { if (!Data_WallsType.InitData()) { throw new Exception("Ошибка инициализации данных"); } } catch (Exception ex) { string message = ex.Message; message += "\r\n\r\nОшибка чтение данных из файла TypeWalls.xml\r\nПриложение будет закрыто!"; MessageBox.Show(message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); Helper.WriteLog(message); Application.Exit(); return; } if (DEBUGINFO.IsDEBUGINFO) { Application.Run(new Steps.StepFrame()); } else { Application.Run(new MainForm()); } }