FormUnitControl.cs 44 KB

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