ProgMgrInfoForm.cs 76 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Windows.Forms;
  5. using System.Text.RegularExpressions;
  6. using System.Collections;
  7. using System.Diagnostics;
  8. using OTSDataType;
  9. using OTSModelSharp;
  10. using System.IO;
  11. using static OTSModelSharp.ResourceManage.ResourceData;
  12. using static OTSDataType.otsdataconst;
  13. using OTSModelSharp.Measure.GetStageInfo;
  14. using OTSMeasureApp._3_OTSDisplaySourceGridData;
  15. namespace OTSMeasureApp
  16. {
  17. public partial class ProgMgrInfoForm :Form
  18. {
  19. #region 定义变量
  20. //初始化函数功能类
  21. public CStage m_cstage; //样品台类
  22. public CStageParam m_cstagefile; //样品台文件类
  23. public COTSDefaultParam m_cotsprogmgrparamfile; //参数类
  24. public CSEMStageData m_csemstagedata; //SEM样品台处理类
  25. public COTSImgScanPrm m_cotsimgscanprm; //图像扫描类
  26. public COTSGeneralParam m_cgenparam; //一般参数类
  27. public COTSImageProcParam m_cotsimgprocprm; //图像处理类
  28. public COTSXRayParam m_cotsxrayprm;
  29. public bool m_b_checkstagefile = false;
  30. //定位程序管理路径用的变量
  31. public string m_ParameterPath;
  32. frmMeasureStopMode StopModeDialog;
  33. //国际化
  34. OTSCommon.Language lan;
  35. Hashtable table;
  36. NLog.Logger log ;
  37. #endregion
  38. /// <summary>
  39. /// 样品台加载
  40. /// </summary>
  41. /// <returns></returns>
  42. public bool StageLoad()
  43. {
  44. if (!m_cstagefile.Load( true, !m_b_checkstagefile))
  45. {
  46. log.Error("(OTSProgMgrInfoFun.StageLoad) 加载样品台信息失败");
  47. return false;
  48. }
  49. return true;
  50. }
  51. #region 构造函数
  52. /// <summary>
  53. /// 默认构造函数
  54. /// </summary>
  55. public ProgMgrInfoForm()
  56. {
  57. log = NLog.LogManager.GetCurrentClassLogger();
  58. m_cotsprogmgrparamfile = new COTSDefaultParam();
  59. m_cstagefile = new CStageParam();
  60. InitializeComponent();
  61. //国际化
  62. lan = new OTSCommon.Language(this);
  63. table = lan.GetNameTable(this.Name);
  64. }
  65. #endregion
  66. #region 绑定各combobox控件
  67. /// <summary>
  68. /// 绑定各combobox控件下拉列表
  69. /// </summary>
  70. public void BindComboBox()
  71. {
  72. //样品台
  73. if (!StageLoad())
  74. {
  75. this.Close();
  76. return;//加载失败返回
  77. }
  78. //绑定样品台列表信息
  79. BindStageCombobox();
  80. //初始化选项,下拉框---------------------------------------------
  81. //绑定标准库
  82. IDC_COMBO_STDSelect.Items.Clear();
  83. string STDLibFolderName = m_cgenparam.GetPartSTDLibFolderName();
  84. string[] files = System.IO.Directory.GetFiles(STDLibFolderName, "*.db");
  85. System.IO.DirectoryInfo folder = new System.IO.DirectoryInfo(STDLibFolderName);
  86. foreach (System.IO.FileInfo file in folder.GetFiles("*.db"))
  87. {
  88. ComboBoxItem cbi = new ComboBoxItem();
  89. string FileNameWithoutExtension = Path.GetFileNameWithoutExtension(file.FullName);
  90. cbi.Text = FileNameWithoutExtension;
  91. //cbi.Value = (int)enum_one;
  92. IDC_COMBO_STDSelect.Items.Add(cbi);
  93. }
  94. //添加下拉列表中null项
  95. ComboBoxItem cbiNull = new ComboBoxItem();
  96. cbiNull.Text = "NoSTDDB";
  97. //cbi.Value = (int)enum_one;
  98. IDC_COMBO_STDSelect.Items.Add(cbiNull);
  99. this.IDC_COMBO_STDSelect.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_STDSelect_SelectedIndexChanged);
  100. if (IDC_COMBO_STDSelect.Items.Count > 0)
  101. IDC_COMBO_STDSelect.SelectedIndex = 0;
  102. //----------------------------------------------------------------------
  103. this.IDC_COMBO_STDSelect.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_STDSelect_SelectedIndexChanged);
  104. //x轴方向
  105. IDC_COMBO_XDIREC.Items.Clear();
  106. foreach (otsdataconst.OTS_X_AXIS_DIRECTION enum_one in Enum.GetValues(typeof(otsdataconst.OTS_X_AXIS_DIRECTION)))
  107. {
  108. ComboBoxItem cbi = new ComboBoxItem();
  109. cbi.Text = GetXAxisDirectionIdString(enum_one);
  110. cbi.Value = (int)enum_one;
  111. IDC_COMBO_XDIREC.Items.Add(cbi);
  112. }
  113. this.IDC_COMBO_XDIREC.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_XDIREC_SelectedIndexChanged);
  114. if (IDC_COMBO_XDIREC.Items.Count > 0)
  115. IDC_COMBO_XDIREC.SelectedIndex = 0;
  116. this.IDC_COMBO_XDIREC.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_XDIREC_SelectedIndexChanged);
  117. //y轴方向
  118. IDC_COMBO_YDIRECT.Items.Clear();
  119. foreach (otsdataconst.OTS_Y_AXIS_DIRECTION enum_one in Enum.GetValues(typeof(otsdataconst.OTS_Y_AXIS_DIRECTION)))
  120. {
  121. ComboBoxItem cbi = new ComboBoxItem();
  122. cbi.Text = GetYAxisDirectionIdString(enum_one);
  123. cbi.Value = (int)enum_one;
  124. IDC_COMBO_YDIRECT.Items.Add(cbi);
  125. }
  126. this.IDC_COMBO_YDIRECT.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_YDIRECT_SelectedIndexChanged);
  127. if (IDC_COMBO_YDIRECT.Items.Count > 0)
  128. IDC_COMBO_YDIRECT.SelectedIndex = 0;
  129. this.IDC_COMBO_YDIRECT.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_YDIRECT_SelectedIndexChanged);
  130. //取图方式
  131. IDC_COMBO_FETCHIMGMODE.Items.Clear();
  132. foreach (otsdataconst.OTS_GET_IMAGE_MODE enum_one in Enum.GetValues(typeof(otsdataconst.OTS_GET_IMAGE_MODE)))
  133. {
  134. ComboBoxItem cbi = new ComboBoxItem();
  135. cbi.Text = GetGetImageIdString(enum_one);
  136. cbi.Value = (int)enum_one;
  137. IDC_COMBO_FETCHIMGMODE.Items.Add(cbi);
  138. }
  139. this.IDC_COMBO_FETCHIMGMODE.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_FETCHIMGMODE_SelectedIndexChanged);
  140. if (IDC_COMBO_FETCHIMGMODE.Items.Count > 0)
  141. IDC_COMBO_FETCHIMGMODE.SelectedIndex = 0;
  142. this.IDC_COMBO_FETCHIMGMODE.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_FETCHIMGMODE_SelectedIndexChanged);
  143. //扫描图精度
  144. IDC_COMBO_IMGSCANSPEED.Items.Clear();
  145. foreach (otsdataconst.OTS_IMAGE_SCANSPEED_OPTIONS enum_one in Enum.GetValues(typeof(otsdataconst.OTS_IMAGE_SCANSPEED_OPTIONS)))
  146. {
  147. ComboBoxItem cbi = new ComboBoxItem();
  148. cbi.Text = GetScanSpeedString(enum_one);
  149. cbi.Value = (int)enum_one;
  150. IDC_COMBO_IMGSCANSPEED.Items.Add(cbi);
  151. }
  152. this.IDC_COMBO_IMGSCANSPEED.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_IMGSCANSPEED_SelectedIndexChanged);
  153. if (IDC_COMBO_IMGSCANSPEED.Items.Count > 0)
  154. IDC_COMBO_IMGSCANSPEED.SelectedIndex = 0;
  155. this.IDC_COMBO_IMGSCANSPEED.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_IMGSCANSPEED_SelectedIndexChanged);
  156. //扫描图尺寸
  157. IDC_COMBO_IMGSIZE.Items.Clear();
  158. foreach (otsdataconst.OTS_IMAGE_RESULOTION_OPTIONS enum_one in Enum.GetValues(typeof(otsdataconst.OTS_IMAGE_RESULOTION_OPTIONS)))
  159. {
  160. ComboBoxItem cbi = new ComboBoxItem();
  161. cbi.Text = GetImageSizeIdString(enum_one);
  162. cbi.Value = (int)enum_one;
  163. IDC_COMBO_IMGSIZE.Items.Add(cbi);
  164. }
  165. this.IDC_COMBO_IMGSIZE.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_IMGSIZE_SelectedIndexChanged);
  166. if (IDC_COMBO_IMGSIZE.Items.Count > 0)
  167. IDC_COMBO_IMGSIZE.SelectedIndex = 0;
  168. this.IDC_COMBO_IMGSIZE.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_IMGSIZE_SelectedIndexChanged);
  169. ////搜索X-Ray精度
  170. //IDC_COMBO_SEARCHXRAYSPEED.Items.Clear();
  171. //foreach (otsdataconst.OTS_IMAGE_SCANSPEED_OPTIONS enum_one in Enum.GetValues(typeof(otsdataconst.OTS_IMAGE_SCANSPEED_OPTIONS)))
  172. //{
  173. // ComboBoxItem cbi = new ComboBoxItem();
  174. // cbi.Text = GetXRaySearchSpeedIdString(enum_one);
  175. // cbi.Value = (int)enum_one;
  176. // IDC_COMBO_SEARCHXRAYSPEED.Items.Add(cbi);
  177. //}
  178. //this.IDC_COMBO_SEARCHXRAYSPEED.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_SEARCHXRAYSPEED_SelectedIndexChanged);
  179. //if (IDC_COMBO_SEARCHXRAYSPEED.Items.Count > 0)
  180. // IDC_COMBO_SEARCHXRAYSPEED.SelectedIndex = 0;
  181. //this.IDC_COMBO_SEARCHXRAYSPEED.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_SEARCHXRAYSPEED_SelectedIndexChanged);
  182. //去背景方式
  183. IDC_COMBO_BGREMOVETYPE.Items.Clear();
  184. foreach (otsdataconst.OTS_AUTOBGREMOVETYPE enum_one in Enum.GetValues(typeof(otsdataconst.OTS_AUTOBGREMOVETYPE)))
  185. {
  186. ComboBoxItem cbi = new ComboBoxItem();
  187. cbi.Text = GetBGREMOVETYPEString(enum_one);
  188. cbi.Value = (int)enum_one;
  189. IDC_COMBO_BGREMOVETYPE.Items.Add(cbi);
  190. }
  191. this.IDC_COMBO_BGREMOVETYPE.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_BGREMOVETYPE_SelectedIndexChanged);
  192. if (IDC_COMBO_BGREMOVETYPE.Items.Count > 0)
  193. IDC_COMBO_BGREMOVETYPE.SelectedIndex = 0;
  194. this.IDC_COMBO_BGREMOVETYPE.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_BGREMOVETYPE_SelectedIndexChanged);
  195. //自动去背景方式
  196. IDC_COMBO_AUTOBGREMOVETYP.Items.Clear();
  197. foreach (otsdataconst.OTS_IMAGE_MODE enum_one in Enum.GetValues(typeof(otsdataconst.OTS_IMAGE_MODE)))
  198. {
  199. ComboBoxItem cbi = new ComboBoxItem();
  200. cbi.Text = GetAUTOBGREMOVETYPEString(enum_one);
  201. cbi.Value = (int)enum_one;
  202. IDC_COMBO_AUTOBGREMOVETYP.Items.Add(cbi);
  203. }
  204. this.IDC_COMBO_AUTOBGREMOVETYP.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_AUTOBGREMOVETYPE_SelectedIndexChanged);
  205. if (IDC_COMBO_AUTOBGREMOVETYP.Items.Count > 0)
  206. IDC_COMBO_AUTOBGREMOVETYP.SelectedIndex = 0;
  207. this.IDC_COMBO_AUTOBGREMOVETYP.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_AUTOBGREMOVETYPE_SelectedIndexChanged);
  208. //腐蚀膨胀系数
  209. //IDC_COMBO_CorrosionExpansionCoefficient.Items.Clear();
  210. //ComboBoxItem ci = new ComboBoxItem();
  211. //ci.Text = "0";
  212. //ci.Value = 0;
  213. //IDC_COMBO_CorrosionExpansionCoefficient.Items.Add(ci);
  214. //for (int i=1;i<6;i++)
  215. //{
  216. // ComboBoxItem cbi = new ComboBoxItem();
  217. // cbi.Text = (i*2+1).ToString();
  218. // cbi.Value = i;
  219. // IDC_COMBO_CorrosionExpansionCoefficient.Items.Add(cbi);
  220. //}
  221. //X-Ray扫描方式
  222. IDC_COMBO_XRAYSCANMODE.Items.Clear();
  223. foreach (otsdataconst.OTS_X_RAY_SCAN_MODE enum_one in Enum.GetValues(typeof(otsdataconst.OTS_X_RAY_SCAN_MODE)))
  224. {
  225. ComboBoxItem cbi = new ComboBoxItem();
  226. cbi.Text = GetXRayScanModeIdString(enum_one);
  227. cbi.Value = (int)enum_one;
  228. //只添加点扫描
  229. IDC_COMBO_XRAYSCANMODE.Items.Add(cbi);
  230. }
  231. this.IDC_COMBO_XRAYSCANMODE.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_XRAYSCANMODE_SelectedIndexChanged);
  232. if (IDC_COMBO_XRAYSCANMODE.Items.Count > 0)
  233. IDC_COMBO_XRAYSCANMODE.SelectedIndex = 0;
  234. this.IDC_COMBO_XRAYSCANMODE.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_XRAYSCANMODE_SelectedIndexChanged);
  235. //分析X-Ray精度
  236. IDC_COMBO_ANALYXRAYSPEED.Items.Clear();
  237. foreach (otsdataconst.OTS_IMAGE_SCANSPEED_OPTIONS enum_one in Enum.GetValues(typeof(otsdataconst.OTS_IMAGE_SCANSPEED_OPTIONS)))
  238. {
  239. ComboBoxItem cbi = new ComboBoxItem();
  240. cbi.Text = GetXRayAnalySpeedIdString(enum_one);
  241. cbi.Value = (int)enum_one;
  242. IDC_COMBO_ANALYXRAYSPEED.Items.Add(cbi);
  243. }
  244. this.IDC_COMBO_ANALYXRAYSPEED.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_ANALYXRAYSPEED_SelectedIndexChanged);
  245. if (IDC_COMBO_ANALYXRAYSPEED.Items.Count > 0)
  246. IDC_COMBO_ANALYXRAYSPEED.SelectedIndex = 0;
  247. this.IDC_COMBO_ANALYXRAYSPEED.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_ANALYXRAYSPEED_SelectedIndexChanged);
  248. //精炼工艺下拉框选项
  249. IDC_COMBO_TECHNOLOGY.Items.Clear();
  250. foreach (STEEL_TECHNOLOGY enum_one in Enum.GetValues(typeof(STEEL_TECHNOLOGY)))
  251. {
  252. ComboBoxItem cbi = new ComboBoxItem();
  253. cbi.Text = GetSteelTechIdString((otsdataconst.STEEL_TECHNOLOGY)enum_one);
  254. cbi.Value = (int)enum_one;
  255. IDC_COMBO_TECHNOLOGY.Items.Add(cbi);
  256. }
  257. this.IDC_COMBO_TECHNOLOGY.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_TECHNOLOGY_SelectedIndexChanged);
  258. if (IDC_COMBO_TECHNOLOGY.Items.Count > 0)
  259. IDC_COMBO_TECHNOLOGY.SelectedIndex = 0;
  260. this.IDC_COMBO_TECHNOLOGY.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_TECHNOLOGY_SelectedIndexChanged);
  261. //测量区域形状
  262. cBMeasShape.Items.Clear();
  263. foreach (otsdataconst.MEASURE_SHAPE enum_one in Enum.GetValues(typeof(otsdataconst.MEASURE_SHAPE)))
  264. {
  265. ComboBoxItem cbi = new ComboBoxItem();
  266. cbi.Text = GetAreaShapeString(enum_one);
  267. cbi.Value = (int)enum_one;
  268. cBMeasShape.Items.Add(cbi);
  269. }
  270. this.cBMeasShape.SelectedIndexChanged -= new System.EventHandler(this.cBMeasShape_SelectedIndexChanged);
  271. if (cBMeasShape.Items.Count > 0)
  272. cBMeasShape.SelectedIndex = 0;
  273. this.cBMeasShape.SelectedIndexChanged += new System.EventHandler(this.cBMeasShape_SelectedIndexChanged);
  274. //模式选择
  275. IDC_COMBO_Model.Items.Clear();
  276. foreach (otsdataconst.RunMode enum_one in Enum.GetValues(typeof(otsdataconst.RunMode)))
  277. {
  278. OTSPeriodicTable.ComboBoxItem cbi = new OTSPeriodicTable.ComboBoxItem();
  279. cbi.Text = GetRunModeString(enum_one);
  280. cbi.Value = (int)enum_one;
  281. IDC_COMBO_Model.Items.Add(cbi);
  282. }
  283. this.IDC_COMBO_Model.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_Model_SelectedIndexChanged);
  284. if (IDC_COMBO_Model.Items.Count > 0)
  285. IDC_COMBO_Model.SelectedIndex = 0;
  286. this.IDC_COMBO_Model.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_Model_SelectedIndexChanged);
  287. }
  288. public CStage GetWorkingStage()
  289. {
  290. CStage ls_cstageclr = m_cstagefile.GetWorkingStage();
  291. if (null == ls_cstageclr)
  292. {
  293. log.Error("(OTSProgMgrInfoFun.GetWorkingStage) 获取正在工作的样品台类失败");
  294. return ls_cstageclr;
  295. }
  296. return ls_cstageclr;
  297. }
  298. /// <summary>
  299. /// 获取正在工作的样品台ID
  300. /// </summary>
  301. /// <returns></returns>
  302. public int GetWorkingStageId()
  303. {
  304. int stageid = m_cstagefile.GetWorkingStageId();
  305. return stageid;
  306. }
  307. /// <summary>
  308. /// 获取样品台信息列表
  309. /// </summary>
  310. /// <returns></returns>
  311. public List<CStage> GetStageList()
  312. {
  313. List<CStage> l_cstageclr = m_cstagefile.GetStagesList();
  314. if (null == l_cstageclr)
  315. {
  316. log.Error("(OTSProgMgrInfoFun.GetStageList) 获取样品台信息列表失败");
  317. return l_cstageclr;
  318. }
  319. return l_cstageclr;
  320. }
  321. /// <summary>
  322. /// 绑定样品台列表信息
  323. /// </summary>
  324. private void BindStageCombobox()
  325. {
  326. //先插入正在工作的样品台
  327. int ls_workingstageid = 0;
  328. IDC_COMBO_STAGE.Items.Clear();
  329. CStage ls_cstageclr = GetWorkingStage();
  330. ComboBoxItem ls_cbi = new ComboBoxItem();
  331. ls_cbi.Text = ls_cstageclr.GetName();
  332. ls_workingstageid = GetWorkingStageId();
  333. ls_cbi.Value = ls_workingstageid;
  334. IDC_COMBO_STAGE.Items.Add(ls_cbi);
  335. //添加其它的样品台信息
  336. List<CStage> l_cstageclr = GetStageList();
  337. for (int i = 0; i < l_cstageclr.Count(); i++)
  338. {
  339. if (ls_workingstageid != i)//将已经插入过的正在工作样品台信息跳过去
  340. {
  341. ComboBoxItem cbi = new ComboBoxItem();
  342. cbi.Text = l_cstageclr[i].GetName().ToString();
  343. cbi.Value = i.ToString();
  344. IDC_COMBO_STAGE.Items.Add(cbi);
  345. }
  346. }
  347. //防止进入窗体后,马上进入下拉项选择事件,先把事件去掉,一会再注册上
  348. this.IDC_COMBO_STAGE.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_STAGE_SelectedIndexChanged);
  349. //默认选择上
  350. if (IDC_COMBO_STAGE.Items.Count > 0)
  351. {
  352. IDC_COMBO_STAGE.SelectedIndex = 0;
  353. }
  354. this.IDC_COMBO_STAGE.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_STAGE_SelectedIndexChanged);
  355. }
  356. #endregion
  357. #region 参数相关方法封装
  358. /// <summary>
  359. /// 读取SEM样品台参数信息
  360. /// </summary>
  361. public void LoadSEMStageData()
  362. {
  363. //100倍时屏幕尺寸/mm
  364. IDC_EDIT_SCREENWIDTH.Text = m_csemstagedata.GetScanFieldSize100().ToString();
  365. //x轴方向
  366. foreach (ComboBoxItem cbi in IDC_COMBO_XDIREC.Items)
  367. {
  368. if (cbi.Value.ToString() != "")
  369. if (Convert.ToInt32(cbi.Value) == (int)m_csemstagedata.GetXAxisDir())
  370. {
  371. IDC_COMBO_XDIREC.SelectedItem = cbi;
  372. }
  373. }
  374. //x轴行程/mm 起,取值时,乘1000
  375. IDC_EDIT_XSTART.Text = (m_csemstagedata.GetXAxis().GetStart() / 1000).ToString();
  376. //x轴行程/mm 始
  377. IDC_EDIT_XEND.Text = (m_csemstagedata.GetXAxis().GetEnd() / 1000).ToString();
  378. //y轴方向
  379. foreach (ComboBoxItem cbi in IDC_COMBO_YDIRECT.Items)
  380. {
  381. if (cbi.Value.ToString() != "")
  382. if (Convert.ToInt32(cbi.Value) == (int)m_csemstagedata.GetYAxisDir())
  383. {
  384. IDC_COMBO_YDIRECT.SelectedItem = cbi;
  385. }
  386. }
  387. //y轴行程/mm 起
  388. IDC_EDIT_YSTART.Text = (m_csemstagedata.GetYAxis().GetStart() / 1000).ToString();
  389. //y轴行程/mm 始
  390. IDC_EDIT_YEND.Text = (m_csemstagedata.GetYAxis().GetEnd() / 1000).ToString();
  391. //最小放大倍数
  392. IDC_EDIT_MINMAG.Text = m_csemstagedata.GetMinMag().ToString();
  393. }
  394. /// <summary>
  395. /// 加载图像扫描参数
  396. /// </summary>
  397. public void LoadImageScanPrm()
  398. {
  399. //测量终止方式
  400. tB_StopMode.Text = m_cotsimgscanprm.GetStopMode().ToString();
  401. if (StopModeDialog == null)
  402. {
  403. StopModeDialog = new frmMeasureStopMode();
  404. StopModeDialog.FieldMode = m_cotsimgscanprm.GetStopParamFields();
  405. StopModeDialog.TimeMode = m_cotsimgscanprm.GetStopParamMeasTime();
  406. StopModeDialog.ParticleMode = m_cotsimgscanprm.GetStopParamParticles();
  407. StopModeDialog.AreaMode = m_cotsimgscanprm.GetStopParamArea();
  408. StopModeDialog.StopMode = tB_StopMode.Text;
  409. }
  410. //取图方式
  411. foreach (ComboBoxItem cbi in IDC_COMBO_FETCHIMGMODE.Items)
  412. {
  413. if (cbi.Value.ToString() != "")
  414. if (Convert.ToInt32(cbi.Value) == (int)m_cotsimgscanprm.GetFieldStartMode())
  415. {
  416. IDC_COMBO_FETCHIMGMODE.SelectedItem = cbi;
  417. }
  418. }
  419. //扫描图精度
  420. foreach (ComboBoxItem cbi in IDC_COMBO_IMGSCANSPEED.Items)
  421. {
  422. if (cbi.Value.ToString() != "")
  423. if (Convert.ToInt32(cbi.Value) == (int)m_cotsimgscanprm.GetScanImageSpeed())
  424. {
  425. IDC_COMBO_IMGSCANSPEED.SelectedItem = cbi;
  426. }
  427. }
  428. //扫描图尺寸
  429. foreach (ComboBoxItem cbi in IDC_COMBO_IMGSIZE.Items)
  430. {
  431. if (cbi.Value.ToString() != "")
  432. if (Convert.ToInt32(cbi.Value) == (int)m_cotsimgscanprm.GetImageResulotion())
  433. {
  434. IDC_COMBO_IMGSIZE.SelectedItem = cbi;
  435. }
  436. }
  437. }
  438. /// <summary>
  439. /// 加载一般常规参数
  440. /// </summary>
  441. public void LoadCGenParam()
  442. {
  443. //样品名
  444. IDC_EDIT_SAMPLENAME.Text = m_cgenparam.GetSampleName().ToString();
  445. //执行开关
  446. IDC_MEAS_SWITCH.Checked = m_cgenparam.GetMeasurementSwitch();
  447. //是否使用系统库开关
  448. IDC_SYS_LIB.Checked = m_cgenparam.GetSysSTD();
  449. //测量参数文件夹
  450. IDC_EDIT_MEASUREPARAMPATH.Text = m_cgenparam.GetMsrParamFileFolderName().ToString();
  451. //颗粒分析标准库文件夹
  452. IDC_EDIT_ANALYSESTDLIBPATH.Text = m_cgenparam.GetPartSTDLibFolderName().ToString();
  453. //精炼工艺选项
  454. foreach (ComboBoxItem cbi in IDC_COMBO_TECHNOLOGY.Items)
  455. {
  456. if (cbi.Value.ToString() != "")
  457. if (Convert.ToInt32(cbi.Value) == m_cgenparam.GetSteelTechnology())
  458. {
  459. IDC_COMBO_TECHNOLOGY.SelectedItem = cbi;
  460. }
  461. }
  462. //测量区域形状
  463. foreach (ComboBoxItem cbi in cBMeasShape.Items)
  464. {
  465. if (cbi.Value.ToString() != "")
  466. if (Convert.ToInt32(cbi.Value) == (int)m_cgenparam.GetShape())
  467. {
  468. cBMeasShape.SelectedItem = cbi;
  469. }
  470. }
  471. //测量区域面积
  472. tBMeasArea.Text = m_cgenparam.GetArea().ToString();
  473. //标准库选择
  474. foreach (ComboBoxItem cbi in IDC_COMBO_STDSelect.Items)
  475. {
  476. if (cbi.Text.ToString() != "")
  477. if (cbi.Text.ToString() == m_cgenparam.GetSelectSTDName())
  478. {
  479. IDC_COMBO_STDSelect.SelectedItem = cbi;
  480. }
  481. }
  482. }
  483. /// <summary>
  484. /// 加载默认参数
  485. /// </summary>
  486. public void LoadDefaultParam()
  487. {
  488. //模式
  489. foreach (OTSPeriodicTable.ComboBoxItem cbi in IDC_COMBO_Model.Items)
  490. {
  491. if (cbi.Value.ToString() != "")
  492. if (Convert.ToInt32(cbi.Value) == (int)m_cotsprogmgrparamfile.GetRunMode())
  493. {
  494. IDC_COMBO_Model.SelectedItem = cbi;
  495. }
  496. }
  497. }
  498. /// <summary>
  499. /// 加载图像处理参数
  500. /// </summary>
  501. public void LoadImageProc()
  502. {
  503. //颗粒面积范围 最小
  504. IDC_EDIT_PARTAREAMIN.Text = m_cotsimgprocprm.GetIncAreaRange().GetStart().ToString();
  505. //颗粒面积范围 最大
  506. IDC_EDIT_PARTAREAMAX.Text = m_cotsimgprocprm.GetIncAreaRange().GetEnd().ToString();
  507. //背景灰度范围 最小
  508. IDC_EDIT_BACKMIN.Text = m_cotsimgprocprm.GetBGGray().GetStart().ToString();
  509. //背景灰度范围 最大
  510. IDC_EDIT_BACKMAX.Text = m_cotsimgprocprm.GetBGGray().GetEnd().ToString();
  511. //颗粒灰度范围 最小
  512. IDC_EDIT_PARTMIN.Text = m_cotsimgprocprm.GetParticleGray().GetStart().ToString();
  513. //颗粒灰度范围 最大
  514. IDC_EDIT_PARTMAX.Text = m_cotsimgprocprm.GetParticleGray().GetEnd().ToString();
  515. IDC_EDIT_Overlap.Text = m_cotsimgprocprm.GetOverlapParam().ToString();
  516. //去背景方式
  517. foreach (ComboBoxItem cbi in IDC_COMBO_BGREMOVETYPE.Items)
  518. {
  519. if (cbi.Value.ToString() != "")
  520. {
  521. if (Convert.ToInt32(cbi.Value) == (int)m_cotsimgprocprm.GetBGRemoveType())
  522. {
  523. IDC_COMBO_BGREMOVETYPE.SelectedItem = cbi;
  524. break;
  525. }
  526. }
  527. }
  528. foreach (ComboBoxItem cbi in IDC_COMBO_AUTOBGREMOVETYP.Items)
  529. {
  530. if (cbi.Value.ToString() != "")
  531. {
  532. if (Convert.ToInt32(cbi.Value) == (int)m_cotsimgprocprm.GetAutoBGRemoveType())
  533. {
  534. IDC_COMBO_AUTOBGREMOVETYP.SelectedItem = cbi;
  535. break;
  536. }
  537. }
  538. }
  539. //重叠尺寸
  540. IDC_EDIT_Overlap.Text = m_cotsimgprocprm.GetOverlapParam().ToString();
  541. }
  542. /// <summary>
  543. /// 加载X-Ray参数
  544. /// </summary>
  545. public void LoadXRayParam()
  546. {
  547. foreach (ComboBoxItem cbi in IDC_COMBO_XRAYSCANMODE.Items)
  548. {
  549. if (cbi.Value.ToString() != "")
  550. if (Convert.ToInt32(cbi.Value) == (int)m_cotsxrayprm.GetScanMode())
  551. {
  552. IDC_COMBO_XRAYSCANMODE.SelectedItem = cbi;
  553. }
  554. }
  555. //是否使用电镜
  556. IDC_USINGXRAY_LIB.Checked = m_cotsxrayprm.GetUsingXray();
  557. //分析X-ray精度对应的时间
  558. IDC_TEXTBOX_ANALYXRAYSPEED_TIME.Text = m_cotsxrayprm.GetMidAnalyAQTime().ToString();
  559. //分析X-ray计数期望值
  560. IDC_EDIT_ANALYXRAYAIMVALUE.Text = m_cotsxrayprm.GetAnalyExpCount().ToString();
  561. IDC_EDIT_XrayLimit.Text = m_cotsxrayprm.GetXrayLimit().ToString();
  562. IDC_FILTER.Checked = m_cotsxrayprm.GetUseFilter();
  563. }
  564. /// <summary>
  565. /// 保存SEM样品台参数
  566. /// </summary>
  567. public void SaveSEMStageData()
  568. {
  569. //100倍时屏幕尺寸/mm
  570. m_csemstagedata.SetScanFieldSize100(Convert.ToInt32(IDC_EDIT_SCREENWIDTH.Text));
  571. //x轴方向
  572. ComboBoxItem cbi_x = (ComboBoxItem)IDC_COMBO_XDIREC.SelectedItem;
  573. m_csemstagedata.SetXAxisDir((otsdataconst.OTS_X_AXIS_DIRECTION)Convert.ToInt32(cbi_x.Value));
  574. //x轴行程/mm 起,始
  575. CIntRange crc_x = new CIntRange(Convert.ToInt32(IDC_EDIT_XSTART.Text) * 1000, Convert.ToInt32(IDC_EDIT_XEND.Text) * 1000);
  576. m_csemstagedata.SetXAxis(crc_x);
  577. //y轴方向
  578. ComboBoxItem cbi_y = (ComboBoxItem)IDC_COMBO_YDIRECT.SelectedItem;
  579. m_csemstagedata.SetYAxisDir((otsdataconst.OTS_Y_AXIS_DIRECTION)Convert.ToInt32(cbi_y.Value));
  580. //y轴行程/mm 起,始
  581. CIntRange crc_y = new CIntRange(Convert.ToInt32(IDC_EDIT_YSTART.Text) * 1000, Convert.ToInt32(IDC_EDIT_YEND.Text) * 1000);
  582. m_csemstagedata.SetYAxis(crc_y);
  583. //最小放大倍数
  584. m_csemstagedata.SetMinMag(Convert.ToDouble(IDC_EDIT_MINMAG.Text));
  585. }
  586. /// <summary>
  587. /// 保存图像扫描参数
  588. /// </summary>
  589. public void SaveImageScanPrm()
  590. {
  591. // 保存图像扫描参数");
  592. //测量终止方式
  593. m_cotsimgscanprm.SetStopMode(tB_StopMode.Text);
  594. //终止时间
  595. m_cotsimgscanprm.SetStopParamMeasTime(StopModeDialog.TimeMode);
  596. ////终止帧图数
  597. m_cotsimgscanprm.SetStopParamFields(StopModeDialog.FieldMode);
  598. ////终止夹杂物数
  599. m_cotsimgscanprm.SetStopParamParticles(StopModeDialog.ParticleMode);
  600. ////终止面积
  601. m_cotsimgscanprm.SetStopParamArea(StopModeDialog.AreaMode);
  602. //取图方式
  603. ComboBoxItem enum_fetchimgmode = (ComboBoxItem)IDC_COMBO_FETCHIMGMODE.SelectedItem;
  604. m_cotsimgscanprm.SetStartImageMode((otsdataconst.OTS_GET_IMAGE_MODE)Convert.ToInt32(enum_fetchimgmode.Value));
  605. //扫描图精度
  606. ComboBoxItem enum_imgscanspeed = (ComboBoxItem)IDC_COMBO_IMGSCANSPEED.SelectedItem;
  607. m_cotsimgscanprm.SetScanImageSpeed((otsdataconst.OTS_IMAGE_SCANSPEED_OPTIONS)Convert.ToInt32(enum_imgscanspeed.Value));
  608. //扫描图尺寸
  609. ComboBoxItem enum_imgsize = (ComboBoxItem)IDC_COMBO_IMGSIZE.SelectedItem;
  610. m_cotsimgscanprm.SetImageResulotion((otsdataconst.OTS_IMAGE_RESULOTION_OPTIONS)Convert.ToInt32(enum_imgsize.Value));
  611. }
  612. /// <summary>
  613. /// 保存一般常规参数
  614. /// </summary>
  615. public void SaveCGenParam()
  616. {
  617. //样品名
  618. m_cgenparam.SetSampleName(IDC_EDIT_SAMPLENAME.Text);
  619. //执行开关
  620. m_cgenparam.SetMeasurementSwitch(IDC_MEAS_SWITCH.Checked);
  621. //是否使用系统库
  622. m_cgenparam.SetSysSTD(IDC_SYS_LIB.Checked);
  623. //测量参数文件夹
  624. m_cgenparam.SetMsrParamFileFolderName(IDC_EDIT_MEASUREPARAMPATH.Text);
  625. //颗粒分析标准库文件夹
  626. m_cgenparam.SetPartSTDLibFolderName(IDC_EDIT_ANALYSESTDLIBPATH.Text);
  627. //获取精炼工艺索引
  628. ComboBoxItem cbiTECH = new ComboBoxItem();
  629. cbiTECH = (ComboBoxItem)IDC_COMBO_TECHNOLOGY.SelectedItem;
  630. //设置参数文件类中精炼工艺索引值
  631. m_cgenparam.SetSteelTechnology((int)cbiTECH.Value);
  632. //测量区域形状
  633. ComboBoxItem enum_Shape = (ComboBoxItem)cBMeasShape.SelectedItem;
  634. m_cgenparam.SetShape((otsdataconst.DOMAIN_SHAPE)Convert.ToInt32(enum_Shape.Value));
  635. //测量区域大小
  636. m_cgenparam.SetArea(Convert.ToDouble(tBMeasArea.Text));
  637. //标准库选择
  638. ComboBoxItem enum_STDLIBSELECT = (ComboBoxItem)IDC_COMBO_STDSelect.SelectedItem;
  639. m_cgenparam.SetSTDSelect(enum_STDLIBSELECT.Text.ToString());
  640. }
  641. /// <summary>
  642. /// 保存图像处理参数
  643. /// </summary>
  644. public void SaveImageProc()
  645. {
  646. //颗粒面积范围 最小 最大
  647. CDoubleRange crc_partareamin = new CDoubleRange(Math.Round(Convert.ToDouble(IDC_EDIT_PARTAREAMIN.Text), 2), Math.Round(Convert.ToDouble(IDC_EDIT_PARTAREAMAX.Text), 2));
  648. m_cotsimgprocprm.SetIncAreaRange(crc_partareamin);
  649. //背景灰度范围 最小 最大
  650. CIntRange crc_backmin = new CIntRange(Convert.ToInt32(IDC_EDIT_BACKMIN.Text), Convert.ToInt32(IDC_EDIT_BACKMAX.Text));
  651. m_cotsimgprocprm.SetBGGray(crc_backmin);
  652. //颗粒灰度范围 最小 最大
  653. CIntRange crc_partmin = new CIntRange(Convert.ToInt32(IDC_EDIT_PARTMIN.Text), Convert.ToInt32(IDC_EDIT_PARTMAX.Text));
  654. m_cotsimgprocprm.SetParticleGray(crc_partmin);
  655. //去背景方式
  656. ComboBoxItem enum_BGREMOVETYPE = (ComboBoxItem)IDC_COMBO_BGREMOVETYPE.SelectedItem;
  657. m_cotsimgprocprm.SetBGRemoveType((otsdataconst.OTS_BGREMOVE_TYPE)enum_BGREMOVETYPE.Value);
  658. //去背景方式
  659. ComboBoxItem enum_AUTOBGREMOVETYP = (ComboBoxItem)IDC_COMBO_AUTOBGREMOVETYP.SelectedItem;
  660. m_cotsimgprocprm.SetAutoBGRemoveType((otsdataconst.OTS_AUTOBGREMOVE_TYPE)enum_AUTOBGREMOVETYP.Value);
  661. //重叠像素
  662. m_cotsimgprocprm.SetOverlapParam(Convert.ToInt32(IDC_EDIT_Overlap.Text));
  663. }
  664. /// <summary>
  665. /// 保存X-Ray参数
  666. /// </summary>
  667. public void SaveXRayParam()
  668. {
  669. //搜索X-ray精度
  670. ComboBoxItem enum_searchxrayspeed = (ComboBoxItem)IDC_COMBO_SEARCHXRAYSPEED.SelectedItem;
  671. //X-ray扫描方式
  672. ComboBoxItem enum_xrayscanmode = (ComboBoxItem)IDC_COMBO_XRAYSCANMODE.SelectedItem;
  673. m_cotsxrayprm.SetScanMode((otsdataconst.OTS_X_RAY_SCAN_MODE)Convert.ToInt32(enum_xrayscanmode.Value));
  674. //是否使用X-ray
  675. m_cotsxrayprm.SetUsingXray(IDC_USINGXRAY_LIB.Checked);
  676. //分析X-ray精度对应的时间
  677. m_cotsxrayprm.SetMidAnalyAQTime(Convert.ToInt32(IDC_TEXTBOX_ANALYXRAYSPEED_TIME.Text.Trim()));
  678. //分析X-ray计数期望值
  679. m_cotsxrayprm.SetAnalyExpCount(Convert.ToInt32(IDC_EDIT_ANALYXRAYAIMVALUE.Text));
  680. m_cotsxrayprm.SetXrayLimit(Convert.ToInt32(IDC_EDIT_XrayLimit.Text));
  681. m_cotsxrayprm.SetUseFilter(IDC_FILTER.Checked);
  682. }
  683. /// <summary>
  684. /// 将参数保存到文件
  685. /// </summary>
  686. /// <param name="a_nPackId"></param>
  687. /// <param name="a_pStageData"></param>
  688. /// <param name="a_pGenParam"></param>
  689. /// <param name="a_pImageScanParam"></param>
  690. /// <param name="a_pImageProcParam"></param>
  691. /// <param name="a_pXRayParam"></param>
  692. /// <returns></returns>
  693. public bool SaveInfoToProgMgrFile()
  694. {
  695. //SaveInfoToProgMgrFile()
  696. if (false == m_cotsprogmgrparamfile.SaveInfoToProgMgrFile())
  697. {
  698. log.Error("(OTSProgMgrInfoFun.SaveInfoToProgMgrFile) Failed to save parameters to file");
  699. return false;
  700. }
  701. return true;
  702. }
  703. /// <summary>
  704. /// 加载参数各个类
  705. /// </summary>
  706. public bool LoadParamFun()
  707. {
  708. bool result = m_cotsprogmgrparamfile.LoadInfoFromProgMgrFile();
  709. if (!result)
  710. {
  711. log.Error("(OTSProgMgrInfoFun.LoadParamFun) LoadInfoFromProgMgrFile Failed");
  712. return false;
  713. }
  714. m_csemstagedata = m_cotsprogmgrparamfile.GetStageDataParam();
  715. if (null == m_csemstagedata)
  716. {
  717. log.Error("(OTSProgMgrInfoFun.LoadParamFun) GetStageData Failed");
  718. return false;
  719. }
  720. m_cotsimgscanprm = m_cotsprogmgrparamfile.GetImageScanParam();
  721. if (null == m_cotsimgscanprm)
  722. {
  723. log.Error("(OTSProgMgrInfoFun.LoadParamFun) GetImageScanParam Failed");
  724. return false;
  725. }
  726. m_cgenparam = m_cotsprogmgrparamfile.GetGenParam();
  727. if (null == m_cgenparam)
  728. {
  729. log.Error("(OTSProgMgrInfoFun.LoadParamFun) GetGenParam Failed");
  730. return false;
  731. }
  732. m_cotsimgprocprm = m_cotsprogmgrparamfile.GetImageProcParam();
  733. if (null == m_cotsimgprocprm)
  734. {
  735. log.Error("(OTSProgMgrInfoFun.LoadParamFun) GetImageProcParam Failed");
  736. return false;
  737. }
  738. m_cotsxrayprm = m_cotsprogmgrparamfile.GetXRayParam();
  739. if (null == m_cotsxrayprm)
  740. {
  741. log.Error("(OTSProgMgrInfoFun.LoadParamFun) GetXRayParam Failed");
  742. return false;
  743. }
  744. return true;
  745. }
  746. #endregion
  747. #region 窗体加载
  748. private void ProgMgrInfoForm_Load(object sender, EventArgs e)
  749. {
  750. //加载各参数类
  751. LoadParamFun();
  752. //初始化combobox下拉框列表
  753. BindComboBox();
  754. //加载相关参数信息
  755. LoadDefaultParam();
  756. LoadSEMStageData();
  757. LoadImageScanPrm();
  758. LoadCGenParam();
  759. LoadImageProc();
  760. LoadXRayParam();
  761. if (m_b_checkstagefile == false)
  762. btnok.Enabled = true;
  763. else
  764. btnok.Enabled = false;
  765. //获取特殊颗粒信息
  766. //DataTable dt = XMLoperate.GetXMLRegList(CSpecialGrayRangeParam.GetParamFileFullName(), "XMLData").Tables[0];
  767. //if (dt.Rows.Count != 0)
  768. //{
  769. // if (XMLoperate.GetXMLRegList(CSpecialGrayRangeParam.GetParamFileFullName(), "XMLData").Tables[0].Rows[0]["ToRun"].ToString() == "true")
  770. // {
  771. // checkBox_Run.Checked = true;
  772. // }
  773. // else
  774. // {
  775. // checkBox_Run.Checked = false;
  776. // }
  777. //}
  778. //关于路径定位问题
  779. this.folderBrowserDialog1.SelectedPath = IDC_EDIT_MEASUREPARAMPATH.Text;
  780. string strb = ".\\Config\\SysData\\";
  781. string strc = ".\\Config\\ProData\\";
  782. string m_STDPath = strb;
  783. m_ParameterPath = strc;
  784. this.folderBrowserDialog1.SelectedPath = m_ParameterPath;
  785. IDC_EDIT_MEASUREPARAMPATH.Text = m_ParameterPath;
  786. IDC_EDIT_ANALYSESTDLIBPATH.Text = m_STDPath;
  787. if(m_cotsprogmgrparamfile.GetSysTypeName() == "IncA")
  788. {
  789. label42.Visible = true;
  790. IDC_COMBO_TECHNOLOGY.Visible = true;
  791. }
  792. else
  793. {
  794. label42.Visible = false;
  795. IDC_COMBO_TECHNOLOGY.Visible = false;
  796. }
  797. }
  798. #endregion
  799. #region 各按钮控件点击事件
  800. private void IDC_BUTTON_KLFX_Click(object sender, EventArgs e)
  801. {
  802. try
  803. {
  804. if (IDC_COMBO_STDSelect.Text != "NoSTDDB")
  805. {
  806. Process p = System.Diagnostics.Process.Start(".\\OTSPartA_STDEditor.exe", "\""+ Application.StartupPath + "\\Config\\SysData\\" + IDC_COMBO_STDSelect.Text+".db"+ "\"");
  807. p.WaitForExit();
  808. }
  809. else
  810. {
  811. string message = table["message55"].ToString();
  812. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  813. }
  814. }
  815. catch (Exception ex)
  816. {
  817. log.Error("OTSPartA_STDEditor:" + ex.ToString());
  818. }
  819. }
  820. private void IDC_BUTTON_MEASPRAMPATHSET_Click(object sender, EventArgs e)
  821. {
  822. if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
  823. {
  824. IDC_EDIT_MEASUREPARAMPATH.Text = folderBrowserDialog1.SelectedPath;
  825. }
  826. else {
  827. folderBrowserDialog1.SelectedPath = IDC_EDIT_MEASUREPARAMPATH.Text;
  828. }
  829. }
  830. private void IDC_BUTTON_PARTSTDLIBPATHSET_Click(object sender, EventArgs e)
  831. {
  832. if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
  833. {
  834. IDC_EDIT_ANALYSESTDLIBPATH.Text = folderBrowserDialog1.SelectedPath;
  835. }
  836. else {
  837. folderBrowserDialog1.SelectedPath = IDC_EDIT_ANALYSESTDLIBPATH.Text;
  838. }
  839. }
  840. /// <summary>
  841. /// 弹出样品台管理窗体
  842. /// </summary>
  843. /// <param name="a_nPackId"></param>
  844. /// <param name="a_pStageFile"></param>
  845. /// <returns></returns>
  846. public void ShowStageDialogExport()
  847. {
  848. DlgStageMgr dlgStageMgr = new DlgStageMgr(m_cstagefile);
  849. dlgStageMgr.ShowDialog();
  850. return;
  851. }
  852. /// <summary>
  853. /// 保存样品台信息
  854. /// </summary>
  855. /// <returns></returns>
  856. public bool CStageFileClrSave()
  857. {
  858. if (m_cstagefile == null)
  859. {
  860. //报错
  861. log.Error("(OTSProgMgrInfoFun.CStageFileClrSave) Error saving sample station information!");
  862. }
  863. else
  864. {
  865. bool b_ret = m_cstagefile.Save();
  866. if (false == b_ret)
  867. {
  868. log.Error("(OTSProgMgrInfoFun.CStageFileClrSave) Error saving sample table information!");
  869. }
  870. }
  871. return false;
  872. }
  873. private void IDC_BUTTON_STAGE_Click(object sender, EventArgs e)
  874. {
  875. //弹出管理样品台管理窗体
  876. ShowStageDialogExport();
  877. //弹出后再保存样品台信息
  878. CStageFileClrSave();
  879. //刷新绑定样品台列表
  880. BindStageCombobox();
  881. //检测是否已经有修改
  882. ThisSetIsModify();
  883. }
  884. /// <summary>
  885. /// 判断各控件值是否正确
  886. /// </summary>
  887. /// <returns></returns>
  888. private bool CheckSetupValues(int bz)
  889. {
  890. if ("" == IDC_COMBO_STAGE.Text)
  891. {
  892. string message = table["message1"].ToString();
  893. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  894. IDC_COMBO_STAGE.Focus();
  895. IDC_COMBO_STAGE.SelectAll();
  896. return false;
  897. }
  898. if ("" == IDC_EDIT_SCREENWIDTH.Text)
  899. {
  900. string message = table["message2"].ToString();
  901. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  902. IDC_EDIT_SCREENWIDTH.Focus();
  903. IDC_EDIT_SCREENWIDTH.SelectAll();
  904. return false;
  905. }
  906. if ("" == IDC_COMBO_XDIREC.Text)
  907. {
  908. string message = table["message3"].ToString();
  909. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  910. IDC_COMBO_XDIREC.Focus();
  911. IDC_COMBO_XDIREC.SelectAll();
  912. return false;
  913. }
  914. if ("" == IDC_EDIT_XSTART.Text)
  915. {
  916. string message = table["message4"].ToString();
  917. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  918. IDC_EDIT_XSTART.Focus();
  919. IDC_EDIT_XSTART.SelectAll();
  920. return false;
  921. }
  922. if ("" == IDC_EDIT_XEND.Text)
  923. {
  924. string message = table["message4"].ToString();
  925. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  926. IDC_EDIT_XEND.Focus();
  927. IDC_EDIT_XEND.SelectAll();
  928. return false;
  929. }
  930. if ("" == IDC_COMBO_YDIRECT.Text)
  931. {
  932. string message = table["message5"].ToString();
  933. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  934. IDC_COMBO_YDIRECT.Focus();
  935. IDC_COMBO_YDIRECT.SelectAll();
  936. return false;
  937. }
  938. if ("" == IDC_EDIT_YSTART.Text)
  939. {
  940. string message = table["message6"].ToString();
  941. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  942. IDC_EDIT_YSTART.Focus();
  943. IDC_EDIT_YSTART.SelectAll();
  944. return false;
  945. }
  946. if ("" == IDC_EDIT_YEND.Text)
  947. {
  948. string message = table["message6"].ToString();
  949. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  950. IDC_EDIT_YEND.Focus();
  951. IDC_EDIT_YEND.SelectAll();
  952. return false;
  953. }
  954. if ("" == tB_StopMode.Text)
  955. {
  956. string message = table["message7"].ToString();
  957. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  958. return false;
  959. }
  960. if ("" == IDC_COMBO_FETCHIMGMODE.Text)
  961. {
  962. string message = table["message10"].ToString();
  963. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  964. IDC_COMBO_FETCHIMGMODE.Focus();
  965. IDC_COMBO_FETCHIMGMODE.SelectAll();
  966. return false;
  967. }
  968. if ("" == IDC_COMBO_IMGSCANSPEED.Text)
  969. {
  970. string message = table["message11"].ToString();
  971. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  972. IDC_COMBO_IMGSCANSPEED.Focus();
  973. IDC_COMBO_IMGSCANSPEED.SelectAll();
  974. return false;
  975. }
  976. if ("" == IDC_COMBO_IMGSIZE.Text)
  977. {
  978. string message = table["message12"].ToString();
  979. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  980. IDC_COMBO_IMGSIZE.Focus();
  981. IDC_COMBO_IMGSIZE.SelectAll();
  982. return false;
  983. }
  984. if ("" == IDC_EDIT_MINMAG.Text)
  985. {
  986. string message = table["message13"].ToString();
  987. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  988. IDC_EDIT_MINMAG.Focus();
  989. IDC_EDIT_MINMAG.SelectAll();
  990. return false;
  991. }
  992. if ("" == IDC_EDIT_PARTAREAMIN.Text)
  993. {
  994. string message = table["message14"].ToString();
  995. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  996. IDC_EDIT_PARTAREAMIN.Focus();
  997. IDC_EDIT_PARTAREAMIN.SelectAll();
  998. return false;
  999. }
  1000. if ("" == IDC_EDIT_PARTAREAMAX.Text)
  1001. {
  1002. string message = table["message15"].ToString();
  1003. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1004. IDC_EDIT_PARTAREAMAX.Focus();
  1005. IDC_EDIT_PARTAREAMAX.SelectAll();
  1006. return false;
  1007. }
  1008. if ("" == IDC_EDIT_BACKMIN.Text)
  1009. {
  1010. string message = table["message16"].ToString();
  1011. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1012. IDC_EDIT_BACKMIN.Focus();
  1013. IDC_EDIT_BACKMIN.SelectAll();
  1014. return false;
  1015. }
  1016. if ("" == IDC_EDIT_BACKMAX.Text)
  1017. {
  1018. string message = table["message17"].ToString();
  1019. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1020. IDC_EDIT_BACKMAX.Focus();
  1021. IDC_EDIT_BACKMAX.SelectAll();
  1022. return false;
  1023. }
  1024. if ("" == IDC_EDIT_PARTMIN.Text)
  1025. {
  1026. string message = table["message18"].ToString();
  1027. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1028. IDC_EDIT_PARTMIN.Focus();
  1029. IDC_EDIT_PARTMIN.SelectAll();
  1030. return false;
  1031. }
  1032. if ("" == IDC_EDIT_PARTMAX.Text)
  1033. {
  1034. string message = table["message19"].ToString();
  1035. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1036. IDC_EDIT_PARTMAX.Focus();
  1037. IDC_EDIT_PARTMAX.SelectAll();
  1038. return false;
  1039. }
  1040. if ("" == IDC_COMBO_XRAYSCANMODE.Text)
  1041. {
  1042. string message = table["message20"].ToString();
  1043. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1044. IDC_COMBO_XRAYSCANMODE.Focus();
  1045. IDC_COMBO_XRAYSCANMODE.SelectAll();
  1046. return false;
  1047. }
  1048. if ("" == IDC_COMBO_ANALYXRAYSPEED.Text)
  1049. {
  1050. string message = table["message21"].ToString();
  1051. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1052. IDC_COMBO_ANALYXRAYSPEED.Focus();
  1053. IDC_COMBO_ANALYXRAYSPEED.SelectAll();
  1054. return false;
  1055. }
  1056. if ("" == IDC_EDIT_ANALYXRAYAIMVALUE.Text)
  1057. {
  1058. string message = table["message22"].ToString();
  1059. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1060. IDC_EDIT_ANALYXRAYAIMVALUE.Focus();
  1061. IDC_EDIT_ANALYXRAYAIMVALUE.SelectAll();
  1062. return false;
  1063. }
  1064. if ("" == tBMeasArea.Text)
  1065. {
  1066. string message = table["message62"].ToString();
  1067. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1068. tBMeasArea.Focus();
  1069. tBMeasArea.SelectAll();
  1070. return false;
  1071. }
  1072. //if ("" == IDC_COMBO_CorrosionExpansionCoefficient.Text)
  1073. //{
  1074. // string message = table["message62"].ToString();
  1075. // MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1076. // IDC_COMBO_CorrosionExpansionCoefficient.Focus();
  1077. // IDC_COMBO_CorrosionExpansionCoefficient.SelectAll();
  1078. // return false;
  1079. //}
  1080. //string pat = @"^(-|\+)?\d{1,8}$";//只能输入1到3位的正负整数
  1081. string pat = @"^-?[0-9]\d*$";//只能限定正负整数,包含0
  1082. string scope = @"^(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])$";
  1083. string PositiveDecimals = @"^(([1-9]\d*)(\.\d+)?)$|^0\.\d*[1-9]$"; //正浮点数
  1084. string positiveInteger = @"^?[0-9]\d*$";//只能限定正整数,包含0
  1085. string positiveOddNumber = @"[^1,3,5,7,9]";//只能限定正奇数
  1086. Regex rg = new Regex(pat);
  1087. Regex rgScope = new Regex(scope);
  1088. Regex rgPositiveDecimals = new Regex(PositiveDecimals);
  1089. Regex rgpositiveInteger = new Regex(positiveInteger);
  1090. //100倍时屏幕尺寸
  1091. if (false == rg.Match(IDC_EDIT_SCREENWIDTH.Text.Trim()).Success)
  1092. {
  1093. IDC_EDIT_SCREENWIDTH.Focus();
  1094. IDC_EDIT_SCREENWIDTH.SelectAll();
  1095. string message = table["message23"].ToString();
  1096. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1097. return false;
  1098. }
  1099. //x轴行程/mm 起
  1100. if (false == rg.Match(IDC_EDIT_XSTART.Text.Trim()).Success)
  1101. {
  1102. IDC_EDIT_XSTART.Focus();
  1103. IDC_EDIT_XSTART.SelectAll();
  1104. string message = table["message24"].ToString();
  1105. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1106. return false;
  1107. }
  1108. //x轴行程/mm 止
  1109. if (false == rg.Match(IDC_EDIT_XEND.Text.Trim()).Success)
  1110. {
  1111. IDC_EDIT_XEND.Focus();
  1112. IDC_EDIT_XEND.SelectAll();
  1113. string message = table["message25"].ToString();
  1114. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1115. return false;
  1116. }
  1117. //y轴行程/mm 起
  1118. if (false == rg.Match(IDC_EDIT_YSTART.Text.Trim()).Success)
  1119. {
  1120. IDC_EDIT_YSTART.Focus();
  1121. IDC_EDIT_YSTART.SelectAll();
  1122. string message = table["message26"].ToString();
  1123. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1124. return false;
  1125. }
  1126. //y轴行程/mm 止
  1127. if (false == rg.Match(IDC_EDIT_YEND.Text.Trim()).Success)
  1128. {
  1129. IDC_EDIT_YEND.Focus();
  1130. IDC_EDIT_YEND.SelectAll();
  1131. string message = table["message27"].ToString();
  1132. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1133. return false;
  1134. }
  1135. //颗粒面积范围 最小
  1136. if (false == rgPositiveDecimals.Match(IDC_EDIT_PARTAREAMIN.Text.Trim()).Success)
  1137. {
  1138. IDC_EDIT_PARTAREAMIN.Focus();
  1139. IDC_EDIT_PARTAREAMIN.SelectAll();
  1140. string message = table["message31"].ToString();
  1141. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1142. return false;
  1143. }
  1144. //颗粒面积范围 最大
  1145. if (false == rgPositiveDecimals.Match(IDC_EDIT_PARTAREAMAX.Text.Trim()).Success)
  1146. {
  1147. IDC_EDIT_PARTAREAMAX.Focus();
  1148. IDC_EDIT_PARTAREAMAX.SelectAll();
  1149. string message = table["message32"].ToString();
  1150. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1151. return false;
  1152. }
  1153. //背景灰度范围 最小
  1154. if (false == rg.Match(IDC_EDIT_BACKMIN.Text.Trim()).Success)
  1155. {
  1156. IDC_EDIT_BACKMIN.Focus();
  1157. IDC_EDIT_BACKMIN.SelectAll();
  1158. string message = table["message33"].ToString();
  1159. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1160. return false;
  1161. }
  1162. else
  1163. {
  1164. if (false == rgScope.Match(IDC_EDIT_BACKMIN.Text.Trim()).Success)
  1165. {
  1166. IDC_EDIT_BACKMIN.Focus();
  1167. IDC_EDIT_BACKMIN.SelectAll();
  1168. string message = table["message34"].ToString();
  1169. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1170. return false;
  1171. }
  1172. }
  1173. //背景灰度范围 最大
  1174. if (false == rg.Match(IDC_EDIT_BACKMAX.Text.Trim()).Success)
  1175. {
  1176. IDC_EDIT_BACKMAX.Focus();
  1177. IDC_EDIT_BACKMAX.SelectAll();
  1178. string message = table["message35"].ToString();
  1179. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1180. return false;
  1181. }
  1182. else
  1183. {
  1184. if (false == rgScope.Match(IDC_EDIT_BACKMAX.Text.Trim()).Success)
  1185. {
  1186. IDC_EDIT_BACKMAX.Focus();
  1187. IDC_EDIT_BACKMAX.SelectAll();
  1188. string message = table["message36"].ToString();
  1189. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1190. return false;
  1191. }
  1192. }
  1193. //颗粒灰度范围 最小
  1194. if (false == rg.Match(IDC_EDIT_PARTMIN.Text.Trim()).Success)
  1195. {
  1196. IDC_EDIT_PARTMIN.Focus();
  1197. IDC_EDIT_PARTMIN.SelectAll();
  1198. string message = table["message37"].ToString();
  1199. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1200. return false;
  1201. }
  1202. else
  1203. {
  1204. if (false == rgScope.Match(IDC_EDIT_PARTMIN.Text.Trim()).Success)
  1205. {
  1206. IDC_EDIT_PARTMIN.Focus();
  1207. IDC_EDIT_PARTMIN.SelectAll();
  1208. string message = table["message38"].ToString();
  1209. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1210. return false;
  1211. }
  1212. }
  1213. //颗粒灰度范围 最大
  1214. if (false == rg.Match(IDC_EDIT_PARTMAX.Text.Trim()).Success)
  1215. {
  1216. IDC_EDIT_PARTMAX.Focus();
  1217. IDC_EDIT_PARTMAX.SelectAll();
  1218. string message = table["message39"].ToString();
  1219. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1220. return false;
  1221. }
  1222. else
  1223. {
  1224. if (false == rgScope.Match(IDC_EDIT_PARTMAX.Text.Trim()).Success)
  1225. {
  1226. IDC_EDIT_PARTMAX.Focus();
  1227. IDC_EDIT_PARTMAX.SelectAll();
  1228. string message = table["message40"].ToString();
  1229. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1230. return false;
  1231. }
  1232. }
  1233. //分析X-ray计数期望值 最大
  1234. if (false == rg.Match(IDC_EDIT_ANALYXRAYAIMVALUE.Text.Trim()).Success)
  1235. {
  1236. IDC_EDIT_ANALYXRAYAIMVALUE.Focus();
  1237. IDC_EDIT_ANALYXRAYAIMVALUE.SelectAll();
  1238. string message = table["message41"].ToString();
  1239. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1240. return false;
  1241. }
  1242. //分析X-ray精度对应的时间
  1243. if (false == rg.Match(IDC_TEXTBOX_ANALYXRAYSPEED_TIME.Text.Trim()).Success)
  1244. {
  1245. IDC_TEXTBOX_ANALYXRAYSPEED_TIME.Focus();
  1246. IDC_TEXTBOX_ANALYXRAYSPEED_TIME.SelectAll();
  1247. string message = table["message42"].ToString();
  1248. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1249. return false;
  1250. }
  1251. pat = @"^[0-9]+(\.[0-9]{1,3})?$"; //只能输入,1到3位小数的正数
  1252. rg = new Regex(pat);
  1253. //最小放大倍数
  1254. if (false == rg.Match(IDC_EDIT_MINMAG.Text.Trim()).Success)
  1255. {
  1256. IDC_EDIT_MINMAG.Focus();
  1257. IDC_EDIT_MINMAG.SelectAll();
  1258. string message = table["message43"].ToString();
  1259. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1260. return false;
  1261. }
  1262. //再限制,x轴,y轴,的起止的,输入长度,因为现在已经有在mm和um之间的转换,所以这里要限制一下
  1263. //x轴行程/mm 起
  1264. if (IDC_EDIT_XSTART.Text.Length > 4)
  1265. {
  1266. IDC_EDIT_XSTART.Focus();
  1267. IDC_EDIT_XSTART.SelectAll();
  1268. string message = table["message44"].ToString();
  1269. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1270. return false;
  1271. }
  1272. //x轴行程/mm 止
  1273. if (IDC_EDIT_XEND.Text.Length > 4)
  1274. {
  1275. IDC_EDIT_XEND.Focus();
  1276. IDC_EDIT_XEND.SelectAll();
  1277. string message = table["message45"].ToString();
  1278. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1279. return false;
  1280. }
  1281. //y轴行程/mm 起
  1282. if (IDC_EDIT_YSTART.Text.Length > 4)
  1283. {
  1284. IDC_EDIT_YSTART.Focus();
  1285. IDC_EDIT_YSTART.SelectAll();
  1286. string message = table["message46"].ToString();
  1287. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1288. return false;
  1289. }
  1290. //y轴行程/mm 止
  1291. if (IDC_EDIT_YEND.Text.Length > 4)
  1292. {
  1293. IDC_EDIT_YEND.Focus();
  1294. IDC_EDIT_YEND.SelectAll();
  1295. string message = table["message47"].ToString();
  1296. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1297. return false;
  1298. }
  1299. if (Convert.ToInt32(IDC_EDIT_XSTART.Text.Trim()) > Convert.ToInt32(IDC_EDIT_XEND.Text.Trim()))
  1300. {
  1301. IDC_EDIT_XEND.Focus();
  1302. IDC_EDIT_XEND.SelectAll();
  1303. string message = table["message50"].ToString();
  1304. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1305. return false;
  1306. }
  1307. if (Convert.ToInt32(IDC_EDIT_YSTART.Text.Trim()) > Convert.ToInt32(IDC_EDIT_YEND.Text.Trim()))
  1308. {
  1309. IDC_EDIT_YEND.Focus();
  1310. IDC_EDIT_YEND.SelectAll();
  1311. string message = table["message53"].ToString();
  1312. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1313. return false;
  1314. }
  1315. //颗粒尺寸范围
  1316. if (Convert.ToDouble(IDC_EDIT_PARTAREAMIN.Text.Trim()) > Convert.ToDouble(IDC_EDIT_PARTAREAMAX.Text.Trim()))
  1317. {
  1318. IDC_EDIT_PARTAREAMIN.Focus();
  1319. IDC_EDIT_PARTAREAMIN.SelectAll();
  1320. string message = table["message56"].ToString();
  1321. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1322. return false;
  1323. }
  1324. //背景灰度范围
  1325. if (Convert.ToInt32(IDC_EDIT_BACKMIN.Text.Trim()) > Convert.ToInt32(IDC_EDIT_BACKMAX.Text.Trim()))
  1326. {
  1327. IDC_EDIT_BACKMIN.Focus();
  1328. IDC_EDIT_BACKMIN.SelectAll();
  1329. string message = table["message57"].ToString();
  1330. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1331. return false;
  1332. }
  1333. //颗粒灰度范围
  1334. if (Convert.ToInt32(IDC_EDIT_PARTMIN.Text.Trim()) > Convert.ToInt32(IDC_EDIT_PARTMAX.Text.Trim()))
  1335. {
  1336. IDC_EDIT_PARTMIN.Focus();
  1337. IDC_EDIT_PARTMIN.SelectAll();
  1338. string message = table["message58"].ToString();
  1339. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1340. return false;
  1341. }
  1342. //最小放大倍数
  1343. if (false == rgpositiveInteger.Match(IDC_EDIT_XrayLimit.Text.Trim()).Success)
  1344. {
  1345. IDC_EDIT_XrayLimit.Focus();
  1346. IDC_EDIT_XrayLimit.SelectAll();
  1347. string message = table["message64"].ToString();
  1348. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1349. return false;
  1350. }
  1351. return true;
  1352. }
  1353. /// <summary>
  1354. /// 判断当前样品台是否在被修改
  1355. /// </summary>
  1356. /// <returns></returns>
  1357. public bool IsModified()
  1358. {
  1359. return m_cstagefile.IsModified();
  1360. }
  1361. /// <summary>
  1362. /// 样品台保存
  1363. /// </summary>
  1364. /// <returns></returns>
  1365. public bool StageSave()
  1366. {
  1367. if (!m_cstagefile.Save())
  1368. {
  1369. log.Error("(OTSProgMgrInfoFun.StageLoad) Failed to save sample station information!");
  1370. return false;
  1371. }
  1372. return true;
  1373. }
  1374. private void btnok_Click(object sender, EventArgs e)
  1375. {
  1376. //先判断
  1377. if (false == CheckSetupValues(1))
  1378. {
  1379. return;
  1380. }
  1381. //先把各个值都保存到各类
  1382. m_cotsprogmgrparamfile.m_runmode = (RunMode)IDC_COMBO_Model.SelectedIndex;
  1383. SaveSEMStageData();
  1384. SaveImageScanPrm();
  1385. SaveCGenParam();
  1386. SaveImageProc();
  1387. SaveXRayParam();
  1388. //然后再把各类传入到SaveInfoToProgMgrFile函数中
  1389. if (false == SaveInfoToProgMgrFile())
  1390. {
  1391. return;
  1392. }
  1393. //保存样品台到文件,在被修改时进行保存
  1394. if (true == IsModified())
  1395. {
  1396. if (true == StageSave())
  1397. {
  1398. this.DialogResult = DialogResult.OK;
  1399. this.Close();
  1400. return;
  1401. }
  1402. else
  1403. {
  1404. string message = table["message54"].ToString();
  1405. log.Error("(ProgMgrInfoForm.btnok_Click) " + message);
  1406. this.Close();
  1407. return;
  1408. }
  1409. }
  1410. }
  1411. //关闭窗体
  1412. private void btncancel_Click(object sender, EventArgs e)
  1413. {
  1414. this.Close();
  1415. }
  1416. #endregion
  1417. #region 选择样品台事件
  1418. private void IDC_COMBO_STAGE_SelectedIndexChanged(object sender, EventArgs e)
  1419. {
  1420. //样品台
  1421. if (!StageLoad())
  1422. {
  1423. this.Close();
  1424. return;//加载失败返回
  1425. }
  1426. ThisSetIsModify();
  1427. //加载相关参数信息
  1428. //StageLoad();
  1429. //LoadSEMStageData();
  1430. //LoadImageScanPrm();
  1431. //LoadCGenParam();
  1432. //LoadImageProc();
  1433. //LoadXRayParam();
  1434. }
  1435. /// <summary>
  1436. /// 通过id设置当前正在工作的样品台
  1437. /// </summary>
  1438. /// <param name="id"></param>
  1439. public void SetWorkingStageId(int id)
  1440. {
  1441. m_cstagefile.SetWorkingStageId(id);
  1442. }
  1443. /// <summary>
  1444. /// 设置当前样品台正在被修改中
  1445. /// </summary>
  1446. /// <param name="yn"></param>
  1447. public void SetModify(bool yn)
  1448. {
  1449. m_cstagefile.SetModify(true);
  1450. }
  1451. /// <summary>
  1452. /// 设置当前窗体可以保存了
  1453. /// </summary>
  1454. private void ThisSetIsModify()
  1455. {
  1456. ComboBoxItem cbi = new ComboBoxItem();
  1457. if (IDC_COMBO_STAGE.Items.Count > 0)
  1458. if (null != IDC_COMBO_STAGE.SelectedItem)
  1459. {
  1460. cbi = (ComboBoxItem)IDC_COMBO_STAGE.SelectedItem;
  1461. SetWorkingStageId(Convert.ToInt32(cbi.Value));
  1462. SetModify(true);
  1463. btnok.Enabled = true;
  1464. }
  1465. }
  1466. #endregion
  1467. #region 监视控件改变状态事件
  1468. private void IDC_EDIT_SCREENWIDTH_TextChanged(object sender, EventArgs e)
  1469. {
  1470. ThisSetIsModify();
  1471. }
  1472. private void IDC_COMBO_XDIREC_SelectedIndexChanged(object sender, EventArgs e)
  1473. {
  1474. ThisSetIsModify();
  1475. }
  1476. private void IDC_EDIT_XSTART_TextChanged(object sender, EventArgs e)
  1477. {
  1478. ThisSetIsModify();
  1479. }
  1480. private void IDC_EDIT_XEND_TextChanged(object sender, EventArgs e)
  1481. {
  1482. ThisSetIsModify();
  1483. }
  1484. private void IDC_COMBO_YDIRECT_SelectedIndexChanged(object sender, EventArgs e)
  1485. {
  1486. ThisSetIsModify();
  1487. }
  1488. private void IDC_EDIT_YSTART_TextChanged(object sender, EventArgs e)
  1489. {
  1490. ThisSetIsModify();
  1491. }
  1492. private void IDC_EDIT_YEND_TextChanged(object sender, EventArgs e)
  1493. {
  1494. ThisSetIsModify();
  1495. }
  1496. private void IDC_EDIT_MINMAG_TextChanged(object sender, EventArgs e)
  1497. {
  1498. ThisSetIsModify();
  1499. }
  1500. private void IDC_COMBO_STOPMODE_SelectedIndexChanged(object sender, EventArgs e)
  1501. {
  1502. ThisSetIsModify();
  1503. }
  1504. private void IDC_EDIT_STOP_TIME_TextChanged(object sender, EventArgs e)
  1505. {
  1506. ThisSetIsModify();
  1507. }
  1508. private void IDC_EDIT_STOP_FIELD_NUM_TextChanged(object sender, EventArgs e)
  1509. {
  1510. ThisSetIsModify();
  1511. }
  1512. private void IDC_EDIT_STOP_INCA_NUM_TextChanged(object sender, EventArgs e)
  1513. {
  1514. ThisSetIsModify();
  1515. }
  1516. private void IDC_COMBO_FETCHIMGMODE_SelectedIndexChanged(object sender, EventArgs e)
  1517. {
  1518. ThisSetIsModify();
  1519. }
  1520. private void IDC_COMBO_IMGSCANSPEED_SelectedIndexChanged(object sender, EventArgs e)
  1521. {
  1522. ThisSetIsModify();
  1523. }
  1524. private void IDC_COMBO_IMGSIZE_SelectedIndexChanged(object sender, EventArgs e)
  1525. {
  1526. ThisSetIsModify();
  1527. }
  1528. private void IDC_EDIT_SAMPLENAME_TextChanged(object sender, EventArgs e)
  1529. {
  1530. ThisSetIsModify();
  1531. }
  1532. private void IDC_MEAS_SWITCH_CheckedChanged(object sender, EventArgs e)
  1533. {
  1534. ThisSetIsModify();
  1535. }
  1536. private void IDC_EDIT_MEASUREPARAMPATH_TextChanged(object sender, EventArgs e)
  1537. {
  1538. ThisSetIsModify();
  1539. }
  1540. private void IDC_EDIT_ANALYSESTDLIBPATH_TextChanged(object sender, EventArgs e)
  1541. {
  1542. ThisSetIsModify();
  1543. }
  1544. private void IDC_EDIT_STDLIBNAME_TextChanged(object sender, EventArgs e)
  1545. {
  1546. ThisSetIsModify();
  1547. }
  1548. private void IDC_EDIT_PARTAREAMIN_TextChanged(object sender, EventArgs e)
  1549. {
  1550. ThisSetIsModify();
  1551. }
  1552. private void IDC_EDIT_PARTAREAMAX_TextChanged(object sender, EventArgs e)
  1553. {
  1554. ThisSetIsModify();
  1555. }
  1556. private void IDC_EDIT_BACKMIN_TextChanged(object sender, EventArgs e)
  1557. {
  1558. ThisSetIsModify();
  1559. }
  1560. private void IDC_EDIT_BACKMAX_TextChanged(object sender, EventArgs e)
  1561. {
  1562. ThisSetIsModify();
  1563. }
  1564. private void IDC_EDIT_PARTMIN_TextChanged(object sender, EventArgs e)
  1565. {
  1566. ThisSetIsModify();
  1567. }
  1568. private void IDC_EDIT_PARTMAX_TextChanged(object sender, EventArgs e)
  1569. {
  1570. ThisSetIsModify();
  1571. }
  1572. private void IDC_COMBO_AUTOBGREMOVETYPE_SelectedIndexChanged(object sender, EventArgs e)
  1573. {
  1574. ThisSetIsModify();
  1575. }
  1576. private void IDC_COMBO_BGREMOVETYPE_SelectedIndexChanged(object sender, EventArgs e)
  1577. {
  1578. ComboBox cbBGREMOVETYPE = (ComboBox)sender;
  1579. int selectValue=Convert.ToInt32(((OTSMeasureApp.ComboBoxItem)cbBGREMOVETYPE.Items[cbBGREMOVETYPE.SelectedIndex]).Value);
  1580. if (selectValue == (int)otsdataconst.OTS_AUTOBGREMOVETYPE.MANUAL)
  1581. {
  1582. IDC_COMBO_AUTOBGREMOVETYP.Enabled = false;
  1583. }
  1584. else
  1585. {
  1586. IDC_COMBO_AUTOBGREMOVETYP.Enabled = true;
  1587. }
  1588. ThisSetIsModify();
  1589. }
  1590. private void IDC_COMBO_SEARCHXRAYSPEED_SelectedIndexChanged(object sender, EventArgs e)
  1591. {
  1592. ThisSetIsModify();
  1593. }
  1594. private void IDC_EDIT_SEARCHXRAYCOUNTLIMIT_TextChanged(object sender, EventArgs e)
  1595. {
  1596. ThisSetIsModify();
  1597. }
  1598. private void IDC_COMBO_XRAYSCANMODE_SelectedIndexChanged(object sender, EventArgs e)
  1599. {
  1600. ThisSetIsModify();
  1601. }
  1602. private void IDC_COMBO_ANALYXRAYSPEED_SelectedIndexChanged(object sender, EventArgs e)
  1603. {
  1604. ThisSetIsModify();
  1605. }
  1606. private void IDC_EDIT_ANALYXRAYAIMVALUE_TextChanged(object sender, EventArgs e)
  1607. {
  1608. ThisSetIsModify();
  1609. }
  1610. private void IDC_COMBO_TECHNOLOGY_SelectedIndexChanged(object sender, EventArgs e)
  1611. {
  1612. ThisSetIsModify();
  1613. }
  1614. private void IDC_STOP_MODE_SWITCH_CheckedChanged(object sender, EventArgs e)
  1615. {
  1616. ThisSetIsModify();
  1617. }
  1618. private void IDC_STOP_TIME_SWITCH_CheckedChanged(object sender, EventArgs e)
  1619. {
  1620. ThisSetIsModify();
  1621. }
  1622. private void IDC_STOP_FIELD_SWITCH_CheckedChanged(object sender, EventArgs e)
  1623. {
  1624. ThisSetIsModify();
  1625. }
  1626. private void IDC_STOP_PARTICAL_SWITCH_CheckedChanged(object sender, EventArgs e)
  1627. {
  1628. ThisSetIsModify();
  1629. }
  1630. private void IDC_FETCH_IMAGE_SWITCH_CheckedChanged(object sender, EventArgs e)
  1631. {
  1632. ThisSetIsModify();
  1633. }
  1634. private void IDC_SCAN_SPEED_SWITCH_CheckedChanged(object sender, EventArgs e)
  1635. {
  1636. ThisSetIsModify();
  1637. }
  1638. private void IDC_IMAGE_SIZE_SWITCH_CheckedChanged(object sender, EventArgs e)
  1639. {
  1640. ThisSetIsModify();
  1641. }
  1642. private void IDC_PART_MIN_SWITCH_CheckedChanged(object sender, EventArgs e)
  1643. {
  1644. ThisSetIsModify();
  1645. }
  1646. private void IDC_PART_MAX_SWITCH_CheckedChanged(object sender, EventArgs e)
  1647. {
  1648. ThisSetIsModify();
  1649. }
  1650. private void IDC_BACK_MIN_SWITCH_CheckedChanged(object sender, EventArgs e)
  1651. {
  1652. ThisSetIsModify();
  1653. }
  1654. private void IDC_BACK_MAX_SWITCH_CheckedChanged(object sender, EventArgs e)
  1655. {
  1656. ThisSetIsModify();
  1657. }
  1658. private void IDC_PART_GRAY_SWITCH_CheckedChanged(object sender, EventArgs e)
  1659. {
  1660. ThisSetIsModify();
  1661. }
  1662. private void IDC_PART_GRAY_MAX_CheckedChanged(object sender, EventArgs e)
  1663. {
  1664. ThisSetIsModify();
  1665. }
  1666. private void IDC_XRAY_MODE_SWITCH_CheckedChanged(object sender, EventArgs e)
  1667. {
  1668. ThisSetIsModify();
  1669. }
  1670. private void IDC_XRAY_TIME_SWITCH_CheckedChanged(object sender, EventArgs e)
  1671. {
  1672. ThisSetIsModify();
  1673. }
  1674. private void IDC_XRAY_COUNT_SWITCH_CheckedChanged(object sender, EventArgs e)
  1675. {
  1676. ThisSetIsModify();
  1677. }
  1678. private void cBMeasShape_SelectedIndexChanged(object sender, EventArgs e)
  1679. {
  1680. ThisSetIsModify();
  1681. }
  1682. private void tBMeasArea_TextChanged(object sender, EventArgs e)
  1683. {
  1684. ThisSetIsModify();
  1685. }
  1686. private void IDC_SYS_LIB_CheckedChanged(object sender, EventArgs e)
  1687. {
  1688. ThisSetIsModify();
  1689. }
  1690. #endregion
  1691. private void IDC_COMBO_STDSelect_SelectedIndexChanged(object sender, EventArgs e)
  1692. {
  1693. ThisSetIsModify();
  1694. }
  1695. private void IDC_COMBO_USINGXRAYS_SelectedIndexChanged(object sender, EventArgs e)
  1696. {
  1697. ThisSetIsModify();
  1698. }
  1699. private void IDC_COMBO_Model_SelectedIndexChanged(object sender, EventArgs e)
  1700. {
  1701. ThisSetIsModify();
  1702. }
  1703. private void btn_StopMode_Click(object sender, EventArgs e)
  1704. {
  1705. if (StopModeDialog == null)
  1706. {
  1707. StopModeDialog = new frmMeasureStopMode();
  1708. StopModeDialog.FieldMode = m_cotsimgscanprm.GetStopParamFields();
  1709. StopModeDialog.TimeMode = m_cotsimgscanprm.GetStopParamMeasTime();
  1710. StopModeDialog.ParticleMode = m_cotsimgscanprm.GetStopParamParticles();
  1711. StopModeDialog.AreaMode = m_cotsimgscanprm.GetStopParamArea();
  1712. StopModeDialog.StopMode = tB_StopMode.Text;
  1713. }
  1714. DialogResult result = StopModeDialog.ShowDialog();
  1715. if (result == DialogResult.OK)
  1716. {
  1717. string[] rst = StopModeDialog.StopMode.Split(',');
  1718. string str = "";
  1719. for (int k = 0; k < rst.Length; k++)
  1720. {
  1721. str += rst[k].Split(':')[0] + " + ";
  1722. }
  1723. tB_StopMode.Text = str.Substring(0, str.Length - 3);
  1724. }
  1725. }
  1726. private void IDC_COMBO_CorrosionExpansionCoefficient_TextChanged(object sender, EventArgs e)
  1727. {
  1728. ThisSetIsModify();
  1729. }
  1730. private void button_SpPart_Click(object sender, EventArgs e)
  1731. {
  1732. }
  1733. private void checkBox_Run_CheckedChanged(object sender, EventArgs e)
  1734. {
  1735. }
  1736. }
  1737. public class ComboBoxItem
  1738. {
  1739. private string _text = null;
  1740. private object _value = null;
  1741. public string Text { get { return this._text; } set { this._text = value; } }
  1742. public object Value { get { return this._value; } set { this._value = value; } }
  1743. public override string ToString()
  1744. {
  1745. return this._text;
  1746. }
  1747. }
  1748. }