FormUnitControl.cs 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461
  1. //时间:
  2. //作者:
  3. //功能:单元测试功能
  4. using System;
  5. using System.Collections.Generic;
  6. using System.ComponentModel;
  7. using System.Data;
  8. using System.Drawing;
  9. using System.Linq;
  10. using System.Runtime.InteropServices;
  11. using System.Text;
  12. using System.Threading;
  13. using System.Threading.Tasks;
  14. using System.Windows.Forms;
  15. using System.Configuration;
  16. using System.IO;
  17. using SmartSEMControl;
  18. using FileManager;
  19. using System.Xml;
  20. using MeasureData;
  21. using WebManager;
  22. namespace HOZProject
  23. {
  24. public partial class FormUnitControl : Form
  25. {
  26. #region 系统参数
  27. //全局只有一个fatorySEM
  28. static FactoryHardware factorySEM = FactoryHardware.Instance;
  29. ISEMControl iSEM = factorySEM.ISEM;
  30. public XmlManager xmg = new XmlManager();
  31. private String path = Directory.GetCurrentDirectory();
  32. private int st_flag = 0;
  33. WebResult wr = new WebResult("127.0.0.1", "18080");
  34. #endregion
  35. #region 构造函数
  36. public FormUnitControl()
  37. {
  38. InitializeComponent();
  39. Control.CheckForIllegalCrossThreadCalls = false;
  40. if(iSEM.ConnectStatus())
  41. {
  42. float ret = iSEM.GetFIBIMAGING();
  43. if(ret==0)
  44. {
  45. btnSEM.BackColor = Color.Lime;
  46. }
  47. else if(ret==1)
  48. {
  49. btnFIB.BackColor = Color.Lime;
  50. panelFIB.Visible = true;
  51. }
  52. else if(ret==2)
  53. {
  54. btnMILL.BackColor = Color.Lime;
  55. }
  56. }
  57. //Calling Notification for updated status
  58. //CZEMApi.Notify += new _EMApiEvents_NotifyEventHandler(CZEMApi_Notify);
  59. //CZEMApi.NotifyWithCurrentValue += new _EMApiEvents_NotifyWithCurrentValueEventHandler(CZEMApi_NotifyWithCurrentValue);
  60. //加载参数
  61. }
  62. #endregion
  63. #region 缩放Get
  64. private void btnenlargeGet_Click(object sender, EventArgs e)
  65. {
  66. float ret = iSEM.GetMagnification();
  67. if (float.IsNaN(ret))
  68. {
  69. txtenlargeSet.Text = "NaN";
  70. txtenlargeSet.Enabled = false;
  71. btnenlargeSet.Enabled = false;
  72. }
  73. else
  74. {
  75. txtenlargeSet.Text = ret.ToString();
  76. btnenlargeSet.Enabled = true;
  77. }
  78. }
  79. #endregion
  80. #region 缩放Set
  81. private void btnenlargeSet_Click(object sender, EventArgs e)
  82. {
  83. float set = 0;
  84. if (float.TryParse(txtenlargeSet.Text, out set))
  85. {
  86. iSEM.SetMagnification(set);
  87. }
  88. }
  89. #endregion
  90. #region 焦距Get
  91. private void btnWDGet_Click(object sender, EventArgs e)
  92. {
  93. float ret = iSEM.GetWorkingDistance();
  94. if (float.IsNaN(ret))
  95. {
  96. txtWDSet.Text = "NaN";
  97. txtWDSet.Enabled = false;
  98. btnWDSet.Enabled = false;
  99. }
  100. else
  101. {
  102. txtWDSet.Text = ret.ToString();
  103. btnWDSet.Enabled = true;
  104. }
  105. }
  106. #endregion
  107. #region 焦距Set
  108. private void btnWDSet_Click(object sender, EventArgs e)
  109. {
  110. float set = 0;
  111. if (float.TryParse(txtWDSet.Text, out set))
  112. {
  113. iSEM.SetWorkingDistance(set);
  114. }
  115. }
  116. #endregion
  117. #region 亮度Get
  118. private void btnBrightnessGet_Click(object sender, EventArgs e)
  119. {
  120. float ret = iSEM.GetBrightness();
  121. if (float.IsNaN(ret))
  122. {
  123. txtBrightnessSet.Text = "NaN";
  124. txtBrightnessSet.Enabled = false;
  125. btnBrightnessSet.Enabled = false;
  126. }
  127. else
  128. {
  129. txtBrightnessSet.Text = ret.ToString();
  130. btnBrightnessSet.Enabled = true;
  131. }
  132. }
  133. #endregion
  134. #region 亮度Set
  135. private void btnBrightnessSet_Click(object sender, EventArgs e)
  136. {
  137. float set = 0;
  138. if (float.TryParse(txtBrightnessSet.Text, out set))
  139. {
  140. iSEM.SetBrightness(set);
  141. }
  142. }
  143. #endregion
  144. #region 对比度Get
  145. private void btnContrastGet_Click(object sender, EventArgs e)
  146. {
  147. float ret = iSEM.GetContrast();
  148. if (float.IsNaN(ret))
  149. {
  150. txtContrastSet.Text = "NaN";
  151. txtContrastSet.Enabled = false;
  152. btnContrastSet.Enabled = false;
  153. }
  154. else
  155. {
  156. txtContrastSet.Text = ret.ToString();
  157. btnContrastSet.Enabled = true;
  158. }
  159. }
  160. #endregion
  161. #region 对比度Set
  162. private void btnContrastSet_Click(object sender, EventArgs e)
  163. {
  164. float set = 0;
  165. if (float.TryParse(txtContrastSet.Text, out set))
  166. {
  167. iSEM.SetContrast(set);
  168. }
  169. }
  170. #endregion
  171. #region 消像散X Get
  172. private void btnAstigmatismXGet_Click(object sender, EventArgs e)
  173. {
  174. float ret = iSEM.GetAstigmatismX();
  175. if (float.IsNaN(ret))
  176. {
  177. txtAstigmatismXSet.Text = "NaN";
  178. txtAstigmatismXSet.Enabled = false;
  179. btnAstigmatismXSet.Enabled = false;
  180. }
  181. else
  182. {
  183. txtAstigmatismXSet.Text = ret.ToString();
  184. btnAstigmatismXSet.Enabled = true;
  185. }
  186. }
  187. #endregion
  188. #region 消像散X Set
  189. private void btnAstigmatismXSet_Click(object sender, EventArgs e)
  190. {
  191. float set = 0;
  192. if (float.TryParse(txtAstigmatismXSet.Text, out set))
  193. {
  194. iSEM.SetAstigmatismX(set);
  195. }
  196. }
  197. #endregion
  198. #region 消像散Y Get
  199. private void btnAstigmatismYGet_Click(object sender, EventArgs e)
  200. {
  201. float ret = iSEM.GetAstigmatismY();
  202. if (float.IsNaN(ret))
  203. {
  204. txtAstigmatismYSet.Text = "NaN";
  205. txtAstigmatismYSet.Enabled = false;
  206. btnAstigmatismYSet.Enabled = false;
  207. }
  208. else
  209. {
  210. txtAstigmatismYSet.Text = ret.ToString();
  211. btnAstigmatismYSet.Enabled = true;
  212. }
  213. }
  214. #endregion
  215. #region 消像散Y Set
  216. private void btnAstigmatismYSet_Click(object sender, EventArgs e)
  217. {
  218. float set = 0;
  219. if (float.TryParse(txtAstigmatismYSet.Text, out set))
  220. {
  221. iSEM.SetAstigmatismY(set);
  222. }
  223. }
  224. #endregion
  225. #region 角度补偿Get
  226. private void btnTiltAngleGet_Click(object sender, EventArgs e)
  227. {
  228. float ret = iSEM.GetTiltAngle();
  229. if (float.IsNaN(ret))
  230. {
  231. txtTiltAngleSet.Text = "NaN";
  232. txtTiltAngleSet.Enabled = false;
  233. btnTiltAngleSet.Enabled = false;
  234. }
  235. else
  236. {
  237. txtTiltAngleSet.Text = ret.ToString();
  238. btnTiltAngleSet.Enabled = true;
  239. }
  240. }
  241. #endregion
  242. #region 角度补偿Set
  243. private void btnTiltAngleSet_Click(object sender, EventArgs e)
  244. {
  245. float set = 0;
  246. if (float.TryParse(txtTiltAngleSet.Text, out set))
  247. {
  248. //iSEM.SetTiltAngleOn();
  249. iSEM.SetTiltAngle(set);
  250. }
  251. }
  252. #endregion
  253. #region 抓取图像
  254. private void btnGrabImage_Click(object sender, EventArgs e)
  255. {
  256. SaveFileDialog sfd = new SaveFileDialog();
  257. sfd.Title = "图像保存位置:";
  258. sfd.FileName = "test.tif";
  259. sfd.Filter = "TIF文件|*.tif";
  260. if (sfd.ShowDialog() == DialogResult.OK)
  261. {
  262. string fn = sfd.FileName;
  263. iSEM.GrabImage(fn, 0, 0, 1024, 768, 0);
  264. }
  265. }
  266. #endregion
  267. #region ScanRotate Get
  268. private void btnScanRotationGet_Click(object sender, EventArgs e)
  269. {
  270. float ret = iSEM.GetScanRotation();
  271. if (float.IsNaN(ret))
  272. {
  273. txtScanRotationSet.Text = "NaN";
  274. txtScanRotationSet.Enabled = false;
  275. btnScanRotationSet.Enabled = false;
  276. }
  277. else
  278. {
  279. txtScanRotationSet.Text = ret.ToString();
  280. btnScanRotationSet.Enabled = true;
  281. }
  282. }
  283. #endregion
  284. #region ScanRotate Set
  285. private void btnScanRotationSet_Click(object sender, EventArgs e)
  286. {
  287. float set = 0;
  288. if (float.TryParse(txtScanRotationSet.Text, out set))
  289. {
  290. //iSEM.SetScanRotationOn();
  291. iSEM.SetScanRotation(set);
  292. }
  293. }
  294. #endregion
  295. #region PixelSize Get
  296. private void btnPixelSizeGet_Click(object sender, EventArgs e)
  297. {
  298. float ret = iSEM.GetPixelSize();
  299. if (float.IsNaN(ret))
  300. {
  301. lblPixelSizeGet.Text = "NaN";
  302. }
  303. else
  304. {
  305. lblPixelSizeGet.Text = ret.ToString();
  306. }
  307. }
  308. #endregion
  309. #region 电子束
  310. private void btnTiltCorrXGet_Click(object sender, EventArgs e)
  311. {
  312. float ret = iSEM.GetBeamShiftX();
  313. if (float.IsNaN(ret))
  314. {
  315. txtTiltCorrX.Text = "NaN";
  316. txtTiltCorrX.Enabled = false;
  317. btnTiltCorrXSet.Enabled = false;
  318. }
  319. else
  320. {
  321. txtTiltCorrX.Text = ret.ToString();
  322. btnTiltCorrXSet.Enabled = true;
  323. }
  324. }
  325. private void btnTiltCorrXSet_Click(object sender, EventArgs e)
  326. {
  327. float set = 0;
  328. if (float.TryParse(txtTiltCorrX.Text, out set))
  329. {
  330. iSEM.SetBeamShiftX(set);
  331. }
  332. }
  333. private void btnTiltCorrYGet_Click(object sender, EventArgs e)
  334. {
  335. float ret = iSEM.GetBeamShiftY();
  336. if (float.IsNaN(ret))
  337. {
  338. txtTiltCorrY.Text = "NaN";
  339. txtTiltCorrY.Enabled = false;
  340. btnTiltCorrYSet.Enabled = false;
  341. }
  342. else
  343. {
  344. txtTiltCorrY.Text = ret.ToString();
  345. btnTiltCorrYSet.Enabled = true;
  346. }
  347. }
  348. private void btnTiltCorrYSet_Click(object sender, EventArgs e)
  349. {
  350. float set = 0;
  351. if (float.TryParse(txtTiltCorrY.Text, out set))
  352. {
  353. iSEM.SetBeamShiftY(set);
  354. }
  355. }
  356. #endregion
  357. #region 开启电压
  358. private void btnOpenVoltage_Click(object sender, EventArgs e)
  359. {
  360. iSEM.CmdOpenVoltage();
  361. }
  362. #endregion
  363. #region 关闭电压
  364. private void btnCloseVoltage_Click(object sender, EventArgs e)
  365. {
  366. iSEM.CmdCloseVoltage();
  367. }
  368. #endregion
  369. #region 电子束校正
  370. private void btnTiltCorr_Click(object sender, EventArgs e)
  371. {
  372. float ret = iSEM.GetTiltCorrection();
  373. if (float.IsNaN(ret))
  374. {
  375. btnTiltCorr.BackColor = Color.Red;
  376. }
  377. else
  378. {
  379. if(ret==0)
  380. {
  381. btnTiltCorr.BackColor = Color.Blue;
  382. iSEM.SetTiltCorrectionOn();
  383. btnTiltCorr.Text = "电子束状态:On";
  384. }
  385. else
  386. {
  387. btnTiltCorr.BackColor = Color.Lime;
  388. iSEM.SetTiltCorrectionOff();
  389. btnTiltCorr.Text = "电子束状态:Off";
  390. }
  391. }
  392. }
  393. #endregion
  394. #region 样品台位置获取
  395. private void btnStageGetX_Click(object sender, EventArgs e)
  396. {
  397. float ret = iSEM.GetStageAtX();
  398. if (float.IsNaN(ret))
  399. {
  400. lblStageX.Text = "NaN";
  401. }
  402. else
  403. {
  404. lblStageX.Text = ret.ToString();
  405. }
  406. }
  407. private void btnStageGetY_Click(object sender, EventArgs e)
  408. {
  409. float ret = iSEM.GetStageAtY();
  410. if (float.IsNaN(ret))
  411. {
  412. lblStageY.Text = "NaN";
  413. }
  414. else
  415. {
  416. lblStageY.Text = ret.ToString();
  417. }
  418. }
  419. private void btnStageGetZ_Click(object sender, EventArgs e)
  420. {
  421. float ret = iSEM.GetStageAtZ();
  422. if (float.IsNaN(ret))
  423. {
  424. lblStageZ.Text = "NaN";
  425. }
  426. else
  427. {
  428. lblStageZ.Text = ret.ToString();
  429. }
  430. }
  431. private void btnStageGetT_Click(object sender, EventArgs e)
  432. {
  433. float ret = iSEM.GetStageAtT();
  434. if (float.IsNaN(ret))
  435. {
  436. lblStageT.Text = "NaN";
  437. }
  438. else
  439. {
  440. lblStageT.Text = ret.ToString();
  441. }
  442. }
  443. private void btnStageGetR_Click(object sender, EventArgs e)
  444. {
  445. float ret = iSEM.GetStageAtR();
  446. if (float.IsNaN(ret))
  447. {
  448. lblStageR.Text = "NaN";
  449. }
  450. else
  451. {
  452. lblStageR.Text = ret.ToString();
  453. }
  454. }
  455. private void btnStageGetM_Click(object sender, EventArgs e)
  456. {
  457. float ret = iSEM.GetStageAtM();
  458. if (float.IsNaN(ret))
  459. {
  460. lblStageM.Text = "NaN";
  461. }
  462. else
  463. {
  464. lblStageM.Text = ret.ToString();
  465. }
  466. }
  467. #endregion
  468. #region 样品台位置设置
  469. private void btnStageSetX_Click(object sender, EventArgs e)
  470. {
  471. float set = 0;
  472. if (float.TryParse(txtStageX.Text, out set))
  473. {
  474. iSEM.SetStageGotoX(set);
  475. }
  476. }
  477. private void btnStageSetY_Click(object sender, EventArgs e)
  478. {
  479. float set = 0;
  480. if (float.TryParse(txtStageY.Text, out set))
  481. {
  482. iSEM.SetStageGotoY(set);
  483. }
  484. }
  485. private void btnStageSetZ_Click(object sender, EventArgs e)
  486. {
  487. float set = 0;
  488. if (float.TryParse(txtStageZ.Text, out set))
  489. {
  490. iSEM.SetStageGotoZ(set);
  491. }
  492. }
  493. private void btnStageSetT_Click(object sender, EventArgs e)
  494. {
  495. float set = 0;
  496. if (float.TryParse(txtStageT.Text, out set))
  497. {
  498. iSEM.SetStageGotoT(set);
  499. }
  500. }
  501. private void btnStageSetR_Click(object sender, EventArgs e)
  502. {
  503. float set = 0;
  504. if (float.TryParse(txtStageR.Text, out set))
  505. {
  506. iSEM.SetStageGotoR(set);
  507. }
  508. }
  509. private void btnStageSetM_Click(object sender, EventArgs e)
  510. {
  511. float set = 0;
  512. if (float.TryParse(txtStageM.Text, out set))
  513. {
  514. iSEM.SetStageGotoM(set);
  515. }
  516. }
  517. #endregion
  518. #region 获取样品台位置数组
  519. private void btnGetStagePosition_Click(object sender, EventArgs e)
  520. {
  521. float[] pt = iSEM.GetStagePosition();
  522. if (!float.IsNaN(pt[0]))
  523. {
  524. lblStageX.Text = pt[0].ToString();
  525. }
  526. if (!float.IsNaN(pt[1]))
  527. {
  528. lblStageY.Text = pt[1].ToString();
  529. }
  530. if (!float.IsNaN(pt[2]))
  531. {
  532. lblStageZ.Text = pt[2].ToString();
  533. }
  534. if (!float.IsNaN(pt[3]))
  535. {
  536. lblStageT.Text = pt[3].ToString();
  537. }
  538. if (!float.IsNaN(pt[4]))
  539. {
  540. lblStageR.Text = pt[4].ToString();
  541. }
  542. if (!float.IsNaN(pt[5]))
  543. {
  544. lblStageM.Text = pt[5].ToString();
  545. }
  546. }
  547. #endregion
  548. #region 窗体关闭
  549. private void FormUnitControl_FormClosing(object sender, FormClosingEventArgs e)
  550. {
  551. if(iSEM!=null)
  552. {
  553. iSEM.Dispose();
  554. }
  555. }
  556. #endregion
  557. #region 宏文件
  558. private void btnCMDMCF_Click(object sender, EventArgs e)
  559. {
  560. iSEM.CMDMCFFilename("OPTON");
  561. }
  562. #endregion
  563. #region 读取Xml文件
  564. private void btnReadXml_Click(object sender, EventArgs e)
  565. {
  566. MeasureFile mf = new MeasureFile();
  567. XmlDocument doc = new XmlDocument();
  568. doc.Load("test_opton.msf");//载入xml文件
  569. XmlNode root = doc.SelectSingleNode("XMLData");
  570. mf.Serialize(false, doc, root);
  571. doc.Save("test_opton.msf");
  572. }
  573. #endregion
  574. #region 写入Xml文件
  575. private void btnWriteXml_Click(object sender, EventArgs e)
  576. {
  577. MeasureFile mf = new MeasureFile();
  578. mf.FileName = path + "\\test_opton.msf";
  579. mf.FilePath = path;
  580. CutHole ch = new CutHole();
  581. ch.OPT = Operation.Image;
  582. ch.START = System.DateTime.Now;
  583. ch.END = System.DateTime.Now.AddHours(2);
  584. ch.STATE = State.Success;
  585. ch.SWITCH = true;
  586. SemPosition sp = new SemPosition();
  587. sp.X = 11;
  588. sp.Y = 22;
  589. sp.Z = 33;
  590. sp.T = 44;
  591. sp.R = 55;
  592. sp.M = 66;
  593. ch.Position = sp;
  594. mf.ListCutHole.Add(ch);
  595. ch = new CutHole();
  596. ch.OPT = Operation.Image;
  597. ch.START = System.DateTime.Now;
  598. ch.END = System.DateTime.Now.AddHours(2);
  599. ch.STATE = State.Success;
  600. ch.SWITCH = true;
  601. sp = new SemPosition();
  602. sp.X = 12;
  603. sp.Y = 34;
  604. sp.Z = 56;
  605. sp.T = 78;
  606. sp.R = 90;
  607. sp.M = 55;
  608. ch.Position = sp;
  609. mf.ListCutHole.Add(ch);
  610. MeasureParam md = new MeasureParam();
  611. md.SampleName = "aaaaaa";
  612. md.PT = true;
  613. md.PTTemp = "bbbbb";
  614. md.FIBTemp = "cccc";
  615. md.FocusMode = false;
  616. mf.MParam = md;
  617. mf.New();
  618. //XmlDocument doc = new XmlDocument();
  619. //doc.Load(mf.FilePath+"\\" + mf.FileName);//载入xml文件
  620. //XmlNode root = doc.SelectSingleNode("XMLData");
  621. //mf.Serialize(true, doc, root);
  622. //doc.Save("test.aaa");
  623. }
  624. #endregion
  625. #region SEM模式
  626. private void btnSEM_Click(object sender, EventArgs e)
  627. {
  628. if(iSEM.CmdFIBModeSEM())
  629. {
  630. btnFIB.BackColor = SystemColors.Control;
  631. btnSEM.BackColor = Color.Lime;
  632. btnMILL.BackColor = SystemColors.Control;
  633. panelFIB.Visible = false;
  634. }
  635. }
  636. #endregion
  637. #region FIB模式
  638. private void btnFIB_Click(object sender, EventArgs e)
  639. {
  640. if(iSEM.CmdFIBModeFIB())
  641. {
  642. btnFIB.BackColor = Color.Lime;
  643. btnSEM.BackColor = SystemColors.Control;
  644. btnMILL.BackColor = SystemColors.Control;
  645. panelFIB.Visible = true;
  646. }
  647. }
  648. #endregion
  649. #region MILL模式
  650. private void btnMILL_Click(object sender, EventArgs e)
  651. {
  652. if(iSEM.CmdFIBModeMILL())
  653. {
  654. btnFIB.BackColor = SystemColors.Control;
  655. btnSEM.BackColor = SystemColors.Control;
  656. btnMILL.BackColor = Color.Lime;
  657. }
  658. }
  659. #endregion
  660. #region 自动对焦1
  661. private void btnAutoFocus1_Click(object sender, EventArgs e)
  662. {
  663. //抓图1
  664. iSEM.GrabImage(path + "\\test1.tif", 0, 0, 1024, 768, 0);
  665. if (File.Exists(path + "\\test1.tif"))
  666. {
  667. FileStream fileStream = new FileStream(path + "\\test1.tif", FileMode.Open, FileAccess.Read);
  668. pictureBox1.Image = Image.FromStream(fileStream);
  669. fileStream.Close();
  670. fileStream.Dispose();
  671. }
  672. Thread.Sleep(1000);
  673. iSEM.CmdAutoFocusCoarse();
  674. btnAutoFocus1.BackColor = Color.Red;
  675. st_flag = 1;
  676. Thread.Sleep(1000);
  677. Thread thread = new Thread(AutoFunction);
  678. thread.Start();
  679. }
  680. #endregion
  681. #region 自动函数监测线程
  682. private void AutoFunction()
  683. {
  684. float ret = 111;
  685. Boolean state = false;
  686. while(true)
  687. {
  688. Thread.Sleep(1000);
  689. ret = iSEM.GetAutoFunction();
  690. if(ret==0)
  691. {
  692. if (st_flag == 1 && state == true)
  693. {
  694. btnAutoFocus1.BackColor = Color.Lime;
  695. Thread.Sleep(1000);
  696. //抓图1
  697. iSEM.GrabImage(path + "\\test2.tif", 0, 0, 1024, 768, 0);
  698. if (File.Exists(path + "\\test2.tif"))
  699. {
  700. FileStream fileStream = new FileStream(path + "\\test2.tif", FileMode.Open, FileAccess.Read);
  701. pictureBox2.Image = Image.FromStream(fileStream);
  702. fileStream.Close();
  703. fileStream.Dispose();
  704. }
  705. break;
  706. }
  707. else if(st_flag==2 && state)
  708. {
  709. btnAutoFocus2.BackColor = Color.Lime;
  710. Thread.Sleep(1000);
  711. //抓图1
  712. iSEM.GrabImage(path + "\\test2.tif", 0, 0, 1024, 768, 0);
  713. if (File.Exists(path + "\\test2.tif"))
  714. {
  715. FileStream fileStream = new FileStream(path + "\\test2.tif", FileMode.Open, FileAccess.Read);
  716. pictureBox2.Image = Image.FromStream(fileStream);
  717. fileStream.Close();
  718. fileStream.Dispose();
  719. }
  720. break;
  721. }
  722. else if (st_flag == 3)
  723. {
  724. btnAutoBrightness.BackColor = Color.Lime;
  725. Thread.Sleep(1000);
  726. //抓图1
  727. iSEM.GrabImage(path + "\\test2.tif", 0, 0, 1024, 768, 0);
  728. if (File.Exists(path + "\\test2.tif"))
  729. {
  730. FileStream fileStream = new FileStream(path + "\\test2.tif", FileMode.Open, FileAccess.Read);
  731. pictureBox2.Image = Image.FromStream(fileStream);
  732. fileStream.Close();
  733. fileStream.Dispose();
  734. }
  735. break;
  736. }
  737. else if (st_flag == 4)
  738. {
  739. btnAutoContrast.BackColor = Color.Lime;
  740. Thread.Sleep(1000);
  741. //抓图1
  742. iSEM.GrabImage(path + "\\test2.tif", 0, 0, 1024, 768, 0);
  743. if (File.Exists(path + "\\test2.tif"))
  744. {
  745. FileStream fileStream = new FileStream(path + "\\test2.tif", FileMode.Open, FileAccess.Read);
  746. pictureBox2.Image = Image.FromStream(fileStream);
  747. fileStream.Close();
  748. fileStream.Dispose();
  749. }
  750. break;
  751. }
  752. else if (st_flag == 5)
  753. {
  754. btnAutoBrightness.BackColor = Color.Lime;
  755. btnAutoContrast.BackColor = Color.Lime;
  756. btnAutoBC.BackColor = Color.Lime;
  757. Thread.Sleep(1000);
  758. //抓图1
  759. iSEM.GrabImage(path + "\\test2.tif", 0, 0, 1024, 768, 0);
  760. if (File.Exists(path + "\\test2.tif"))
  761. {
  762. FileStream fileStream = new FileStream(path + "\\test2.tif", FileMode.Open, FileAccess.Read);
  763. pictureBox2.Image = Image.FromStream(fileStream);
  764. fileStream.Close();
  765. fileStream.Dispose();
  766. }
  767. break;
  768. }
  769. else if (st_flag == 6 && state)
  770. {
  771. btnAutoBCCancle.BackColor = Color.Lime;
  772. Thread.Sleep(1000);
  773. //抓图1
  774. iSEM.GrabImage(path + "\\test2.tif", 0, 0, 1024, 768, 0);
  775. if (File.Exists(path + "\\test2.tif"))
  776. {
  777. FileStream fileStream = new FileStream(path + "\\test2.tif", FileMode.Open, FileAccess.Read);
  778. pictureBox2.Image = Image.FromStream(fileStream);
  779. fileStream.Close();
  780. fileStream.Dispose();
  781. }
  782. break;
  783. }
  784. else if (st_flag == 7 && state)
  785. {
  786. btnAutoStig.BackColor = Color.Lime;
  787. Thread.Sleep(1000);
  788. //抓图1
  789. iSEM.GrabImage(path + "\\test2.tif", 0, 0, 1024, 768, 0);
  790. if (File.Exists(path + "\\test2.tif"))
  791. {
  792. FileStream fileStream = new FileStream(path + "\\test2.tif", FileMode.Open, FileAccess.Read);
  793. pictureBox2.Image = Image.FromStream(fileStream);
  794. fileStream.Close();
  795. fileStream.Dispose();
  796. }
  797. break;
  798. }
  799. ////抓图1
  800. //iSEM.GrabImage(path + "\\test2.tif", 0, 0, 1024, 768, 0);
  801. //if (File.Exists(path + "\\test2.tif"))
  802. //{
  803. // FileStream fileStream = new FileStream(path + "\\test2.tif", FileMode.Open, FileAccess.Read);
  804. // pictureBox2.Image = Image.FromStream(fileStream);
  805. // fileStream.Close();
  806. // fileStream.Dispose();
  807. //}
  808. }
  809. else if(ret>0 && ret<12)
  810. {
  811. state = true;
  812. }
  813. }
  814. }
  815. #endregion
  816. #region 自动对焦2
  817. private void btnAutoFocus2_Click(object sender, EventArgs e)
  818. {
  819. //抓图1
  820. iSEM.GrabImage(path + "\\test1.tif", 0, 0, 1024, 768, 0);
  821. if (File.Exists(path + "\\test1.tif"))
  822. {
  823. FileStream fileStream = new FileStream(path + "\\test1.tif", FileMode.Open, FileAccess.Read);
  824. pictureBox1.Image = Image.FromStream(fileStream);
  825. fileStream.Close();
  826. fileStream.Dispose();
  827. }
  828. Thread.Sleep(1000);
  829. iSEM.CmdAutoFocusFine();
  830. btnAutoFocus2.BackColor = Color.Red;
  831. st_flag = 2;
  832. Thread.Sleep(1000);
  833. Thread thread = new Thread(AutoFunction);
  834. thread.Start();
  835. }
  836. #endregion
  837. #region 自动亮度、对比度
  838. private void btnAutoBrightness_Click(object sender, EventArgs e)
  839. {
  840. //抓图1
  841. iSEM.GrabImage(path + "\\test1.tif", 0, 0, 1024, 768, 0);
  842. if (File.Exists(path + "\\test1.tif"))
  843. {
  844. FileStream fileStream = new FileStream(path + "\\test1.tif", FileMode.Open, FileAccess.Read);
  845. pictureBox1.Image = Image.FromStream(fileStream);
  846. fileStream.Close();
  847. fileStream.Dispose();
  848. }
  849. Thread.Sleep(1000);
  850. iSEM.SetAutoVideoBrightness();
  851. btnAutoBrightness.BackColor = Color.Red;
  852. st_flag = 3;
  853. Thread.Sleep(1000);
  854. Thread thread = new Thread(AutoFunction);
  855. thread.Start();
  856. }
  857. private void btnAutoContrast_Click(object sender, EventArgs e)
  858. {
  859. //抓图1
  860. iSEM.GrabImage(path + "\\test1.tif", 0, 0, 1024, 768, 0);
  861. if (File.Exists(path + "\\test1.tif"))
  862. {
  863. FileStream fileStream = new FileStream(path + "\\test1.tif", FileMode.Open, FileAccess.Read);
  864. pictureBox1.Image = Image.FromStream(fileStream);
  865. fileStream.Close();
  866. fileStream.Dispose();
  867. }
  868. Thread.Sleep(1000);
  869. iSEM.SetAutoVideoContrast();
  870. btnAutoContrast.BackColor = Color.Red;
  871. st_flag = 4;
  872. Thread.Sleep(1000);
  873. Thread thread = new Thread(AutoFunction);
  874. thread.Start();
  875. }
  876. private void btnAutoBC_Click(object sender, EventArgs e)
  877. {
  878. //抓图1
  879. iSEM.GrabImage(path + "\\test1.tif", 0, 0, 1024, 768, 0);
  880. if (File.Exists(path + "\\test1.tif"))
  881. {
  882. FileStream fileStream = new FileStream(path + "\\test1.tif", FileMode.Open, FileAccess.Read);
  883. pictureBox1.Image = Image.FromStream(fileStream);
  884. fileStream.Close();
  885. fileStream.Dispose();
  886. }
  887. Thread.Sleep(1000);
  888. iSEM.SetAutoVideoBrightnessAndContrast();
  889. btnAutoBrightness.BackColor = Color.Red;
  890. btnAutoContrast.BackColor = Color.Red;
  891. btnAutoBC.BackColor = Color.Red;
  892. st_flag = 5;
  893. Thread.Sleep(1000);
  894. Thread thread = new Thread(AutoFunction);
  895. thread.Start();
  896. }
  897. private void btnAutoBCCancle_Click(object sender, EventArgs e)
  898. {
  899. iSEM.SetAutoVideoOff();
  900. btnAutoBCCancle.BackColor = Color.Red;
  901. st_flag = 6;
  902. Thread.Sleep(1000);
  903. Thread thread = new Thread(AutoFunction);
  904. thread.Start();
  905. }
  906. #endregion
  907. #region 自动消像散
  908. private void btnAutoStig_Click(object sender, EventArgs e)
  909. {
  910. //抓图1
  911. iSEM.GrabImage(path + "\\test1.tif", 0, 0, 1024, 768, 0);
  912. if (File.Exists(path + "\\test1.tif"))
  913. {
  914. FileStream fileStream = new FileStream(path + "\\test1.tif", FileMode.Open, FileAccess.Read);
  915. pictureBox1.Image = Image.FromStream(fileStream);
  916. fileStream.Close();
  917. fileStream.Dispose();
  918. }
  919. Thread.Sleep(1000);
  920. iSEM.CmdAutoStig();
  921. btnAutoStig.BackColor = Color.Red;
  922. st_flag = 7;
  923. Thread.Sleep(1000);
  924. Thread thread = new Thread(AutoFunction);
  925. thread.Start();
  926. }
  927. #endregion
  928. #region FIB缩放Get
  929. private void btnFIBMagGet_Click(object sender, EventArgs e)
  930. {
  931. float ret = iSEM.GetFIBMagnification();
  932. if (float.IsNaN(ret))
  933. {
  934. txtFIBMag.Text = "NaN";
  935. txtFIBMag.Enabled = false;
  936. btnFIBMagSet.Enabled = false;
  937. }
  938. else
  939. {
  940. txtFIBMag.Text = ret.ToString();
  941. btnFIBMagSet.Enabled = true;
  942. }
  943. }
  944. #endregion
  945. #region FIB缩放Set
  946. private void btnFIBMagSet_Click(object sender, EventArgs e)
  947. {
  948. float set = 0;
  949. if (float.TryParse(txtFIBMag.Text, out set))
  950. {
  951. iSEM.SetFIBMagnification(set);
  952. }
  953. }
  954. #endregion
  955. #region FIB焦距Get
  956. private void btnFIBWDGet_Click(object sender, EventArgs e)
  957. {
  958. float ret = iSEM.GetFIBObjectivePotential();
  959. if (float.IsNaN(ret))
  960. {
  961. txtFIBWD.Text = "NaN";
  962. txtFIBWD.Enabled = false;
  963. btnFIBWDSet.Enabled = false;
  964. }
  965. else
  966. {
  967. txtFIBWD.Text = ret.ToString();
  968. btnFIBWDSet.Enabled = true;
  969. }
  970. }
  971. #endregion
  972. #region FIB焦距Set
  973. private void btnFIBWDSet_Click(object sender, EventArgs e)
  974. {
  975. float set = 0;
  976. if (float.TryParse(txtFIBWD.Text, out set))
  977. {
  978. iSEM.SetFIBObjectivePotential(set);
  979. }
  980. }
  981. #endregion
  982. #region FIB电子束移动
  983. private void btnFIBBeamShiftXGet_Click(object sender, EventArgs e)
  984. {
  985. float ret = iSEM.GetFIBBeamShiftX();
  986. if (float.IsNaN(ret))
  987. {
  988. txtFIBBeamShiftX.Text = "NaN";
  989. txtFIBBeamShiftX.Enabled = false;
  990. btnFIBBeamShiftXSet.Enabled = false;
  991. }
  992. else
  993. {
  994. txtFIBBeamShiftX.Text = ret.ToString();
  995. btnFIBBeamShiftXSet.Enabled = true;
  996. }
  997. }
  998. private void btnFIBBeamShiftXSet_Click(object sender, EventArgs e)
  999. {
  1000. float set = 0;
  1001. if (float.TryParse(txtFIBBeamShiftX.Text, out set))
  1002. {
  1003. iSEM.SetFIBBeamShiftX(set);
  1004. }
  1005. }
  1006. private void btnFIBBeamShiftYGet_Click(object sender, EventArgs e)
  1007. {
  1008. float ret = iSEM.GetFIBBeamShiftY();
  1009. if (float.IsNaN(ret))
  1010. {
  1011. txtFIBBeamShiftY.Text = "NaN";
  1012. txtFIBBeamShiftY.Enabled = false;
  1013. btnFIBBeamShiftYSet.Enabled = false;
  1014. }
  1015. else
  1016. {
  1017. txtFIBBeamShiftY.Text = ret.ToString();
  1018. btnFIBBeamShiftYSet.Enabled = true;
  1019. }
  1020. }
  1021. private void btnFIBBeamShiftYSet_Click(object sender, EventArgs e)
  1022. {
  1023. float set = 0;
  1024. if (float.TryParse(txtFIBBeamShiftY.Text, out set))
  1025. {
  1026. iSEM.SetFIBBeamShiftY(set);
  1027. }
  1028. }
  1029. #endregion
  1030. #region 执行宏文件
  1031. private void btnMCF_Click(object sender, EventArgs e)
  1032. {
  1033. OpenFileDialog sfd = new OpenFileDialog();
  1034. sfd.Title = "选择宏文件:";
  1035. sfd.InitialDirectory = @"C:\ProgramData\Carl Zeiss\SmartSEM\User\Default";
  1036. sfd.Filter = "MLF文件|*.MLF";
  1037. if (sfd.ShowDialog() == DialogResult.OK)
  1038. {
  1039. //string fn = Path.GetFileNameWithoutExtension(sfd.FileName).ToUpper();
  1040. iSEM.CMDMCFFilename(sfd.FileName);
  1041. }
  1042. }
  1043. #endregion
  1044. #region FIB消像散
  1045. private void btnFIBAstigmatismXGet_Click(object sender, EventArgs e)
  1046. {
  1047. float ret = iSEM.GetFIBAstigmatismX();
  1048. if (float.IsNaN(ret))
  1049. {
  1050. txtFIBAstigmatismX.Text = "NaN";
  1051. txtFIBAstigmatismX.Enabled = false;
  1052. btnFIBAstigmatismXSet.Enabled = false;
  1053. }
  1054. else
  1055. {
  1056. txtFIBAstigmatismX.Text = ret.ToString();
  1057. btnFIBAstigmatismXSet.Enabled = true;
  1058. }
  1059. }
  1060. private void btnFIBAstigmatismXSet_Click(object sender, EventArgs e)
  1061. {
  1062. float set = 0;
  1063. if (float.TryParse(txtFIBAstigmatismX.Text, out set))
  1064. {
  1065. iSEM.SetFIBAstigmatismX(set);
  1066. }
  1067. }
  1068. private void btnFIBAstigmatismYGet_Click(object sender, EventArgs e)
  1069. {
  1070. float ret = iSEM.GetFIBAstigmatismY();
  1071. if (float.IsNaN(ret))
  1072. {
  1073. txtFIBAstigmatismY.Text = "NaN";
  1074. txtFIBAstigmatismY.Enabled = false;
  1075. btnFIBAstigmatismYSet.Enabled = false;
  1076. }
  1077. else
  1078. {
  1079. txtFIBAstigmatismY.Text = ret.ToString();
  1080. btnFIBAstigmatismYSet.Enabled = true;
  1081. }
  1082. }
  1083. private void btnFIBAstigmatismYSet_Click(object sender, EventArgs e)
  1084. {
  1085. float set = 0;
  1086. if (float.TryParse(txtFIBAstigmatismY.Text, out set))
  1087. {
  1088. iSEM.SetFIBAstigmatismY(set);
  1089. }
  1090. }
  1091. #endregion
  1092. #region 移动样品台XY
  1093. private void btnMoveXY_Click(object sender, EventArgs e)
  1094. {
  1095. float setx = 0;
  1096. float sety = 0;
  1097. if (!float.TryParse(txtStageX.Text, out setx))
  1098. {
  1099. return;
  1100. }
  1101. if(!float.TryParse(txtStageY.Text,out sety))
  1102. {
  1103. return;
  1104. }
  1105. btnMoveXY.BackColor = Color.Red;
  1106. iSEM.MoveStageXY(setx, sety);
  1107. Thread.Sleep(500);
  1108. Thread th = new Thread(MoveStagexy);
  1109. th.Start();
  1110. }
  1111. private void MoveStagexy()
  1112. {
  1113. float ret = 111;
  1114. while(true)
  1115. {
  1116. ret = iSEM.GetStageIs();
  1117. if(ret==0)
  1118. {
  1119. btnMoveXY.BackColor = Color.Lime;
  1120. break;
  1121. }
  1122. }
  1123. }
  1124. #endregion
  1125. #region 获取分辨率
  1126. private void btnImageStoreGet_Click(object sender, EventArgs e)
  1127. {
  1128. int[] ret = iSEM.GetImageStore();
  1129. lblImageStore.Text = ret[0].ToString() + "*" + ret[1].ToString();
  1130. }
  1131. #endregion
  1132. #region 设置分辨率
  1133. private void btnImageStoreSet_Click(object sender, EventArgs e)
  1134. {
  1135. if (cmbImageStore.SelectedIndex > -1 && cmbImageStore.SelectedIndex < 12)
  1136. {
  1137. iSEM.SetImageStore(cmbImageStore.SelectedIndex);
  1138. }
  1139. }
  1140. #endregion
  1141. #region 样品台急停
  1142. private void btnAbort_Click(object sender, EventArgs e)
  1143. {
  1144. iSEM.CmdStageAbort();
  1145. }
  1146. #endregion
  1147. private void btnLive_Click(object sender, EventArgs e)
  1148. {
  1149. iSEM.ImageLive();
  1150. }
  1151. private void btnFrozen_Click(object sender, EventArgs e)
  1152. {
  1153. iSEM.ImageFrozen();
  1154. }
  1155. private void btnExeEly_Click(object sender, EventArgs e)
  1156. {
  1157. OpenFileDialog sfd = new OpenFileDialog();
  1158. sfd.Title = "选择ELY文件:";
  1159. //sfd.InitialDirectory = @"C:\ProgramData\Carl Zeiss\SmartSEM\User\Default";
  1160. sfd.Filter = "ELY文件|*.ELY";
  1161. if (sfd.ShowDialog() == DialogResult.OK)
  1162. {
  1163. iSEM.CmdFIBLoadELY(sfd.FileName);
  1164. }
  1165. }
  1166. private void btnExeEly2_Click(object sender, EventArgs e)
  1167. {
  1168. iSEM.CmdFIBEXPOSUREELY();
  1169. }
  1170. private void btnFIBStatus_Click(object sender, EventArgs e)
  1171. {
  1172. btnFIBStatus.Text = iSEM.GetFIBMode().ToString();
  1173. }
  1174. private void btnPost1_Click(object sender, EventArgs e)
  1175. {
  1176. double degree = 0;
  1177. int direction = 0;
  1178. int state = 0;
  1179. wr.Img_OffsetAngle_Direction("D:/aaaa.jpg",1,"LG", out degree, out direction, out state);
  1180. lbldegree1.Text = degree.ToString("0.0");
  1181. lbldirection1.Text = direction.ToString();
  1182. lblstate1.Text = state.ToString();
  1183. }
  1184. private void btnPost2_Click(object sender, EventArgs e)
  1185. {
  1186. double offsetx = 0;
  1187. double offsety = 0;
  1188. int state = 0;
  1189. wr.Img_Cut_Position("D:/aaaa.jpg", out offsetx, out offsety, out state);
  1190. lbllocationx.Text = offsetx.ToString("0.0");
  1191. lbllocationy.Text = offsety.ToString("0.0");
  1192. lblstate2.Text = state.ToString();
  1193. }
  1194. private void btnPost3_Click(object sender, EventArgs e)
  1195. {
  1196. int state = 0;
  1197. wr.Img_Cut_Success("D:/aaaa.jpg", "D:/bbbb.jpg", out state);
  1198. lblstate3.Text = state.ToString();
  1199. }
  1200. private void btnPost4_Click(object sender, EventArgs e)
  1201. {
  1202. double offsetx = 0;
  1203. double offsety = 0;
  1204. int state = 0;
  1205. wr.Img_Trapezoid_Top_Center_Position("D:/aaaa.jpg", out offsetx, out offsety, out state);
  1206. lbltopcx.Text = offsetx.ToString("0.0");
  1207. lbltopcy.Text = offsety.ToString("0.0");
  1208. lblstate4.Text = state.ToString();
  1209. }
  1210. private void btnPost5_Click(object sender, EventArgs e)
  1211. {
  1212. List<string> filenames = new List<string>();
  1213. filenames.Add("1111111");
  1214. filenames.Add("2222222");
  1215. filenames.Add("3333333");
  1216. lblfocuspath.Text = wr.Img_Auto_Focus(filenames);
  1217. }
  1218. private void btnPost6_Click(object sender, EventArgs e)
  1219. {
  1220. List<string> filenames = new List<string>();
  1221. filenames.Add("1111111");
  1222. filenames.Add("2222222");
  1223. filenames.Add("3333333");
  1224. lblstigpath.Text = wr.Img_Auto_Focus(filenames);
  1225. }
  1226. private void btnPost7_Click(object sender, EventArgs e)
  1227. {
  1228. double offsetx = 0;
  1229. double offsety = 0;
  1230. double degree = 0;
  1231. int direction = 0;
  1232. int state = 0;
  1233. wr.Img_Center_Position_OffsetAngle_Direction("D:/aaaa.jpg", out offsetx, out offsety, out degree, out direction, out state);
  1234. lblcenterx.Text = offsetx.ToString("0.0");
  1235. lblcentery.Text = offsety.ToString("0.0");
  1236. lbldegree2.Text = degree.ToString();
  1237. lbldirection2.Text = direction.ToString();
  1238. lblstate5.Text = state.ToString();
  1239. }
  1240. private void btnPost8_Click(object sender, EventArgs e)
  1241. {
  1242. int state = 0;
  1243. wr.Img_Measure_Size("D:/aaaa.jpg", "1000", "0.005", out state);
  1244. lblstate6.Text = state.ToString();
  1245. }
  1246. private void btnScanRotationSetLock_Click(object sender, EventArgs e)
  1247. {
  1248. iSEM.SetScanRotationOff();
  1249. }
  1250. private void button1_Click_1(object sender, EventArgs e)
  1251. {
  1252. iSEM.SetTiltAngleOff();
  1253. }
  1254. private void btnTiltAngleSetOn_Click(object sender, EventArgs e)
  1255. {
  1256. iSEM.SetTiltAngleOn();
  1257. }
  1258. private void btnScanRotationSetOn_Click(object sender, EventArgs e)
  1259. {
  1260. iSEM.SetScanRotationOn();
  1261. }
  1262. private void btnExeEly3_Click(object sender, EventArgs e)
  1263. {
  1264. iSEM.CmdFIBSTARTELY();
  1265. }
  1266. private void btnCreateConfig_Click(object sender, EventArgs e)
  1267. {
  1268. ConfigFile cfm = new ConfigFile();
  1269. cfm.Is_Photograph = chkWIsP.Checked;
  1270. cfm.PT_Depostion = chkWPT.Checked;
  1271. cfm.PT_ELYFile = txtWPTF.Text;
  1272. cfm.FIB_ELYFile = txtWFIBF.Text;
  1273. cfm.Stretch_Magnification = Convert.ToDouble(cbbWLZ.Text);
  1274. cfm.Location_Magnification = Convert.ToDouble(cbbWQGF.Text);
  1275. cfm.Location_Voltage = Convert.ToDouble(cbbWQGD.Text);
  1276. cfm.Photograph_Magnification = Convert.ToDouble(cbbWPZF.Text);
  1277. cfm.Photograph_Voltage = Convert.ToDouble(cbbWPZD.Text);
  1278. if(cbbWXZ.SelectedIndex==0)
  1279. {
  1280. cfm.Correction_Angle = 36.0;
  1281. }
  1282. else
  1283. {
  1284. cfm.Correction_Angle = 54.0;
  1285. }
  1286. cfm.Sample_Type = cbbWYP.Text;
  1287. cfm.Firm = cbbWCS.Text;
  1288. cfm.Save(@"E:\test.cfg");
  1289. }
  1290. private void btnReadConfig_Click(object sender, EventArgs e)
  1291. {
  1292. ConfigFile cfm = new ConfigFile();
  1293. cfm.Read(@"E:\test.cfg");
  1294. chkRIsP.Checked = cfm.Is_Photograph;
  1295. chkRPT.Checked = cfm.PT_Depostion;
  1296. txtRPTF.Text = cfm.PT_ELYFile;
  1297. txtRFIBF.Text = cfm.FIB_ELYFile;
  1298. txtRLZ.Text = cfm.Stretch_Magnification.ToString();
  1299. txtRQGF.Text = cfm.Location_Magnification.ToString();
  1300. txtRQGD.Text = cfm.Location_Voltage.ToString();
  1301. txtRPZF.Text = cfm.Photograph_Magnification.ToString();
  1302. txtRPZD.Text = cfm.Photograph_Voltage.ToString();
  1303. txtRXZ.Text = cfm.Correction_Angle.ToString();
  1304. txtRYP.Text = cfm.Sample_Type;
  1305. txtRCS.Text = cfm.Firm;
  1306. }
  1307. private void FormUnitControl_Load(object sender, EventArgs e)
  1308. {
  1309. String sample_Type = ConfigurationManager.AppSettings["Sample_Type"];
  1310. String firm = ConfigurationManager.AppSettings["Firm"];
  1311. String[] sT = sample_Type.Split(',');
  1312. for(int i=0;i<sT.Length;i++)
  1313. {
  1314. cbbWYP.Items.Add(sT[i]);
  1315. }
  1316. cbbWYP.SelectedIndex = 0;
  1317. String[] firms = firm.Split(',');
  1318. for (int i = 0; i < firms.Length; i++)
  1319. {
  1320. cbbWCS.Items.Add(firms[i]);
  1321. }
  1322. cbbWCS.SelectedIndex = 0;
  1323. cbbWXZ.SelectedIndex = 0;
  1324. }
  1325. }
  1326. }