private void btnSet_Click(object sender, EventArgs e) { if (PortName.SelectedItem == null || BaudRate.SelectedItem == null) { UMessageBox.Show("请选择串口号和波特率!", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { ReadWriteXml.WriteXml("PortName", PortName.SelectedItem.ToString()); ReadWriteXml.WriteXml("BaudRate", BaudRate.SelectedItem.ToString()); UMessageBox.Show("保存成功,请重启系统!", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Information); Process.GetCurrentProcess().CloseMainWindow(); } }
private void btnSysSet_Click(object sender, EventArgs e) { if (tbSysLogTime.Text.Trim() == "" && tbUserLogTime.Text.Trim() == "" && tbNotReportTimes.Text.Trim() == "" && tbRefreshTime.Text.Trim() == "" && tbReportInterval.Text.Trim() == "") { UMessageBox.Show("请输入内容。", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (IsNumber(tbSysLogTime.Text.Trim()) && IsNumber(tbUserLogTime.Text.Trim()) && IsNumber(tbNotReportTimes.Text.Trim()) && IsNumber(tbRefreshTime.Text.Trim()) && IsNumber(tbReportInterval.Text.Trim())) { ReadWriteXml.WriteXml("SysLogTime", tbSysLogTime.Text.Trim()); ReadWriteXml.WriteXml("UserLogTime", tbUserLogTime.Text.Trim()); ReadWriteXml.WriteXml("NotReportTimes", tbNotReportTimes.Text.Trim()); ReadWriteXml.WriteXml("RefreshTime", tbRefreshTime.Text.Trim()); ReadWriteXml.WriteXml("ReportInterval", cbEnabled.Checked.ToString() + "-" + tbReportInterval.Text.Trim()); UMessageBox.Show("设置成功。", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { UMessageBox.Show("输入的值错误。", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public void SaveLocationInfo() { ReadWriteXml.WriteXml("DefaultLocation", locationInfo); UMessageBox.Show("设置成功!", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Information); }