ProgMgrInfoForm.cs 83 KB

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