private void btn_setuse_Click(object sender, EventArgs e) { if (dgvm.SelectedRows.Count == 0) { return; } string modename = dgvm.SelectedRows[0].Cells[0].Value.ToString(); if (MessageBox.Show("是设置当前模板套为在用状态?", "系统提示", MessageBoxButtons.YesNo) == DialogResult.No) { return; } Public.SetXmlValue("PrintModuleName", modename); listmodule(); }
private void button1_Click(object sender, EventArgs e) { Public.SetXmlValue("type", this.comType.Text); string port = ""; foreach (Control ct in groupBox1.Controls) { RadioButton rd = (RadioButton)ct; if (rd.Checked) { port = rd.Name; port = port.Substring(port.Length - 1, 1); Public.SetXmlValue("PCLPort", port); break; } } string upnum = ""; foreach (Control ct in groupBox2.Controls) { RadioButton rd = (RadioButton)ct; if (rd.Checked) { upnum = rd.Name; upnum = upnum.Substring(upnum.Length - 1, 1); Public.SetXmlValue("PCLInterface", upnum); break; } } string downnum = ""; foreach (Control ct in groupBox3.Controls) { RadioButton rd = (RadioButton)ct; if (rd.Checked) { downnum = rd.Name; downnum = downnum.Substring(downnum.Length - 1, 1); Public.SetXmlValue("PCLInterfaceX", downnum); break; } } MessageBox.Show("保存成功!"); }
private void btnok_Click(object sender, EventArgs e) { if (MessageBox.Show("是否保存设置?", "操作提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { try { Public.SetXmlValue("port", cmbCom.Text); Public.SetXmlValue("StopBits", cmbStopBits.Text); Public.SetXmlValue("Parity", cmbparity.Text); Public.SetXmlValue("baudrate", txtbaudRate.Text); Public.SetXmlValue("ByteSize", txtDataBits.Text); Public.SetXmlValue("HandShake", cmbHandShake.Text); if (ckHandShake.Checked) { Public.SetXmlNodeAttr("HandShake", "isuse", "Y"); } else { Public.SetXmlNodeAttr("HandShake", "isuse", "N"); } Public.SetXmlValue("RtsEnable", cmbRtsEnable.Text); if (ckRtsEnable.Checked) { Public.SetXmlNodeAttr("RtsEnable", "isuse", "Y"); } else { Public.SetXmlNodeAttr("RtsEnable", "isuse", "N"); } Public.SetXmlValue("DtrEnable", cmbDtrEnable.Text); if (ckDtrEnable.Checked) { Public.SetXmlNodeAttr("DtrEnable", "isuse", "Y"); } else { Public.SetXmlNodeAttr("DtrEnable", "isuse", "N"); } Public.SetXmlValue("DataStar", txtdatas.Text); if (ckdatas.Checked) { Public.SetXmlNodeAttr("DataStar", "isuse", "Y"); } else { Public.SetXmlNodeAttr("DataStar", "isuse", "N"); } Public.SetXmlValue("DataEnd", txtdatae.Text); if (ckdatae.Checked) { Public.SetXmlNodeAttr("DataEnd", "isuse", "Y"); } else { Public.SetXmlNodeAttr("DataEnd", "isuse", "N"); } Public.SetXmlValue("Pointwz", txtpoint.Text); if (ckpoint.Checked) { Public.SetXmlNodeAttr("Pointwz", "isuse", "Y"); } else { Public.SetXmlNodeAttr("Pointwz", "isuse", "N"); } Public.SetXmlValue("DataStarChar", txtdataChars.Text); if (ckdataChars.Checked) { Public.SetXmlNodeAttr("DataStarChar", "isuse", "Y"); } else { Public.SetXmlNodeAttr("DataStarChar", "isuse", "N"); } Public.SetXmlValue("DataEndChar", txtdataChare.Text); if (ckdataChare.Checked) { Public.SetXmlNodeAttr("DataEndChar", "isuse", "Y"); } else { Public.SetXmlNodeAttr("DataEndChar", "isuse", "N"); } Public.SetXmlValue("DataLen", txtdatalen.Text); if (ckdatalen.Checked) { Public.SetXmlNodeAttr("DataLen", "isuse", "Y"); } else { Public.SetXmlNodeAttr("DataLen", "isuse", "N"); } Public.SetXmlValue("JHCS", nujh.Value.ToString()); Public.SetXmlValue("QSJG", nudqsjg.Value.ToString()); jhcs = int.Parse(nujh.Value.ToString()); pointwz = int.Parse(txtpoint.Text); MessageBox.Show("保存成功!"); } catch (System.Exception ex) { MessageBox.Show("保存失败:" + ex.Message); } } }