private static void DataCheckRelizeFunction(string name, int pValue, ProgressChangeEvent eInfo, IDataCheckHook hook, IDataCheckLogic dataCheckLogic) { object objLock = new object(); lock (objLock) { if (DicCheck.ContainsKey(name)) { DicCheck[name].OnCreate(hook); (DicCheck[name] as ICheckEvent).DataErrTreat += new DataErrTreatHandle(dataCheckLogic.DataCheckLogic_DataErrTreat); (DicCheck[name] as ICheckEvent).ProgressShow += new ProgressChangeHandle(GeoDataChecker_ProgressShow); DicCheck[name].OnDataCheck(); //进度条加1 pValue++; eInfo.Value = pValue; //_CheckForm.Invoke(new ChangeProgressBarOut(changeProgressOut), new object[] { pValue }); //进度条控制 GeoDataChecker_ProgressShow((object)_PrgressBarOut, eInfo); } } }
//加载执行检查功能 public static void LoadDataCheckLogicFunction(string logicFunName, IDataCheckHook hook, IDataCheckLogic dataCheckLogic) { IArcgisDataCheckHook dataCheckHook = hook as IArcgisDataCheckHook; if (dataCheckHook == null) { return; } IArcgisDataCheckParaSet checkParaSet = dataCheckHook.DataCheckParaSet as IArcgisDataCheckParaSet; if (checkParaSet == null) { return; } if (checkParaSet.XmlDocDataCheckSet == null) { return; } XmlNode aNode = checkParaSet.XmlDocDataCheckSet.DocumentElement.SelectSingleNode(".//LogicCheckFunction[@Name='" + logicFunName + "']"); if (aNode == null) { return; } if (aNode.ChildNodes.Count == 0) { return; } if (DicCheck == null) { return; } //设置进度条 //int pMax = aNode.ChildNodes.Count; //_CheckForm.Invoke(new IntiProgressBarOut(intiaProgressout), new object[] { pMax }); m_DicTopoDataCheck = new Dictionary <string, string>(); int pValue = 0; ProgressChangeEvent eInfo = new ProgressChangeEvent(); eInfo.Max = aNode.ChildNodes.Count; foreach (XmlNode childNode in aNode.ChildNodes) { XmlElement childElement = childNode as XmlElement; if (!childElement.HasAttribute("Name")) { continue; } string name = childElement.GetAttribute("Name"); string pText = childElement.GetAttribute("text").Trim(); string pType = childElement.GetAttribute("type").Trim(); if (pType == "拓扑检查") { if (!m_DicTopoDataCheck.ContainsKey(name)) { m_DicTopoDataCheck.Add(name, pText); } continue; } //if (DicCheck.ContainsKey(name)) //{ // _CheckForm.Invoke(new ShowErrorInfo(showEInfo), new object[] { pText }); // DicCheck[name].OnCreate(hook); // (DicCheck[name] as ICheckEvent).DataErrTreat += new DataErrTreatHandle(dataCheckLogic.DataCheckLogic_DataErrTreat); // (DicCheck[name] as ICheckEvent).ProgressShow += new ProgressChangeHandle(GeoDataChecker_ProgressShow); // DicCheck[name].OnDataCheck(); // //进度条加1 // pValue++; // eInfo.Value = pValue; // //进度条控制 // GeoDataChecker_ProgressShow((object)_PrgressBarOut, eInfo); //} } if (m_DicTopoDataCheck != null && m_DicTopoDataCheck.Count != 0) { //进行拓扑检查 if (DicCheck.ContainsKey("GeoDataChecker.GeoTopologyCheck")) { _CheckForm.Invoke(new ShowErrorInfo(showEInfo), new object[] { "进行拓扑检查" }); DicCheck["GeoDataChecker.GeoTopologyCheck"].OnCreate(hook); (DicCheck["GeoDataChecker.GeoTopologyCheck"] as ICheckEvent).DataErrTreat += new DataErrTreatHandle(dataCheckLogic.DataCheckLogic_DataErrTreat); (DicCheck["GeoDataChecker.GeoTopologyCheck"] as ICheckEvent).ProgressShow += new ProgressChangeHandle(GeoDataChecker_ProgressShow); DicCheck["GeoDataChecker.GeoTopologyCheck"].OnDataCheck(); pValue++; eInfo.Value = pValue; //进度条控制 GeoDataChecker_ProgressShow((object)_PrgressBarOut, eInfo); } } foreach (XmlNode childNode in aNode.ChildNodes) { XmlElement childElement = childNode as XmlElement; if (!childElement.HasAttribute("Name")) { continue; } string name = childElement.GetAttribute("Name"); string pText = childElement.GetAttribute("text").Trim(); string pType = childElement.GetAttribute("type").Trim(); if (pType == "拓扑检查") { continue; } if (DicCheck.ContainsKey(name)) { _CheckForm.Invoke(new ShowErrorInfo(showEInfo), new object[] { pText }); DicCheck[name].OnCreate(hook); (DicCheck[name] as ICheckEvent).DataErrTreat += new DataErrTreatHandle(dataCheckLogic.DataCheckLogic_DataErrTreat); (DicCheck[name] as ICheckEvent).ProgressShow += new ProgressChangeHandle(GeoDataChecker_ProgressShow); DicCheck[name].OnDataCheck(); //进度条加1 pValue++; eInfo.Value = pValue; //进度条控制 GeoDataChecker_ProgressShow((object)_PrgressBarOut, eInfo); } } /* * int pValue = 0; * ProgressChangeEvent eInfo = new ProgressChangeEvent(); * eInfo.Max=aNode.ChildNodes.Count; * * foreach (XmlNode childNode in aNode.ChildNodes) * { * XmlElement childElement = childNode as XmlElement; * if (!childElement.HasAttribute("Name")) continue; * string name = childElement.GetAttribute("Name"); * string pText = childElement.GetAttribute("text").Trim(); * * //如果不是库体结构检查,就用多线程 * //Thread pThread = new Thread(new ThreadStart(delegate { DataCheckRelizeFunction(name, pValue, eInfo, hook, dataCheckLogic); })); * //pThread.Start(); * if (DicCheck.ContainsKey(name)) * { * _CheckForm.Invoke(new ShowErrorInfo(showEInfo), new object[] { pText }); * * DicCheck[name].OnCreate(hook); * (DicCheck[name] as ICheckEvent).DataErrTreat += new DataErrTreatHandle(dataCheckLogic.DataCheckLogic_DataErrTreat); * (DicCheck[name] as ICheckEvent).ProgressShow += new ProgressChangeHandle(GeoDataChecker_ProgressShow); * DicCheck[name].OnDataCheck(); * //进度条加1 * pValue++; * eInfo.Value = pValue; * //_CheckForm.Invoke(new ChangeProgressBarOut(changeProgressOut), new object[] { pValue }); * //进度条控制 * GeoDataChecker_ProgressShow((object)_PrgressBarOut, eInfo); * } * } * */ }