private void processXML(string xmlpath) { // 1. 获取电柜信息,更新到UI ,此处可以另开线程 string house = null, cabin = null, side = null; xmlProcess.XMLtoCabinInfo(xmlpath, ref house, ref cabin, ref side); labelRom.Text = house; labelCab.Text = cabin; labelFac.Text = side; dataGridViewStatus.Rows.Clear(); // 圆形进度条结束,定位信息显示 panelLocationDetail.Show(); circularProgressBarLocation.Value = 100; circularProgressBarLocation.Text = "定位成功......"; circularProgressBarLocation.Style = ProgressBarStyle.Continuous; circularProgressBarLocation.MarqueeAnimationSpeed = 0; Delay(100); //delay是为了界面更新 // 1.2 获取新的和旧的二维码位置 //QRCodeInfo qrcode = new QRCodeInfo(); //visiondll.GetQRregion(imgPath, ref qrcode); //QRCodeInfo qrcodeOrigin = new QRCodeInfo(); //xmlProcess.GetQRregionorigin(xmlpath, ref qrcodeOrigin); // 1.2 int cameraSide = 0; if (side.Equals("远侧FarFace")) { cameraSide = DLLDefine.sg_Camera_Far; } else if (side.Equals("近侧NearFace")) { cameraSide = DLLDefine.sg_Camera_Near; } else { MessageBox.Show("相机远近侧参数确实,请确认!"); return; } // 2. 分析任务序列 List <DetectInfo> detectList = xmlProcess.xmlToTaskList(xmlpath); int detectSize = detectList.Count(); // 2.01 根据任务序列绘制ROI数组,并显示图像 ROIInfo[] roiarray = new ROIInfo[detectSize]; string roiPath = null; dataflow.GetROIArrayFormDetectList(detectList, ref roiarray); //获取ROI数组 //dataflow.GetROIArrayFormDetectListwithQRCode(detectList, ref roiarray, qrcode, qrcodeOrigin); //获取换算之后的ROI数组,顺便把Detect的ROI也改了 visiondll.ROIArrayDraw(imgPath, roiarray, ref roiPath, cameraSide); //绘制ROI区域 pictureBoxProcessed.Image = Image.FromFile(roiPath); //显示绘制ROI后的图像 Delay(200); //delay是为了界面更新 // 2.1 分别进行检测,并更新界面进度信息 int detectNow = 0; processUpdateUI(detectNow, detectSize); //重置UI foreach (DetectInfo item in detectList) { string procdpath = null; DetectInfo detect = item; visiondll.DetectTaskSend(imgPath, ref procdpath, ref detect, cameraSide); //这一步得到检测结果,下一步应该是对检测结果进行一下数据的换算,需要从配置表中获取语义 // UI 结果显示 小表格(仪表名称和检测结果),显示语义,调用自身类的转换功能实现数据到语义的转换 dataGridViewStatus.Rows.Add(detect.deviceName, detect.GetResultWithRefer()); // UI 结果显示 大表格(巡检数据结果),显示序号、时间、设备名称、检测结果、报警类型,并保存到数据库 // TODO: 对检测结果进行报警判断 detectResultSave(house, cabin, detect.deviceName, detect.GetResultWithRefer(), "正常", detect.GetDetectClass()); // TODO 结果显示2. 大表格,大表格涉及到数据库的传入。暂不涉及 // UI 进度更新 detectNow = detectNow + 1; processUpdateUI(detectNow, detectSize); //更新UI Delay(500); //delay是为了界面更新 } }