void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { //获取保存的参数 SerialPortConfigItem item = ConfigManager.GetConfigItem(comboBox1.Text); this.textBox1.Text = item.GetItemValue(enumSerialPortConfigItem.串口名称); this.textBox2.Text = item.GetItemValue(enumSerialPortConfigItem.波特率); }
private void button1_Click(object sender, EventArgs e) { //保存参数 SerialPortConfigItem item = ConfigManager.GetConfigItem(comboBox1.Text); item.SpName = this.textBox1.Text; item.SpBaudRate = this.textBox2.Text; if (ConfigManager.SaveConfigItem(item)) { MessageBox.Show("保存完毕"); } else { MessageBox.Show("保存失败"); } }