private void MainForm_Shown(object sender, EventArgs e) { progressBarScanningDevice.Visible = false; // Открываем порт с ранее сохраненными настройками CurrentComPortObject.Open(NameOfCurrentComPort, BaudRate); }
private void FGlobalSetting_Shown(object sender, EventArgs e) { portName = Properties.Settings.Default.PortName; baudRate = Properties.Settings.Default.BaudRates; comboBoxPortName.Items.Clear(); // Загружаем список доступных портов в бокс через свойство класса ComPort comboBoxPortName.Items.AddRange(comport.GetAvailablePortNamesList); // Отображаем порт из настроект comboBoxPortName.SelectedIndex = comboBoxPortName.Items.IndexOf(portName); comboBoxBaudrate.Items.Clear(); comboBoxBaudrate.Items.AddRange(comport.baudRates); comboBoxBaudrate.SelectedIndex = comboBoxBaudrate.Items.IndexOf(baudRate); DigitCapacity = Properties.Settings.Default.DigitCapacity.ToString(); comboBoxDigitValue.SelectedIndex = comboBoxDigitValue.Items.IndexOf(DigitCapacity); buttonApplyChanges.Enabled = true; comport.Open(Properties.Settings.Default.PortName, Properties.Settings.Default.BaudRates); }