/// <summary> /// 仪器设置保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button_ok_left_Click(object sender, EventArgs e) { try { string YqXmlPath = ""; //xmlpath YqXmlPath = Common.Common.getyqPath(comboBox_yq.SelectedValue.ToString()); //端口 XmlRW.WriteXML(YqXmlPath, "value", comboBox_dk.Text, "YQ_COM"); //波特率 XmlRW.WriteXML(YqXmlPath, "value", comboBox_btl.SelectedValue != null? comboBox_btl.SelectedValue.ToString():"", "YQ_BaudRate"); //数据位 XmlRW.WriteXML(YqXmlPath, "value", comboBox_sjw.SelectedValue != null? comboBox_sjw.SelectedValue.ToString():"", "YQ_DataBits"); //奇偶校验 XmlRW.WriteXML(YqXmlPath, "value", comboBox_jojy.SelectedValue != null? comboBox_jojy.SelectedValue.ToString():"", "YQ_Parity"); //停止位 XmlRW.WriteXML(YqXmlPath, "value", comboBox_tzw.SelectedValue != null? comboBox_tzw.SelectedValue.ToString():"", "YQ_StopBits"); //jg数据处理间隔时间 XmlRW.WriteXML(YqXmlPath, "value", textBox_jg.Text, "YQ_Interval"); //rqlx 标本日期类型 if (checkBox_bbrq.Checked == true) { XmlRW.WriteXML(YqXmlPath, "value", "1", "YQ_DateType"); } else { XmlRW.WriteXML(YqXmlPath, "value", "0", "YQ_DateType"); } //写超时时间(豪秒) XmlRW.WriteXML(YqXmlPath, "value", textBox_writetimeout.Text, "YQ_writetimeout"); //读超时时间(豪秒) XmlRW.WriteXML(YqXmlPath, "value", textBox_readtimeout.Text, "YQ_readtimeout"); //解码程序版本 XmlRW.WriteXML(YqXmlPath, "value", richTextBox_version.Text, "YQ_Version"); //注册码 XmlRW.WriteXML(YqXmlPath, "value", textBox_register.Text, "YQ_RegisterCode"); MessageBox.Show("保存成功!"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// 保存操作 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { if (comboBox_printType.SelectedValue == null || comboBox_printType.SelectedValue.ToString().Length == 0) { MessageBox.Show("请选择打印类型!"); return; } try { //XmlRW xmlWrite = new XmlRW(); XmlRW.WriteXML("UserConfig.xml", UserInfo.Yybm, comboBox_sysPrint.Text, comboBox_printType.SelectedValue.ToString()); XmlRW.WriteXML("UserConfig.xml", UserInfo.Yybm, checkBox_view.Checked.ToString(), comboBox_printType.SelectedValue.ToString() + "_view"); MessageBox.Show("设定成功!"); } catch (Exception ex) { MessageBox.Show("设定失败!" + ex.Message); } }