ProgMgrInfoForm.cs 81 KB

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