private void btnDeleteGroup_Click(object sender, EventArgs e) { List <DevExpress.XtraTreeList.Nodes.TreeListNode> nodes = treeList1.GetAllCheckedNodes(); if (nodes.Count == 0) { return; } DialogResult dr = XtraMessageBox.Show("确定删除所选分组?", GlobalValue.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == System.Windows.Forms.DialogResult.Yes) { for (int i = 0; i < nodes.Count; i++) { if (nodes[i].Level == 0) { DataRowView drv = treeList1.GetDataRecordByNode(nodes[i]) as DataRowView; int query = NoiseDataBaseHelper.DeleteGroup(Convert.ToInt32(drv["ID"])); if (query == -1) { throw new Exception("数据入库发生错误。"); } } } GlobalValue.ClearText(groupControl2); GlobalValue.ClearText(groupControl3); GlobalValue.groupList = NoiseDataBaseHelper.GetGroups(); GlobalValue.recorderList = NoiseDataBaseHelper.GetRecorders(); BindTree(); GlobalValue.reReadIdList.Clear(); } }
private void btnAddGroup_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(txtGroupName.Text) || string.IsNullOrEmpty(txtGroupNote.Text)) { XtraMessageBox.Show("分组名称/分组备注未输入!", GlobalValue.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } NoiseRecorderGroup newGrp = new NoiseRecorderGroup(); newGrp.ID = NoiseDataBaseHelper.GetGroupID(); newGrp.Name = txtGroupName.Text; newGrp.Remark = txtGroupNote.Text; int query = NoiseDataBaseHelper.AddGroup(newGrp); if (query != -1) { GlobalValue.groupList = NoiseDataBaseHelper.GetGroups(); BindTree(); } else { throw new Exception("数据入库发生错误。"); } } catch (Exception ex) { XtraMessageBox.Show("添加失败:" + ex.Message, GlobalValue.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnAlterGroupSet_Click(object sender, EventArgs e) { try { NoiseRecorderGroup alterGrp = new NoiseRecorderGroup(); alterGrp.ID = Convert.ToInt32(txtGroupID.Text); alterGrp.Name = txtGroupName.Text; alterGrp.Remark = txtGroupNote.Text; int query = NoiseDataBaseHelper.UpdateGroup(alterGrp); if (query != -1) { GlobalValue.groupList = NoiseDataBaseHelper.GetGroups(); XtraMessageBox.Show("更新成功!", GlobalValue.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); //LoadGroupList(); BindTree(); } else { throw new Exception("数据入库发生错误。"); } } catch (Exception ex) { XtraMessageBox.Show("更新失败:" + ex.Message, GlobalValue.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnRefreshData_Click(object sender, EventArgs e) { GlobalValue.groupList = NoiseDataBaseHelper.GetGroups(); GlobalValue.recorderList = NoiseDataBaseHelper.GetRecorders(); GlobalValue.controllerList = NoiseDataBaseHelper.GetController(); this.ClearView(); this.BindGroup(); }
// 移除记录仪 private void btnDelRecFromGroup_Click(object sender, EventArgs e) { try { //DialogResult dr = XtraMessageBox.Show("确定移除该记录仪?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question); //if (dr == System.Windows.Forms.DialogResult.Yes) //{ List <DevExpress.XtraTreeList.Nodes.TreeListNode> nodes = treeList1.GetAllCheckedNodes(); foreach (DevExpress.XtraTreeList.Nodes.TreeListNode item in nodes) { if (item.Level == 1) { int recID = Convert.ToInt32(item.GetValue("ID")); int gID = Convert.ToInt32(item.ParentNode.GetValue("Name")); for (int i = 0; i < GlobalValue.recorderList.Count; i++) { if (GlobalValue.recorderList[i].ID == recID) { GlobalValue.recorderList[i].GroupState = 0; NoiseDataBaseHelper.UpdateRecorder(GlobalValue.recorderList[i]); break; } } int query = NoiseDataBaseHelper.DeleteOneRelation(recID, gID); if (query != -1) { } } } btnDelRecFromGroup.Enabled = false; //NoiseRecorderGroup gp = (from temp in GlobalValue.groupList // where temp.ID == gID // select temp).ToList()[0]; //gp.RecorderList = NoiseDataBaseHelper.GetRecordersByGroupId(gp.ID); GlobalValue.recorderList = NoiseDataBaseHelper.GetRecorders(); GlobalValue.groupList = NoiseDataBaseHelper.GetGroups(); BindTree(); BindListBox(); GlobalValue.reReadIdList.Clear(); //} } catch (Exception ex) { XtraMessageBox.Show("移除失败:" + ex.Message, GlobalValue.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
// 分配记录仪 private void btnImportRec_Click(object sender, EventArgs e) { if (treeList1.Selection != null) { if (treeList1.Selection.Count == 0) { return; } if (treeList1.Selection[0].Level == 1) { return; } if (listBoxRec.Items.Count == 0) { XtraMessageBox.Show("当前无记录仪可分配!", GlobalValue.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (listBoxRec.SelectedItems.Count == 0) { XtraMessageBox.Show("请选择需要分配的记录仪!", GlobalValue.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } NoiseRecorderGroup gp = (from temp in GlobalValue.groupList where temp.ID == Convert.ToInt32(treeList1.Selection[0].GetValue("Name")) select temp).ToList()[0]; if (gp == null) { return; } for (int i = 0; i < listBoxRec.SelectedItems.Count; i++) { NoiseRecorder tmp = (from item in GlobalValue.recorderList.AsEnumerable() where item.ID.ToString() == listBoxRec.SelectedItems[i].ToString() select item).ToList()[0]; tmp.GroupState = 1; NoiseDataBaseHelper.AddRecorderGroupRelation(tmp.ID, gp.ID); NoiseDataBaseHelper.UpdateRecorder(tmp); } gp.RecorderList = NoiseDataBaseHelper.GetRecordersByGroupId(gp.ID); GlobalValue.recorderList = NoiseDataBaseHelper.GetRecorders(); BindTree(); BindListBox(); } }
private void btnImportApply_Click(object sender, EventArgs e) { NoiseRecorderGroup gp = (from temp in GlobalValue.groupList where temp.ID == Convert.ToInt32(btnImportRec.Tag) select temp).ToList()[0]; for (int i = 0; i < listBoxRec.SelectedItems.Count; i++) { NoiseRecorder tmp = (from item in GlobalValue.recorderList.AsEnumerable() where item.ID.ToString() == listBoxRec.SelectedItems[i].ToString() select item).ToList()[0]; tmp.GroupState = 1; NoiseDataBaseHelper.AddRecorderGroupRelation(tmp.ID, gp.ID); NoiseDataBaseHelper.UpdateRecorder(tmp); } gp.RecorderList = NoiseDataBaseHelper.GetRecordersByGroupId(gp.ID); GlobalValue.recorderList = NoiseDataBaseHelper.GetRecorders(); BindTree(); listBoxRec.Items.Clear(); }
/// <summary> /// 漏水判断(-1:处于最大最小标准值中间,需要通过别的方法综合判断 1:漏水 0:不漏水) /// </summary> /// <param name="data">噪声原始数据32个值一组</param> /// <param name="standvalue">静态漏水标准幅度值</param> /// <returns></returns> public static int IsLeak1(int GroupID, int RecorderID, List <double[]> lstdatas, out double energyvalue, out double leakprobability) { energyvalue = 0; //能量值 leakprobability = 0; //漏水概率 double maxstandvalue = Convert.ToDouble(Settings.Instance.GetString(SettingKeys.MaxStandardAMP)); double minstandvalue = Convert.ToDouble(Settings.Instance.GetString(SettingKeys.MinStandardAMP)); short[] standdata = NoiseDataBaseHelper.GetStandData(-1, RecorderID); //GroupID全部取-1,因为ID不重复 if (standdata == null) { return(-1); } int i = 0; double standaverage = 0; standaverage = GetAverage(standdata); List <double> lstaverage = new List <double>(); if (lstdatas != null && lstdatas.Count > 0) { for (i = 0; i < lstdatas.Count; i++) { lstaverage.Add(GetAverage(lstdatas[i])); } } int isleak = 1; double[] record_average = new double[lstaverage.Count]; lstaverage.CopyTo(record_average); //for (i = 0; i < lstaverage.Count; i++) //{ // lstaverage[i] = Math.Abs(standaverage - lstaverage[i]); // if (lstaverage[i] <= maxstandvalue) // { // isleak = 0; // } //} energyvalue = GetAverage(record_average.ToArray()); energyvalue = Math.Abs(standaverage - energyvalue); StreamWriter sw = new StreamWriter(string.Format("{0}能量强度变化数据.txt", GlobalValue.TestPath)); sw.WriteLine(standaverage); //先写入标准平均值 sw.WriteLine(energyvalue); //写入能量值 for (i = 0; i < record_average.Length; i++) { sw.WriteLine(record_average[i]); } sw.Flush(); sw.Close(); if (energyvalue >= maxstandvalue) { isleak = 1; leakprobability = 1; } else if (energyvalue <= minstandvalue) { isleak = 0; leakprobability = 0; } else { isleak = -1; leakprobability = 0.5 * (energyvalue - minstandvalue) / (maxstandvalue - minstandvalue); //能量强度权重50% } return(isleak); }
private void FrmSystem_Load(object sender, EventArgs e) { this.Text = "IGC DataLog系列产品应用软件" + "(" + Assembly.GetExecutingAssembly().GetName().Version.ToString() + ")"; // 读取数据库 初始化界面 try { GlobalValue.MainForm = this; SkinHelper.InitSkinGallery(this.ribbonGalleryBarItem1); SplashScreenManager.ShowForm(typeof(WelcomSplash)); if (SplashScreenManager.Default.IsSplashFormVisible) { SplashScreenManager.Default.SendCommand(null, "正在加载皮肤..."); } //Set Skin string skin = Settings.Instance.GetString(SettingKeys.Skin); if (string.IsNullOrEmpty(skin)) { skin = "SevenClassic"; } UserLookAndFeel.Default.SkinName = skin; //HideNavigateBar foreach (DevExpress.XtraNavBar.NavBarGroup group in this.navBarControl1.Groups) { foreach (DevExpress.XtraNavBar.NavBarItemLink itemlink in group.ItemLinks) { itemlink.Item.Visible = false; } group.Visible = false; } if (SplashScreenManager.Default.IsSplashFormVisible) { SplashScreenManager.Default.SendCommand(null, "正在加载控件..."); } #region 加载控件 var files = Directory.GetFiles(Application.StartupPath, "I*"); for (int i = 0; i < files.Length; i++) { if (System.Text.RegularExpressions.Regex.IsMatch(files[i], @".dll$")) { LoadAddin(files[i]); } } if (lstType != null && lstType.Count > 0) { InitNavigate(); } else { } #endregion BLL.NoiseDataHandler.TestPath = GlobalValue.TestPath; #region 数据库操作 //SQLiteDbManager dbMgr = new SQLiteDbManager(); //#region 创建数据库 ////如果数据库文件不存在创建 //if (!(dbMgr.Exists)) //{ // if (SplashScreenManager.Default.IsSplashFormVisible) // { // SplashScreenManager.Default.SendCommand(null, "正在创建数据库..."); // } // if (!dbMgr.ResetDatabase()) // { // //error.ErrorCode = -1; // logger.Error("ResetDatabase","创建数据库失败,请联系系统管理员"); // } //} //#endregion //#region 升级数据库 //DBVersion versionBLL = new DBVersion(); //string dbVersion = versionBLL.GetVersion(VersionType.DataBase.ToString()); //if (dbVersion != dbMgr.LastestDBVersion) //{ // if (SplashScreenManager.Default.IsSplashFormVisible) // { // SplashScreenManager.Default.SendCommand(null, "正在更新数据库..."); // } // if (!dbMgr.UpgradeDB()) // { // //error.ErrorCode = 0; // //error.ErrorMessage = " 自动升级数据库失败,请联系系统管理员"; // } // else // { // if (SplashScreenManager.Default.IsSplashFormVisible) // { // SplashScreenManager.Default.SendCommand(null, "正在更新数据库版本..."); // } // if (!versionBLL.UpdateVersion(VersionType.DataBase.ToString(), dbMgr.LastestDBVersion)) // { // //error.ErrorCode = 0; // //error.ErrorMessage = " 自动升级数据库失败,请联系系统管理员"; // } // } //} //#endregion #endregion bool DatabaseConnected = false; SQLHelper.ConnectionString = Settings.Instance.GetString(SettingKeys.DBString); if (!string.IsNullOrEmpty(SQLHelper.ConnectionString)) { bool sqlconnect = SQLHelper.TryConn(SQLHelper.ConnectionString); if (!sqlconnect) { if (DialogResult.No == XtraMessageBox.Show("连接SQL数据库失败,部分页面不会显示,请设置数据库连接!", "系统提示", MessageBoxButtons.YesNo, MessageBoxIcon.Error)) { //logger.Info("TryConn func:SQL数据库连接失败,主动退出"); //Application.Exit(); } else { barBtnSetDBConnect_ItemClick(null, null); } } else { DatabaseConnected = true; } } else { barBtnSetDBConnect_ItemClick(null, null); } if (DatabaseConnected) { if (SplashScreenManager.Default.IsSplashFormVisible) { SplashScreenManager.Default.SendCommand(null, "正在加载数据..."); } GlobalValue.groupList = NoiseDataBaseHelper.GetGroups(); GlobalValue.recorderList = NoiseDataBaseHelper.GetRecorders(); GlobalValue.controllerList = NoiseDataBaseHelper.GetController(); } if (SplashScreenManager.Default.IsSplashFormVisible) { SplashScreenManager.Default.SendCommand(null, "正在初始化参数..."); } GlobalValue.SerialPortMgr.SerialPortEvent += new SerialPortHandle(SerialPortMgr_SerialPortEvent); GlobalValue.SerialPortMgr.Start(); //if (string.IsNullOrEmpty(Settings.Instance.GetString(SettingKeys.GPRS_IP))|| string.IsNullOrEmpty(Settings.Instance.GetString(SettingKeys.GPRS_PORT))) //{ // XtraMessageBox.Show("未设置Socket地址,远传终端监控和招测将不能使用!", GlobalValue.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); //} //else //{ try { GlobalValue.SocketMgr.Start(); } catch (InvalidOperationException ex) { XtraMessageBox.Show(ex.Message + ",远传终端监控和招测将不能使用!", GlobalValue.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } //} SplashScreenManager.CloseForm(); ClearLogAndDb(); } catch (Exception ex) { XtraMessageBox.Show("初始化异常", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error); logger.ErrorException("FrmSystem_Load", ex); logger.Info(ex.StackTrace); Application.Exit(); } }
private void btnReadFromFold_Click(object sender, EventArgs e) { //if (!Regex.IsMatch(txtID.Text, @"^\d+$")) //{ // XtraMessageBox.Show("请输入一个记录仪ID!", GlobalValue.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); // txtID.Focus(); // return; //} if (!CheckFileExist()) { if (DialogResult.Yes == XtraMessageBox.Show("请将原始数据文件(txt)放入路径:" + OriginalFilePath + ",是否打开目录?", GlobalValue.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Information)) { btnOpenFold_Click(null, null); } return; } List <int> readIdList = new List <int>(); // 需要读取的ID列表 //readIdList.Add(Convert.ToInt32(txtID.Text)); bool isError = false; for (int j = 0; j < selectList.Count; j++) { if (!readIdList.Contains(selectList[j].ID)) { readIdList.Add(selectList[j].ID); } } if (selectList.Count != 0) { List <NoiseRecorder> lstSelecttmp = new List <NoiseRecorder>(); lstSelecttmp.AddRange(selectList.OrderBy(a => a.ID)); selectList = lstSelecttmp; btnReadFromFold.Enabled = false; List <NoiseData> dataList = new List <NoiseData>(); List <NoiseResult> resultList = new List <NoiseResult>(); GlobalValue.Noiselog.ValueChanged -= new ReadDataChangedEventHandler(log_ValueChanged); GlobalValue.Noiselog.ValueChanged += new ReadDataChangedEventHandler(log_ValueChanged); NoiseDataHandler.FourierData.Clear(); isReading = true; new Action(() => { try { foreach (var id in readIdList) { try { DisableRibbonBar(); DisableNavigateBar(); Thread.Sleep(1000); this.Invoke(new MethodInvoker(() => { for (int i = 0; i < gridViewGroupList.RowCount; i++) { if (gridViewGroupList.GetRowCellValue(i, "选择") != null) { if (gridViewGroupList.GetRowCellValue(i, "记录仪编号").ToString() == id.ToString()) { gridViewGroupList.SetRowCellValue(i, "读取进度", 0); this.rowHandle = i; break; } } } })); Dictionary <short, short[]> result = new Dictionary <short, short[]>(); SetStaticItem(string.Format("正在读取记录仪{0}...", id)); ShowWaitForm("", string.Format("正在读取记录仪{0}...", id)); short[] arr = GetDataFromFiles(); if (arr == null || arr.Length == 0) { throw new ArgumentNullException("数据获取失败"); } result.Add((short)id, arr); string TestPath = Application.StartupPath + @"\Data\记录仪{0}\"; string errmsg = NoiseDataHandler.CallbackReaded(result, selectList, TestPath, ref GlobalValue.recorderList); if (!string.IsNullOrEmpty(errmsg)) { ShowDialog("记录仪" + id + "分析数据发生错误,errmsg:" + errmsg, GlobalValue.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); isError = true; return; } GlobalValue.reReadIdList.Remove(id); NoiseRecorder gpRec = (from item in GlobalValue.recorderList.AsEnumerable() where item.ID == id select item).ToList()[0]; dataList.Add(gpRec.Data); resultList.Add(gpRec.Result); BindResult(gpRec); } catch (TimeoutException) { ShowDialog("记录仪" + id + "读取超时!", GlobalValue.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); isError = true; } catch (ArgumentNullException) { ShowDialog("记录仪" + id + "数据为空!", GlobalValue.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); isError = true; } } } catch (Exception) { } finally { isReading = false; SetStaticItem("数据读取完成"); btnReadFromFold.Enabled = true; HideWaitForm(); EnableRibbonBar(); EnableNavigateBar(); if (dataList.Count != 0) { DialogResult dr = XtraMessageBox.Show("已成功读取" + dataList.Count + "条数据,是否保存到数据库?", GlobalValue.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == System.Windows.Forms.DialogResult.Yes) { for (int i = 0; i < dataList.Count; i++) { NoiseDataBaseHelper.AddNoiseData(dataList[i]); NoiseDataBaseHelper.AddNoiseResult(resultList[i]); GlobalValue.recorderList = NoiseDataBaseHelper.GetRecorders(); GlobalValue.groupList = NoiseDataBaseHelper.GetGroups(); } } } } }).BeginInvoke(null, null); } else { XtraMessageBox.Show("请勾选需要读取的记录仪!", GlobalValue.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public override void OnSerialPortNotify(object sender, SerialPortEventArgs e) { if (e.TransactStatus != TransStatus.Start && e.OptType == SerialPortType.NoiseReadData) { string message = string.Empty; if (e.Tag != null) { message = e.Tag.ToString(); } this.Enabled = true; simpleButtonRead.Enabled = true; simpleButtonSelectAll.Enabled = true; simpleButtonUnSelect.Enabled = true; HideWaitForm(); EnableRibbonBar(); EnableNavigateBar(); GlobalValue.SerialPortMgr.SerialPortEvent -= new SerialPortHandle(SerialPortNotify); if (e.TransactStatus == TransStatus.Success) { Dictionary <short, short[]> result = new Dictionary <short, short[]>(); result.Add(GlobalValue.NoiseSerialPortOptData.ID, (short[])e.Tag); string TestPath = Application.StartupPath + @"\Data\记录仪{0}\"; string errmsg = NoiseDataHandler.CallbackReaded(result, selectList, TestPath, ref GlobalValue.recorderList); if (!string.IsNullOrEmpty(errmsg)) { ShowDialog("分析数据发生错误,errmsg:" + errmsg, GlobalValue.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } GlobalValue.reReadIdList.Remove(GlobalValue.NoiseSerialPortOptData.ID); NoiseRecorder gpRec = (from item in GlobalValue.recorderList.AsEnumerable() where item.ID == GlobalValue.NoiseSerialPortOptData.ID select item).ToList()[0]; dataList.Add(gpRec.Data); resultList.Add(gpRec.Result); BindResult(gpRec); if (ReadIdList != null && ReadIdList.Count > 0) { ReadData(Convert.ToInt16(ReadIdList.Dequeue())); } else { if (dataList.Count != 0) { DialogResult dr = XtraMessageBox.Show("已成功读取" + dataList.Count + "条数据,是否保存到数据库?", GlobalValue.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == System.Windows.Forms.DialogResult.Yes) { for (int i = 0; i < dataList.Count; i++) { NoiseDataBaseHelper.AddNoiseData(dataList[i]); NoiseDataBaseHelper.AddNoiseResult(resultList[i]); GlobalValue.recorderList = NoiseDataBaseHelper.GetRecorders(); GlobalValue.groupList = NoiseDataBaseHelper.GetGroups(); } } } } gridViewResultList.RefreshData(); } else { XtraMessageBox.Show("读取数据失败!" + e.Msg, GlobalValue.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); if (ReadIdList != null && ReadIdList.Count > 0) { ReadData(Convert.ToInt16(ReadIdList.Dequeue())); } else { if (dataList.Count != 0) { DialogResult dr = XtraMessageBox.Show("已成功读取" + dataList.Count + "条数据,是否保存到数据库?", GlobalValue.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == System.Windows.Forms.DialogResult.Yes) { for (int i = 0; i < dataList.Count; i++) { NoiseDataBaseHelper.AddNoiseData(dataList[i]); NoiseDataBaseHelper.AddNoiseResult(resultList[i]); GlobalValue.recorderList = NoiseDataBaseHelper.GetRecorders(); GlobalValue.groupList = NoiseDataBaseHelper.GetGroups(); } } } } gridViewResultList.RefreshData(); } } }
public override void OnSerialPortNotify(object sender, SerialPortEventArgs e) { if (e.TransactStatus != TransStatus.Start && e.OptType == SerialPortType.NoiseBatchWrite) { if (e.TransactStatus == TransStatus.Success) { if (OptRecList != null && OptRecList.Count > currentOptRecIndex) { // 更新设置入库 int query = NoiseDataBaseHelper.UpdateRecorder(OptRecList[currentOptRecIndex]); if (query != -1) { //XtraMessageBox.Show("噪声记录仪[" + currentRec.ID + "]设置成功!", GlobalValue.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); GlobalValue.recorderList = NoiseDataBaseHelper.GetRecorders(); GlobalValue.groupList = NoiseDataBaseHelper.GetGroups(); } else { XtraMessageBox.Show("噪声记录仪[" + OptRecList[currentOptRecIndex].ID + "]数据入库发生错误!", GlobalValue.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Information); } if (++currentOptRecIndex < OptRecList.Count) { GlobalValue.NoiseSerialPortOptData.ID = Convert.ToInt16(OptRecList[currentOptRecIndex].ID); GlobalValue.SerialPortMgr.Send(SerialPortType.NoiseBatchWrite); } else { this.Enabled = true; GlobalValue.SerialPortMgr.SerialPortEvent -= new SerialPortHandle(SerialPortNotify); EnableRibbonBar(); EnableNavigateBar(); HideWaitForm(); XtraMessageBox.Show("批量设置噪声记录仪参数成功!", GlobalValue.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } } } else { if (OptRecList != null && OptRecList.Count > currentOptRecIndex) { HideWaitForm(); if (DialogResult.Yes == XtraMessageBox.Show("噪声记录仪[" + OptRecList[currentOptRecIndex].ID + "]设置参数失败,是否重试?" + e.Msg, GlobalValue.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Information)) { GlobalValue.SerialPortMgr.Send(SerialPortType.NoiseBatchWrite); } else { if (++currentOptRecIndex < OptRecList.Count) { GlobalValue.NoiseSerialPortOptData.ID = Convert.ToInt16(OptRecList[currentOptRecIndex].ID); GlobalValue.SerialPortMgr.Send(SerialPortType.NoiseBatchWrite); } else { this.Enabled = true; GlobalValue.SerialPortMgr.SerialPortEvent -= new SerialPortHandle(SerialPortNotify); EnableRibbonBar(); EnableNavigateBar(); HideWaitForm(); } } } else { XtraMessageBox.Show("噪声记录仪设置参数失败!" + e.Msg, GlobalValue.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); this.Enabled = true; GlobalValue.SerialPortMgr.SerialPortEvent -= new SerialPortHandle(SerialPortNotify); EnableRibbonBar(); EnableNavigateBar(); HideWaitForm(); } } } }