public SetupDialog(FGDimmerData data) { InitializeComponent(); ForeColor = ThemeColorTable.ForeColor; BackColor = ThemeColorTable.BackgroundColor; ThemeUpdateControls.UpdateControls(this); _data = data; int startchannel; if (_data.PortName != null) { _serialPort = new SerialPort(_data.PortName, _data.BaudRate, _data.Parity, _data.DataBits, _data.StopBits); updateSettingLabel(); } _modules = _data.Modules; if (_data.StartChannel == 0) { startchannel = _data.StartChannel + 1; } else { startchannel = _data.StartChannel; } for (; startchannel <= _data.EndChannel; startchannel++) { comboBoxModule1.Items.Add(startchannel); comboBoxModule2.Items.Add(startchannel); comboBoxModule3.Items.Add(startchannel); comboBoxModule4.Items.Add(startchannel); } if (_modules != null) { checkBoxModule1.Checked = _modules[0].Enabled; if (checkBoxModule1.Checked) { if (_modules[0].StartChannel >= (int) comboBoxModule1.Items[0]) { comboBoxModule1.SelectedItem = _modules[0].StartChannel; } } checkBoxModule2.Checked = _modules[1].Enabled; if (checkBoxModule2.Checked) { if (_modules[1].StartChannel >= (int) comboBoxModule2.Items[0]) { comboBoxModule2.SelectedItem = _modules[1].StartChannel; } } checkBoxModule3.Checked = _modules[2].Enabled; if (checkBoxModule3.Checked) { if (_modules[2].StartChannel >= (int) comboBoxModule3.Items[0]) { comboBoxModule3.SelectedItem = _modules[2].StartChannel; } } checkBoxModule4.Checked = _modules[3].Enabled; if (checkBoxModule4.Checked) { if (_modules[3].StartChannel >= (int) comboBoxModule4.Items[0]) { comboBoxModule4.SelectedItem = _modules[3].StartChannel; } } } checkBoxHoldPort.Checked = _data.HoldPortOpen; if (_data.AcOperation) { radioButtonAC.Checked = true; } else { radioButtonPWM.Checked = true; } }
public SetupDialog(FGDimmerData data) { InitializeComponent(); _data = data; int startchannel; if (_data.PortName != null) { _serialPort = new SerialPort(_data.PortName, _data.BaudRate, _data.Parity, _data.DataBits, _data.StopBits); updateSettingLabel(); } _modules = _data.Modules; if (_data.StartChannel == 0) { startchannel = _data.StartChannel + 1; } else { startchannel = _data.StartChannel; } for (; startchannel <= _data.EndChannel; startchannel++) { comboBoxModule1.Items.Add(startchannel); comboBoxModule2.Items.Add(startchannel); comboBoxModule3.Items.Add(startchannel); comboBoxModule4.Items.Add(startchannel); } if (_modules != null) { checkBoxModule1.Checked = _modules[0].Enabled; if (checkBoxModule1.Checked) { if (_modules[0].StartChannel >= (int)comboBoxModule1.Items[0]) { comboBoxModule1.SelectedItem = _modules[0].StartChannel; } } checkBoxModule2.Checked = _modules[1].Enabled; if (checkBoxModule2.Checked) { if (_modules[1].StartChannel >= (int)comboBoxModule2.Items[0]) { comboBoxModule2.SelectedItem = _modules[1].StartChannel; } } checkBoxModule3.Checked = _modules[2].Enabled; if (checkBoxModule3.Checked) { if (_modules[2].StartChannel >= (int)comboBoxModule3.Items[0]) { comboBoxModule3.SelectedItem = _modules[2].StartChannel; } } checkBoxModule4.Checked = _modules[3].Enabled; if (checkBoxModule4.Checked) { if (_modules[3].StartChannel >= (int)comboBoxModule4.Items[0]) { comboBoxModule4.SelectedItem = _modules[3].StartChannel; } } } checkBoxHoldPort.Checked = _data.HoldPortOpen; if (_data.AcOperation) { radioButtonAC.Checked = true; } else { radioButtonPWM.Checked = true; } }