ProgMgrInfoForm.cs 77 KB

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