ProgMgrInfoForm.cs 84 KB

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