OTSIncAMeasureAppForm.cs 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Drawing;
  4. using System.Windows.Forms;
  5. using OTS.WinFormsUI.Docking;
  6. using System.Runtime.InteropServices;
  7. using System.Collections;
  8. using CefSharp;
  9. using OTSDataType;
  10. using OTSModelSharp;
  11. using OTSModelSharp.ResourceManage;
  12. using static OTSDataType.otsdataconst;
  13. using System.Diagnostics;
  14. using OTSModelSharp.ServiceInterface;
  15. namespace OTSMeasureApp
  16. {
  17. public enum MessageState
  18. {
  19. StartMeasure = 0, //开始测量
  20. ShotBSEPicture = 1, //拍摄样品孔图片
  21. MeasureBSEPicture = 2 //拍摄测量区域图片
  22. };
  23. enum ShapeType
  24. {
  25. CIRCUL = 0, //圆形
  26. RECTANGLE = 1 //矩形
  27. };
  28. enum MessageBoxRev
  29. {
  30. DIALOG_YES = 0,
  31. DIALOG_NO = 1,
  32. DIALOG_CANCEL = 2
  33. }
  34. public partial class OTSIncAMeasureAppForm : Form
  35. {
  36. public static string m_SamplespaceWindowName = "样品台";
  37. public static string m_MeasureStauWindowName = "测量状态";
  38. public static string m_MeasureRetWindowName = "测量结果";
  39. public static string m_NoWindowName = "未知工作窗口";
  40. //国际化
  41. OTSSysMgrTools.Language lan;
  42. Hashtable table;
  43. public OTSRibbonFun m_RibbonFun = null;
  44. //判断信息来源 拍摄样品孔图片 或是 测量开始
  45. public MessageState m_MessageStates = (int)MessageState.StartMeasure;
  46. // 初始化日志类
  47. NLog.Logger log ;
  48. // Control m_ControlWindow = null;
  49. public OTSMeasureResultWindow m_MeasureRetWindow = null;
  50. public OTSMeasureStatusWindow m_MessureStatuWindow = null;
  51. public OTSSamplespaceWindow m_SamplepaceWindow = null;
  52. public OTSMeasureOutputNlog m_OTSMeasureOutputNlog = null;
  53. public COTSMeasureParam m_ProjParam = null;
  54. public COTSMsrPrjResultData m_ProjData;
  55. public OTSSolutionWindow m_SolutionWindows = null;
  56. public OTSPropertyWindow m_SPropertyWindows = null;
  57. //测量线程对象
  58. public CMeasureThreadWrapper m_MsrThreadWrapper = null;
  59. // 测量线程当前状态 True: 正在测量; False: 测量结束
  60. public bool MeasureThreadRunFlag { get => m_MsrThreadWrapper.BGWorkThreadIsRunning(); }
  61. public OTSIncAMeasureAppForm()
  62. {
  63. InitializeComponent();
  64. //国际化
  65. lan = new OTSSysMgrTools.Language(this);
  66. table = lan.GetNameTable(this.Name);
  67. m_SamplespaceWindowName = table["m_samplespacewindowname"].ToString();
  68. m_MeasureStauWindowName = table["m_measurestauwindowname"].ToString();
  69. m_MeasureRetWindowName = table["m_measureretwindowname"].ToString();
  70. m_NoWindowName = table["m_nowindowname"].ToString();
  71. m_OTSMeasureOutputNlog = new OTSMeasureOutputNlog();
  72. m_OTSMeasureOutputNlog.Show();
  73. //初始化日志文件名称
  74. // 初始化Docpanle
  75. m_SolutionWindows = new OTSSolutionWindow(this);
  76. m_SPropertyWindows = new OTSPropertyWindow(this);
  77. m_MeasureRetWindow = new OTSMeasureResultWindow(this);
  78. m_MeasureRetWindow.Text = m_MeasureRetWindowName;
  79. m_MessureStatuWindow = new OTSMeasureStatusWindow(this);
  80. m_MessureStatuWindow.Text = m_MeasureStauWindowName;
  81. m_SamplepaceWindow = new OTSSamplespaceWindow(this);
  82. m_SamplepaceWindow.Text = m_SamplespaceWindowName;
  83. //和DataMgr进行数据交互类
  84. m_ProjParam = new COTSMeasureParam(this);
  85. m_ProjData = m_ProjParam.m_ResultData;
  86. //初始化Ribbon类,操作Ribbon按钮的可用或者不可用
  87. m_RibbonFun = new OTSRibbonFun(this);
  88. //初始化测量线程
  89. m_MsrThreadWrapper = new CMeasureThreadWrapper(this);//must be the last sentence of this procedure.
  90. }
  91. private void OTSIncAMeasureAppForm_Load(object sender, EventArgs e)
  92. {
  93. try
  94. {
  95. ArrangWorkspaceWindow();
  96. log = NLog.LogManager.GetCurrentClassLogger();
  97. if (m_ProjParam.LoadParamFile() && m_ProjParam.LoadStageParamFile())
  98. {
  99. if (m_ProjParam.InitResultData())
  100. {
  101. m_RibbonFun.SetAllRibbonButnStatus(true);
  102. m_SamplepaceWindow.InitStageDisplay(m_ProjData.GetStage(),m_ProjData.GetSEMStageData());
  103. //添加启动系统界面显示
  104. if (m_ProjParam.m_DefaultParam.m_nPackId.ToString() == "IncA")
  105. {
  106. this.Text += " -- Inclusion Analysis System";
  107. }
  108. else if (m_ProjParam.m_DefaultParam.m_nPackId.ToString() == "CleanlinessA")
  109. {
  110. this.Text += " -- Cleanliness Analysis System";
  111. }
  112. }
  113. else
  114. {
  115. log.Error("(OTSIncAMeasureAppForm.OTSIncAMeasureAppForm_Load) this.CheckMeasureSysFileExist() = false");
  116. }
  117. }
  118. else
  119. {
  120. log.Error("(OTSIncAMeasureAppForm.OTSIncAMeasureAppForm_Load) (m_DataMgrFun.CheckParamFile() && m_DataMgrFun.CheckStageFile()) = false");
  121. }
  122. }
  123. catch (Exception ex)
  124. {
  125. log.Error("(OTSIncAMeasureAppForm.OTSIncAMeasureAppForm_Load) OTSIncAMeasureAppForm_Load:" + ex.ToString());
  126. }
  127. }
  128. public void ArrangWorkspaceWindow()
  129. {
  130. //Show 样品台窗口
  131. m_SamplepaceWindow.Show(dockPanel);
  132. //Show 测量状态窗口
  133. m_MessureStatuWindow.Show(dockPanel);
  134. //Show 测量结果窗口
  135. m_MeasureRetWindow.Show(dockPanel);
  136. m_SolutionWindows.Show(dockPanel, DockState.DockLeft);
  137. //Show 测量过程中Log显示窗口
  138. m_OTSMeasureOutputNlog.Show(dockPanel, DockState.DockRight);
  139. dockPanel.DockRightPortion = 365;
  140. m_SPropertyWindows.Show(dockPanel);
  141. m_SamplepaceWindow.Activate();
  142. }
  143. private void rbReport_Click(object sender, EventArgs e)
  144. {
  145. //打开报告之前先关闭电镜连接
  146. var sem = NSOTSController.COTSControlFunExport.GetControllerInstance();
  147. sem.DisconnectSem();
  148. //测量结果文件路径列表
  149. List<string> mrFilePathList = new List<string>();
  150. //获取测量结果文件路径列表
  151. bool result = m_ProjParam.GetCompletedMeasureFileName(ref mrFilePathList);
  152. if (result)
  153. {
  154. for (int i = 0; i < mrFilePathList.Count; i++)
  155. {
  156. mrFilePathList[i] = mrFilePathList[i].Replace(" ", "^");
  157. }
  158. //转换为数组
  159. string[] resultFilePath = mrFilePathList.ToArray();
  160. System.Diagnostics.ProcessStartInfo process = new System.Diagnostics.ProcessStartInfo();
  161. process.FileName = "OTSIncAReportApp.exe";//打开app的路径
  162. string FilePath = string.Join(" ", resultFilePath);
  163. process.Arguments = FilePath;//多个参数用空格隔开
  164. process.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
  165. System.Diagnostics.Process.Start(process);
  166. }
  167. }
  168. // sNewWorkSampleName: 新工作样品名
  169. public void Rev_SoluWindowReqSwitchWSample_Event(string sNewWorkSampleName)
  170. {
  171. if (!m_ProjParam.SetWorkSample(sNewWorkSampleName))
  172. {
  173. m_SolutionWindows.Rev_MeasureApp_SwitchSample_Event(m_ProjParam.GetWorkSampleName());
  174. return;
  175. }
  176. //获取新的样品名称
  177. string sNewName = m_ProjParam.GetWorkSampleName();
  178. if ("" == sNewName)
  179. {
  180. m_SolutionWindows.Rev_MeasureApp_SwitchSample_Event(sNewWorkSampleName);
  181. return;
  182. }
  183. //获取新工作样品属性值
  184. OTSSamplePropertyInfo SMInfo = new OTSSamplePropertyInfo();
  185. if (!m_ProjParam.GetWorkSamplePerameter(m_ProjParam.GetWorkSample(), ref SMInfo))
  186. {
  187. m_SolutionWindows.Rev_MeasureApp_SwitchSample_Event(sNewWorkSampleName);
  188. return;
  189. }
  190. //设置获取帧图状态
  191. m_MessageStates = (int)MessageState.StartMeasure;
  192. m_SPropertyWindows.DisplaySampleMeasureInfo(SMInfo);
  193. //发送新的样品名给Treeview
  194. m_SolutionWindows.Rev_MeasureApp_SwitchSample_Event(sNewName);
  195. //发送想你的样品名给Sample
  196. m_SamplepaceWindow.Rev_MeasureApp_SwitchWorkSample_Event(sNewName);
  197. //根据节点设置样品台窗口中所选择的样品名称
  198. OTSSamplespaceWindow.m_SampleSelectName = sNewName;
  199. }
  200. //OTSSolutionWindow 给 MeasureApp 发送样品checkbox发生变化事件
  201. //string sSampleName : 样品名; bool bCheckBoxStatu: 样品名对应的CheckBox发生变化的值(选中/不选中)
  202. public void Rev_SoluWindowReqCheckBosStatuChange_Event(string sSampleName, bool bCheckBoxStatu)
  203. {
  204. string sWSampleName = m_ProjParam.GetWorkSampleName();
  205. if ("" == sWSampleName)
  206. {
  207. //不修改Tteeview 的工作样品属性值
  208. m_SolutionWindows.Rev_MeasureApp_CheckboxStatuChange_Event(sSampleName, !bCheckBoxStatu);
  209. return;
  210. }
  211. //Treeview更改的工作样品数的CHECKBOX 状态
  212. if (!m_ProjParam.SetSampleParamVal(OTS_SAMPLE_PROP_GRID_ITEMS.SWITCH, OTS_ITEM_TYPES.BOOL, bCheckBoxStatu))
  213. {
  214. //不修改Tteeview 的工作样品属性值
  215. m_SolutionWindows.Rev_MeasureApp_CheckboxStatuChange_Event(sSampleName, !bCheckBoxStatu);
  216. return;
  217. }
  218. // 设置 开始 ,停止 和检查参数 按钮状态
  219. m_RibbonFun.SetMeasureRibbonButnStatu();
  220. //修改Grid工作样品的SWITCH值
  221. OTSSamplePropertyInfo SMeasurenfo = new OTSSamplePropertyInfo();
  222. if (!m_ProjParam.GetWorkSamplePerameter(m_ProjParam.GetWorkSample(), ref SMeasurenfo))
  223. {
  224. return;
  225. }
  226. m_SPropertyWindows.DisplaySampleMeasureInfo(SMeasurenfo);
  227. }
  228. // string sSampleOldName : 样品名原名
  229. //string sSampleNewName : 样品名新名
  230. public bool EditWorkSampleName(string sSampleOldName, string sSampleNewName)
  231. {
  232. if (!m_ProjParam.ChangeWorkSampleName(sSampleNewName))
  233. {
  234. return false;
  235. }
  236. // 获取修改名称后的工作样品属性值
  237. OTSSamplePropertyInfo SMInfo = new OTSSamplePropertyInfo();
  238. if (!m_ProjParam.GetWorkSamplePerameter(m_ProjParam.GetWorkSample(), ref SMInfo))
  239. {
  240. return false;
  241. }
  242. //获取修改名称后的工作样品属性值发送给Grid显示
  243. m_SPropertyWindows.DisplaySampleMeasureInfo(SMInfo);
  244. //给样品台发送新的工作样品名称
  245. m_SamplepaceWindow.Rev_MeasureApp_ChangeWorkSampleName_Event(sSampleNewName);
  246. return true;
  247. }
  248. //OTSSolutionWindow窗口给MeasureApp窗口添加样品请求
  249. public void Rev_SoluwindowReqAddSample_Event()
  250. {
  251. //Treeview右键点击添加新样品
  252. this.AddNewSampleMeasure();
  253. }
  254. //移动工作样品到其他样品孔,样品孔名称和测量区域都要改变,重新设置工作样品参数
  255. //SampleMeasurePara SMeasurePara:
  256. public SampleMeasurePara SetWorkSamplHoleAndMeasureArea(SampleMeasurePara SMeasurePara)
  257. {
  258. return m_ProjParam.SetWorkSampleHoleNameAndMeasureArea(SMeasurePara);
  259. }
  260. //当 SampleMeasurePara SetWorkSamplHoleAndMeasureArea(SampleMeasurePara SMeasurePara) 移动成功之后,需要调用此函数更新Grid的显示
  261. public void UpdateTreeSampleAndGridSampleVal()
  262. {
  263. OTSSamplePropertyInfo SMInfo = new OTSSamplePropertyInfo();
  264. if (!m_ProjParam.GetWorkSamplePerameter(m_ProjParam.GetWorkSample(), ref SMInfo))
  265. {
  266. return;
  267. }
  268. //更新Grid的工作样品属性值
  269. m_SPropertyWindows.DisplaySampleMeasureInfo(SMInfo);
  270. }
  271. // 更新样品属性值
  272. public void UpDataSamplePropVal()
  273. {
  274. OTSSamplePropertyInfo SMInfo = new OTSSamplePropertyInfo();
  275. if (!m_ProjParam.GetWorkSamplePerameter(m_ProjParam.GetWorkSample(), ref SMInfo))
  276. {
  277. log.Error("(OTSIncAMeasureAppForm.UpDataSamplePropVal) m_DataMgrFun.GetWorkSamplePropertyVal(m_DataMgrFun.GetWorkSample(), ref SMInfo) = false Failed !");
  278. return;
  279. }
  280. //更新Grid的工作样品属性值
  281. m_SPropertyWindows.DisplaySampleMeasureInfo(SMInfo);
  282. }
  283. private void OTSIncAMeasureAppForm_FormClosing(object sender, FormClosingEventArgs e)
  284. {
  285. try
  286. {
  287. if (m_MsrThreadWrapper.BGWorkThreadIsRunning ()) //当前正在测量
  288. {
  289. e.Cancel = true;
  290. return;
  291. }
  292. //判断测量结果文件修改后是否保存
  293. if (m_ProjData.IsModified())
  294. {
  295. string message = table["message2"].ToString();
  296. DialogResult lsdr = MessageBox.Show(message, "Tip", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information);
  297. if (lsdr == DialogResult.Yes)
  298. {
  299. //保存,退出
  300. m_ProjData.Save();
  301. //保存,直接退出
  302. Application.ExitThread();
  303. }
  304. else if (lsdr == DialogResult.No)
  305. {
  306. //不保存,直接退出
  307. Application.ExitThread();
  308. }
  309. else if (lsdr == DialogResult.Cancel)
  310. {
  311. //取消
  312. e.Cancel = true;
  313. return;
  314. }
  315. }
  316. log.Info("Disconnect SEM!");
  317. m_MsrThreadWrapper.DisconnectSEM();
  318. m_MsrThreadWrapper.SetWorkThreadPending();
  319. }
  320. catch (Exception ex)
  321. {
  322. string message = table["message3"].ToString();
  323. log.Error("OTSIncAMeasureAppForm_FormClosing-"+ message + ":" + ex.ToString());
  324. }
  325. //CloseAllContents();
  326. //m_MsrThreadWrapper.freeHw();
  327. Process.GetCurrentProcess().Kill();
  328. //Application.ExitThread();
  329. //Application.Exit();
  330. }
  331. //打开指定路径的文件
  332. private void ribbonOrbMenuItem1_OpenWorkspace_Click(object sender, EventArgs e)
  333. {
  334. OpenMeasureProjectFile();
  335. }
  336. //新建样品工作文件
  337. private void ribbonOrbMenuItem3_CreateWorkspace_Click(object sender, EventArgs e)
  338. {
  339. int iCreateNewFileResult = m_ProjParam.CreateNewFile();
  340. if (iCreateNewFileResult == 0)
  341. {
  342. log.Error("(OTSIncAMeasureAppForm.rbNew_CreateWorkspace_Click) m_DataMgrFun.CreateNewFile() Failed !");
  343. return;
  344. }
  345. else if(iCreateNewFileResult == 2)
  346. {
  347. log.Info("(OTSIncAMeasureAppForm.rbNew_CreateWorkspace_Click) m_DataMgrFun.CreateNewFile() Cancel !");
  348. return;
  349. }
  350. m_RibbonFun.SetAllRibbonButnStatus(true);
  351. //清除TREEVIEW和GRID上的显示的已经保存的样品信息
  352. m_SolutionWindows.m_TreeViewBase.DeleteAllTreeNode();
  353. m_SPropertyWindows.m_SampleGrid.HideGrid();
  354. //设置报告按钮
  355. rbPReport.Enabled = false;
  356. rbReport.Enabled = false;
  357. rbReClassify.Enabled = false;
  358. //新建项目时,设置属性窗体中的两个按钮也为不可用状态
  359. m_SPropertyWindows.TSLoad.Enabled = false;
  360. m_SPropertyWindows.TSSaveAs.Enabled = false;
  361. //绘制样品台
  362. m_SamplepaceWindow.InitStageDisplay(m_ProjData.GetStage(), m_ProjData.GetSEMStageData());
  363. //隐藏XrayTable控件
  364. m_MessureStatuWindow.HideXRayTable();
  365. //新建时重新初始化结果窗体结果
  366. m_MeasureRetWindow.SetInit();
  367. }
  368. // 新建样品时提示保存样品信息Messagebox
  369. public int ShowSaveInfoMsgBox()
  370. {
  371. string message = table["message4"].ToString();
  372. // DialogResult.OK
  373. DialogResult dResult = MessageBox.Show(message, "Tip", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);
  374. if (dResult == DialogResult.Yes)
  375. {
  376. return (int)MessageBoxRev.DIALOG_YES;
  377. }
  378. else if (dResult == DialogResult.No)
  379. {
  380. return (int)MessageBoxRev.DIALOG_NO;
  381. }
  382. else
  383. {
  384. return (int)MessageBoxRev.DIALOG_CANCEL;
  385. }
  386. }
  387. //打开已经保存的工作文件
  388. private bool DisplayExistSampleFile()
  389. {
  390. List<CTreeSampleParam> TSampleParamList = new List<CTreeSampleParam>();
  391. List<SampleMeasurePara> SampleMeasureAreaList = new List<SampleMeasurePara>();
  392. int iSampleCount = m_ProjData.GetSampleList().Count;
  393. if (0 == iSampleCount)
  394. {
  395. return false;
  396. }
  397. for (int i = 0; i < iSampleCount; i++)
  398. {
  399. CTreeSampleParam CTSampleParam = new CTreeSampleParam();
  400. COTSSample SampleClr = (m_ProjData.GetSampleList())[i];
  401. CTSampleParam.sSampleTitleName = m_ProjData.GetFileName();
  402. CTSampleParam.sWorkSampleName = SampleClr.GetName();
  403. CTSampleParam.bSwitch = SampleClr.GetSwitch();
  404. CTSampleParam.bParamLock = SampleClr.GetParamLock();
  405. TSampleParamList.Add(CTSampleParam);
  406. }
  407. //获取工作样品
  408. OTSSamplePropertyInfo SMInfo = new OTSSamplePropertyInfo();
  409. if (!m_ProjParam.GetWorkSamplePerameter(m_ProjParam.m_ResultData.GetWorkingSample(), ref SMInfo))
  410. {
  411. log.Error("(OTSIncAMeasureAppForm.OpenExistSampleFile) m_DataMgrFun.GetSamplePropertyVal(m_DataMgrFun.GetWorkSample(), ref SMInfo) = false Failed !");
  412. return false;
  413. }
  414. // MeasureApp 窗口给 OTSPropertyWindow窗口 Grid显示的样品属性信息
  415. m_SPropertyWindows.DisplaySampleMeasureInfo(SMInfo);
  416. // MeasureApp 给 OTSSolutionWindow 发送打开已保存的工作样品文件
  417. m_SolutionWindows.Rev_MeasureApp_OpenExistSampleFile_Event(TSampleParamList, SMInfo.TSampleParam);
  418. //MeasureApp 给 OTSSamplespaceWindow 发送已保存的工作样品文件
  419. if (!OpenExistSampleMeasureArea(ref SampleMeasureAreaList))
  420. {
  421. log.Error("(OTSIncAMeasureAppForm.OpenExistSampleFile) m_DataMgrFun.OpenExistSampleMeasureArea(ref SampleMeasureAreaList) = false Failed !");
  422. return false;
  423. }
  424. //打开已保存的样品后,将所有样品发送给样品台
  425. string sWSampleName = m_ProjParam.GetWorkSampleName();
  426. if (SMInfo.sSampleSoluName != "")
  427. {
  428. string str = table[this.Name.ToLower()].ToString();
  429. this.Text = str + "-" + SMInfo.sSampleSoluName;
  430. }
  431. if ("" == sWSampleName)
  432. {
  433. log.Error("(OTSIncAMeasureAppForm.OpenExistSampleFile) m_DataMgrFun.GetWorkSampleName() = null Failed !");
  434. return false;
  435. }
  436. m_SamplepaceWindow.Rev_MeasureApp_OpenExistSampleFile_Event(m_ProjData.GetStage(), m_ProjData.GetSEMStageData(), SampleMeasureAreaList, sWSampleName);
  437. return true;
  438. }
  439. public bool OpenExistSampleMeasureArea(ref List<SampleMeasurePara> SampleMeasureAreaList)
  440. {
  441. int iSListCount = m_ProjData.GetSampleList().Count;
  442. if (0 == iSListCount)
  443. {
  444. return false;
  445. }
  446. for (int i = 0; i < iSListCount; i++)
  447. {
  448. SampleMeasurePara SampleMeasureArea = new SampleMeasurePara();
  449. //获取样品的测量区域信息
  450. //获取样品名称
  451. SampleMeasureArea.sSampleName = (m_ProjData.GetSampleList())[i].GetName();
  452. // 获取测量区域形状
  453. SampleMeasureArea.iShape = (int)(m_ProjData.GetSampleList())[i].GetMsrArea().GetShape();
  454. //获取样品孔名称
  455. SampleMeasureArea.sHoleName = (m_ProjData.GetSampleList())[i].GetSampleHoleName();
  456. //样品测量区域
  457. SampleMeasureArea.MeasureRect = (Rectangle)(m_ProjData.GetSampleList())[i].GetMsrArea().GetRectDomain();
  458. //多边形点集合
  459. SampleMeasureArea.PolygonPointRegion = (m_ProjData.GetSampleList())[i].GetMsrArea().GetPolygonPoint();
  460. List<PointF> PointRegionF = new List<PointF>();
  461. List<Point> PolygonPoint = m_ProjData.GetSampleList()[i].GetMsrArea().GetPolygonPoint();
  462. if (PolygonPoint != null)
  463. {
  464. foreach (var item in m_ProjData.GetSampleList()[i].GetMsrArea().GetPolygonPoint())
  465. {
  466. PointRegionF.Add(new PointF(item.X, item.Y));
  467. }
  468. }
  469. SampleMeasureArea.PolygonPointRegionF = PointRegionF;
  470. SampleMeasureArea.DrawPolygonPointRegionF = PointRegionF;
  471. SampleMeasureAreaList.Add(SampleMeasureArea);
  472. }
  473. return true;
  474. }
  475. //打开指定路径的文件
  476. private void rbOpen_Click(object sender, EventArgs e)
  477. {
  478. OpenMeasureProjectFile();
  479. }
  480. private void rbDeleteSample_Click(object sender, EventArgs e)
  481. {
  482. //删除样品(样品必须先选中)
  483. string sWSampleName = m_ProjParam.GetWorkSampleName();
  484. if ("" == sWSampleName)
  485. {
  486. log.Error("(OTSIncAMeasureAppForm.rbDeleteSample_Click) m_DataMgrFun.GetWorkSampleName() = null Failed");
  487. return;
  488. }
  489. string message = table["message5"].ToString();
  490. string message6 = table["message6"].ToString();
  491. string sDeleteSampleName = message;
  492. sDeleteSampleName += sWSampleName;
  493. sDeleteSampleName += message6;
  494. if (DialogResult.OK == MessageBox.Show(sDeleteSampleName, "Tip", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning))
  495. {
  496. //删除样品成功
  497. if (!this.DeleteSample(sWSampleName))
  498. {
  499. log.Error("(OTSIncAMeasureAppForm.rbDeleteSample_Click) DeleteSample(sWSampleName) = false Failed, sWSampleName = " + sWSampleName);
  500. return;
  501. }
  502. //m_MeasureRetWindow.SetInit();
  503. sWSampleName = m_ProjParam.GetWorkSampleName();
  504. if ("" == sWSampleName)
  505. {
  506. log.Error("(OTSIncAMeasureAppForm.rbDeleteSample_Click) m_DataMgrFun.GetWorkSampleName() = null Failed");
  507. return;
  508. }
  509. m_SolutionWindows.m_TreeViewBase.GetTreeWorkSampleNode(sWSampleName);
  510. m_SolutionWindows.treeView1.Focus();
  511. }
  512. }
  513. //返回删除的工作样品名
  514. public bool DeleteSample(string sDeleteWSampleName = "")
  515. {
  516. if (!m_ProjParam.DeleteWorkSample(sDeleteWSampleName))
  517. {
  518. log.Error("(OTSIncAMeasureAppForm.DeleteSample) m_DataMgrFun.DeleteWorkSample(sDeleteWSampleName) Failed, sDeleteWSampleName = " + sDeleteWSampleName);
  519. //return false;
  520. }
  521. // 设置 开始 ,停止 和检查参数 按钮状态
  522. m_RibbonFun.SetMeasureRibbonButnStatu();
  523. //设置 删除,复位,圆形,矩形 按钮状态
  524. m_RibbonFun.SetSampleRibbonButnStatus();
  525. // 更新报告ribbon按钮状态
  526. m_RibbonFun.SetAllRibbonButnStatus(true);
  527. int iSampleCount = m_ProjParam.GetSampleCount();
  528. if (0 == iSampleCount)
  529. {
  530. //给工作样品台发送删除样品和新的工作样品名称
  531. m_SamplepaceWindow.Rev_MeasureApp_DeleteWorkSample_Event(sDeleteWSampleName, "");
  532. //清空样品对象列表
  533. if (OTSSamplespaceWindow.m_SampleGDIObjects != null)
  534. {
  535. //清空样品台窗口中样品、测量区域、帧图、照片位置对象列表
  536. OTSSamplespaceWindow.m_SampleGDIObjects.Clear();
  537. OTSSamplespaceWindow.m_MeasureGDIObjects.Clear();
  538. OTSSamplespaceWindow.m_MeasurePathGDIObjects.Clear();
  539. m_SamplepaceWindow.ClearImageAndSingleGDIObjects();
  540. }
  541. //样品全部删除完,将Treeview 和Grid 显示内容清空
  542. m_SPropertyWindows.PropGrid.Hide();
  543. m_SolutionWindows.treeView1.Nodes.Clear();
  544. m_MessureStatuWindow.HideXRayTable();
  545. m_MeasureRetWindow.SetInit();
  546. return true;
  547. }
  548. //获取新工作样品名称
  549. string sNewWSName = m_ProjParam.GetWorkSampleName();
  550. if ("" == sNewWSName)
  551. {
  552. log.Error("(OTSIncAMeasureAppForm.DeleteSample) m_DataMgrFun.GetWorkSampleName() = null Failed");
  553. return true;
  554. }
  555. //获取新的工作样品属性值
  556. OTSSamplePropertyInfo SMInfo = new OTSSamplePropertyInfo();
  557. if (!m_ProjParam.GetWorkSamplePerameter(m_ProjParam.GetWorkSample(), ref SMInfo))
  558. {
  559. log.Error("(OTSIncAMeasureAppForm.DeleteSample) m_DataMgrFun.GetSamplePropertyVal(m_DataMgrFun.GetWorkSample(),ref SMInfo) = false Failed");
  560. return false;
  561. }
  562. //给SolutionWindow 发送新的工作样品名称
  563. m_SolutionWindows.Rev_MeasureApp_DeletSample_Event(m_ProjParam.GetWorkSampleName());
  564. //给工作样品台发送删除样品和新的工作样品名称
  565. m_SamplepaceWindow.Rev_MeasureApp_DeleteWorkSample_Event(sDeleteWSampleName, sNewWSName);
  566. // MeasureApp 窗口给 OTSPropertyWindow窗口 Grid显示的样品属性信息
  567. m_SPropertyWindows.DisplaySampleMeasureInfo(SMInfo);
  568. return true;
  569. }
  570. private void rbAddSample_Click(object sender, EventArgs e)
  571. {
  572. this.AddNewSampleMeasure();//the system will choose the empty hole one by one according to the holeNo sequence.
  573. }
  574. public void AddNewSampleMeasure(string sSampleHoleName = "")
  575. {
  576. //样品的属性值
  577. OTSSamplePropertyInfo SamplePropParam ;
  578. SamplePropParam = m_ProjParam.AddNewSampleMeasure(sSampleHoleName);
  579. if (null == SamplePropParam)
  580. {
  581. // 设置 开始 ,停止 和检查参数 按钮状态
  582. m_RibbonFun.SetMeasureRibbonButnStatu();
  583. log.Error("(OTSIncAMeasureAppForm.AddNewSample) m_DataMgrFun.AddNewSample(sSampleHoleName) = null ");
  584. return;
  585. }
  586. m_SPropertyWindows.TSSaveAs.Enabled = true;
  587. m_SPropertyWindows.TSLoad.Enabled = true;
  588. //给SampleWindow 发送样品信息
  589. OTSSamplePropertyInfo SMInfo = SamplePropParam;
  590. m_SamplepaceWindow.AddOneSampleArea(SMInfo.SMeasurePara);
  591. //给PropWindow 发送工作样品属性信息
  592. m_SPropertyWindows.DisplaySampleMeasureInfo(SMInfo);
  593. //给SoluWindow 发送样品显示信息
  594. m_SolutionWindows.AddSampleMeasure(SMInfo.TSampleParam);
  595. // 设置 开始 ,停止 和检查参数 按钮状态
  596. m_RibbonFun.SetMeasureRibbonButnStatu();
  597. //设置 删除,复位,圆形,矩形 按钮状态
  598. m_RibbonFun.SetSampleRibbonButnStatus();
  599. //清空帧图信息
  600. m_MessageStates = (int)MessageState.StartMeasure;
  601. m_SamplepaceWindow.ClearImageAndSingleGDIObjects();
  602. m_SamplepaceWindow.Invalidate();
  603. }
  604. private void rbSelectDlg_Click(object sender, EventArgs e)
  605. {
  606. //判断样品台是否有样品,如果有样品则不能设置默认参数
  607. if (m_ProjParam.GetSampleCount() > 0)
  608. {
  609. MessageBox.Show("Cann't setup preference parameter,for you have added some samples!");
  610. return;
  611. }
  612. ProgMgrInfoForm ProgMgrForm = new ProgMgrInfoForm();
  613. if (DialogResult.OK == ProgMgrForm.ShowDialog())
  614. {
  615. //m_DataMgrFun.SetSysPartSTDData(ProgMgrForm.GetCPartSTDDataClr());
  616. //检查\\Config\\SysData 是否有OTSProgMgrParam.pmf文件
  617. if (m_ProjParam.LoadParamFile() && m_ProjParam.LoadStageParamFile())
  618. {
  619. //检查\\Config\\SysData 是否有OTSProgMgrParam.pmf文件
  620. if (m_ProjParam.InitResultData())
  621. {
  622. m_RibbonFun.SetAllRibbonButnStatus(true);
  623. //当样品台上有样品,则不更新样品台数据
  624. if (0 == m_ProjParam.GetSampleCount())
  625. {
  626. //通过委托事件将样品台数据发送给SamplespaceWindwo
  627. m_SamplepaceWindow.InitStageDisplay(m_ProjData.GetStage(), m_ProjData.GetSEMStageData());
  628. }
  629. }
  630. else
  631. {
  632. log.Error("(OTSIncAMeasureAppForm.rbSelectDlg_Click) this.CheckMeasureSysFileExist() = false");
  633. }
  634. }
  635. else
  636. {
  637. log.Error("(OTSIncAMeasureAppForm.rbSelectDlg_Click) (m_DataMgrFun.CheckParamFile() && m_DataMgrFun.CheckStageFile()) = false");
  638. }
  639. }
  640. }
  641. // 主Windows框右下角显示鼠标点的SEM坐标(样品台)
  642. public void ShowSemCoordvAL(string sSemCoord)
  643. {
  644. STSemCoordinate.Text = sSemCoord;
  645. // TSGrayVal.Text = sGrayVal;
  646. statusStrip1.Refresh();
  647. }
  648. //// 主Windows框右下角显示鼠标点的灰度值(测量图)
  649. public void ShowGrayVal(string sGrayVal)
  650. {
  651. TSGrayVal.Text = sGrayVal;
  652. statusStrip1.Refresh();
  653. }
  654. //获取工作样品测量锁
  655. public bool GetWorkSampleParamLock(ref CTreeSampleParam TSParamLock)
  656. {
  657. OTSSamplePropertyInfo SMInfo = new OTSSamplePropertyInfo();
  658. if (!m_ProjParam.GetWSampleParaLock(ref SMInfo))
  659. {
  660. return false;
  661. }
  662. TSParamLock = SMInfo.TSampleParam;
  663. return true;
  664. }
  665. /// <summary>
  666. /// 更新属性窗口
  667. /// </summary>
  668. public void UpdatePropertyVal()
  669. {
  670. //获取新的工作样品属性值
  671. OTSSamplePropertyInfo SMInfo = new OTSSamplePropertyInfo();
  672. if (!m_ProjParam.GetWorkSamplePerameter(m_ProjParam.GetWorkSample(), ref SMInfo))
  673. {
  674. log.Error("(OTSIncAMeasureAppForm.SetSEMData) m_DataMgrFun.GetSamplePropertyVal(m_DataMgrFun.GetWorkSample(),ref SMInfo) = false Failed");
  675. }
  676. // MeasureApp 窗口给 OTSPropertyWindow窗口 Grid显示的样品属性信息
  677. m_SPropertyWindows.DisplaySampleMeasureInfo(SMInfo);
  678. }
  679. //获取BSE图
  680. //int iWidth: 宽
  681. //int iHeigh: 高
  682. //byte bImageData: 图像数据
  683. //返回 图像数据长度 = iWidth*iHeigh
  684. //bool bSimulatFlag : True 仿真状态
  685. public int GetImageData(int iWidth, int iHeight, ref byte[] ImageData, bool bSimulatFlag = false)
  686. {
  687. //获取BSE图片数据
  688. OTSBSEImageFun m_GetBseImage = new OTSBSEImageFun();
  689. return m_GetBseImage.GetScanImage(iWidth, iHeight, ref ImageData);
  690. }
  691. private void ribbonOrbMenuItemSaveAs_Click(object sender, EventArgs e)
  692. {
  693. bool iRev = m_ProjData.SaveAs();
  694. if (!iRev)
  695. {
  696. //log.Trace("(OTSIncAMeasureAppForm.ribbonOrbMenuItemSaveAs_Click) m_DataMgrFun.SaveAsFile() Failed !");
  697. return;
  698. }
  699. }
  700. private void rbSaveFile_Click(object sender, EventArgs e)
  701. {
  702. bool iRev = m_ProjData.Save();
  703. if (!iRev)
  704. {
  705. //log.Trace("(OTSIncAMeasureAppForm.rbSaveFile_Click) m_DataMgrFun.SaveFile() Failed !");
  706. return;
  707. }
  708. }
  709. private void rbCheckParam_Click(object sender, EventArgs e)
  710. {
  711. //检查样品测量参数
  712. if (m_ProjParam.CheckSampleParam(true))
  713. {
  714. string message = table["message7"].ToString();
  715. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  716. }
  717. }
  718. private void ribReset_Click(object sender, EventArgs e)
  719. {
  720. //调用样品台窗口中的复位方法
  721. m_SamplepaceWindow.ResetWorkSampleMeasure();
  722. }
  723. //绘制圆形测量区域
  724. private void ribCircle_Click(object sender, EventArgs e)
  725. {
  726. //修改工作样品的测量区域为圆形
  727. m_SamplepaceWindow.Rev_DDrawCircleMeasure_MeasureAppToSampleWindow_Event();
  728. }
  729. //绘制矩形测量区域
  730. private void ribRectangle_Click(object sender, EventArgs e)
  731. {
  732. //修改工作样品的测量区域为矩形
  733. m_SamplepaceWindow.Rev_DDrawRectangleMeasure_MeasureAppToSampleWindow_Event();
  734. }
  735. private void rbExitApp_Click(object sender, EventArgs e)
  736. {
  737. this.Close();
  738. }
  739. /// <summary>
  740. /// 执行样品孔中照片后台线程
  741. /// </summary>
  742. private void StartSampleHoleImageBGWorkThread()
  743. {
  744. if (!m_MsrThreadWrapper.BGWorkThreadIsRunning())
  745. {
  746. m_MessageStates = MessageState.ShotBSEPicture;
  747. m_MsrThreadWrapper.SetDoRunType((int)MSR_THREAD_RunSTATUS.RUNSampleHoleImage);
  748. m_MsrThreadWrapper.StartBGWorkThread();
  749. m_RibbonFun.SetMeasureRibbonButnStatu();
  750. }
  751. }
  752. private void rbStart_Click(object sender, EventArgs e)
  753. {
  754. if (!m_ProjParam.CheckSampleParam(false))
  755. {
  756. return;
  757. }
  758. if (!m_MsrThreadWrapper.BGWorkThreadIsRunning())
  759. {
  760. //设置消息类型 拍摄样品孔
  761. m_MessageStates = (int)MessageState.StartMeasure;
  762. m_MsrThreadWrapper.SetDoRunType((int)MSR_THREAD_RunSTATUS.RUNMEASURE);
  763. m_MsrThreadWrapper.StartBGWorkThread();
  764. m_RibbonFun.SetMeasureRibbonButnStatu();
  765. }
  766. }
  767. public void SetStartMeasureRibbonStatus()
  768. {
  769. //this.PropertyMeasureThreadRunFlag = true;
  770. ribView.Enabled = false;
  771. m_RibbonFun.SetToolButnStatu(false);
  772. //false: 将其他ribbon按钮设置为灰色
  773. rbPanelFile.Enabled = false;
  774. rbPanelSample.Enabled = false;
  775. m_SolutionWindows.Enabled = false;
  776. m_SPropertyWindows.Enabled = false;
  777. rbStart.Enabled = false;
  778. rbStop.Enabled = true;
  779. rbCheckParam.Enabled = false;
  780. }
  781. private void rbStop_Click(object sender, EventArgs e)
  782. {
  783. //如果当前正在测量,则停止测量线程
  784. if (MeasureThreadRunFlag)
  785. {
  786. //停止测量线程
  787. m_MsrThreadWrapper.SetMeasureThreadStatus(otsdataconst.OTS_MSR_THREAD_STATUS.STOPPED);
  788. }
  789. }
  790. private void rbRuler_Click(object sender, EventArgs e)
  791. {
  792. m_SamplepaceWindow.ShowRulerLocation();
  793. }
  794. private void rbSmapleName_Click(object sender, EventArgs e)
  795. {
  796. m_SamplepaceWindow.ChangeSampleHoleFont();
  797. }
  798. private void rbSmaplePhoto_Click(object sender, EventArgs e)
  799. {
  800. m_SamplepaceWindow.ChangeSampleHoleImage();
  801. }
  802. //当点击Ribbon停止按钮时,设置Ribbon状态
  803. public void SetStopMeasureRibbonStatus()
  804. {
  805. //this.PropertyMeasureThreadRunFlag = false;
  806. ribView.Enabled = true;
  807. m_RibbonFun.SetToolButnStatu(true);
  808. rbPanelFile.Enabled = true;
  809. rbPanelSample.Enabled = true;
  810. m_RibbonFun.SetMeasureRibbonButnStatu();
  811. m_SolutionWindows.Enabled = true;
  812. m_SPropertyWindows.Enabled = true;
  813. rbStart.Enabled = true;
  814. rbStop.Enabled = false;
  815. rbCheckParam.Enabled = true;
  816. }
  817. public bool SwitchMeasureSample(string sMsrSampleName)
  818. {
  819. if (!m_ProjParam.SetWorkSample(sMsrSampleName))
  820. {
  821. log.Error("(OTSIncAMeasureAppForm.SwitchMeasureSample) SetWorkSample(sMsrSampleName =" + sMsrSampleName + ") Failed !");
  822. return false;
  823. }
  824. OTSSamplePropertyInfo SMInfo = new OTSSamplePropertyInfo();
  825. if (!m_ProjParam.GetWorkSamplePerameter(m_ProjParam.GetWorkSample(), ref SMInfo))
  826. {
  827. log.Error("(OTSIncAMeasureAppForm.SwitchMeasureSample) m_DataMgrFun.GetSamplePropertyVal(m_DataMgrFun.GetWorkSample(), ref SMInfo) = false Failed !");
  828. return false;
  829. }
  830. // MeasureApp 窗口给 OTSPropertyWindow窗口 Grid显示的样品属性信息
  831. m_SolutionWindows.Rev_MeasureApp_SwitchSample_Event(sMsrSampleName);
  832. m_SPropertyWindows.DisplaySampleMeasureInfo(SMInfo);
  833. return true;
  834. }
  835. #region 开始获取样品孔中的照片
  836. /// <summary>
  837. /// 开始获取样品孔中的照片
  838. /// </summary>
  839. /// <param name="doRunType"></param>
  840. /// <param name="HoleID"></param>
  841. /// <param name="c_DomainMessure"></param>
  842. public void StartSampleHoleBSEImage(int doRunType, int HoleID, CDomain c_DomainMessure)
  843. {
  844. //线程执行类型 1:测量类型 2:获取样品孔图片类型
  845. m_MsrThreadWrapper.SetDoRunType(doRunType);
  846. //设置获取样品孔中照片所需的参数
  847. m_MsrThreadWrapper.SetHoleImagePreview(HoleID, c_DomainMessure);
  848. StartSampleHoleImageBGWorkThread();
  849. }
  850. #endregion
  851. private void rbRecover_Click(object sender, EventArgs e)
  852. {
  853. //关闭所有内容
  854. CloseAllContents();
  855. //显示样品属性窗口与树结构窗口
  856. m_SolutionWindows.Show(dockPanel, DockState.DockLeft);
  857. m_SPropertyWindows.Show(dockPanel);
  858. //显示样品台窗口 测量状态与测量结果窗口
  859. m_SamplepaceWindow.Show(dockPanel);
  860. m_MessureStatuWindow.Show(dockPanel);
  861. m_MeasureRetWindow.Show(dockPanel);
  862. //此处将在父窗体选项卡上显示
  863. foreach (Form child in this.MdiChildren)
  864. {
  865. if (child.Name == "OTSSamplespaceWindow")
  866. {
  867. child.Activate();
  868. break;
  869. }
  870. }
  871. }
  872. private void CloseAllContents()
  873. {
  874. m_SolutionWindows.DockPanel = null;
  875. m_SPropertyWindows.DockPanel = null;
  876. m_SamplepaceWindow.DockPanel = null;
  877. m_MessureStatuWindow.DockPanel = null;
  878. m_MeasureRetWindow.DockPanel = null;
  879. CloseAllDocuments();
  880. }
  881. private void CloseAllDocuments()
  882. {
  883. if (dockPanel.DocumentStyle == DocumentStyle.SystemMdi)
  884. {
  885. foreach (Form form in MdiChildren)
  886. form.Close();
  887. }
  888. else
  889. {
  890. IDockContent[] documents = dockPanel.DocumentsToArray();
  891. foreach (IDockContent content in documents)
  892. content.DockHandler.Close();
  893. }
  894. }
  895. private void rbMeasureCircle_Click(object sender, EventArgs e)
  896. {
  897. m_ProjParam.SetMeasureAreaShape((int)ShapeType.CIRCUL);
  898. //修改工作样品的测量区域为圆形
  899. m_SamplepaceWindow.changeShape((int)ShapeType.CIRCUL);
  900. }
  901. private void rbMeasureRectangle_Click(object sender, EventArgs e)
  902. {
  903. m_ProjParam.SetMeasureAreaShape((int)ShapeType.RECTANGLE);
  904. //修改工作样品的测量区域为矩形
  905. m_SamplepaceWindow.changeShape((int)ShapeType.RECTANGLE);
  906. }
  907. //ctrl+s组合键进行保存
  908. private void OTSIncAMeasureAppForm_KeyDown(object sender, KeyEventArgs e)
  909. {
  910. if (e.KeyCode == Keys.S && e.Modifiers == Keys.Control)
  911. {
  912. bool iRev = m_ProjData.Save();
  913. if (!iRev)
  914. {
  915. log.Error("(OTSIncAMeasureAppForm.rbSaveFile_Click) m_DataMgrFun.SaveFile() Failed !");
  916. return;
  917. }
  918. log.Error("(OTSIncAMeasureAppForm.rbSaveAs_Click) m_DataMgrFun.SaveFile() Success !");
  919. }
  920. }
  921. private void rbSTDEdit_Click_1(object sender, EventArgs e)
  922. {
  923. OpenFileDialog openFileDialog = new OpenFileDialog();
  924. openFileDialog.Filter = "(*.db)|*.db";
  925. openFileDialog.InitialDirectory = Application.StartupPath + "\\Config\\SysData\\";
  926. openFileDialog.RestoreDirectory = true;
  927. openFileDialog.FilterIndex = 1;
  928. if (openFileDialog.ShowDialog() == DialogResult.OK)
  929. {
  930. try
  931. {
  932. System.Diagnostics.Process p = System.Diagnostics.Process.Start(".\\OTSPartA_STDEditor.exe", openFileDialog.FileName);
  933. p.WaitForExit();
  934. }
  935. catch (Exception ex)
  936. {
  937. log.Error("OTSPartA_STDEditor:" + ex.ToString());
  938. }
  939. }
  940. }
  941. private void ribPolygon_Click(object sender, EventArgs e)
  942. {
  943. //修改工作样品的测量区域为矩形
  944. m_SamplepaceWindow.Rev_DDrawPolygonMeasure_MeasureAppToSampleWindow_Event();
  945. }
  946. private void rbReClassify_Click(object sender, EventArgs e)
  947. {
  948. if (m_ProjData.Reclassify())
  949. {
  950. m_ProjData.Save();
  951. MessageBox.Show("reclassification success");
  952. }
  953. else
  954. {
  955. MessageBox.Show("reclassification failed");
  956. }
  957. }
  958. /// <summary>
  959. /// 打开测量项目文件
  960. /// </summary>
  961. private void OpenMeasureProjectFile()
  962. {
  963. bool bOpenFlag=false;
  964. COTSMsrPrjResultData ProjDataMgr = new COTSMsrPrjResultData();
  965. if (ProjDataMgr.Load())
  966. {
  967. m_ProjParam.m_ResultData = ProjDataMgr;
  968. m_ProjParam.InitResultData();
  969. m_ProjData = ProjDataMgr;
  970. bOpenFlag = true;
  971. }
  972. if (bOpenFlag)
  973. {
  974. if (!DisplayExistSampleFile())
  975. {
  976. log.Error("(OTSIncAMeasureAppForm.rbOpen_Click) OpenExistSampleFile() = false Failed !");
  977. return;
  978. }
  979. m_RibbonFun.SetAllRibbonButnStatus(true);
  980. }
  981. else
  982. {
  983. log.Error("(OTSIncAMeasureAppForm.rbOpen_Click) m_DataMgrFun.OpenExistSampleFile() Failed !");
  984. }
  985. }
  986. private void OTSIncAMeasureAppForm_FormClosed(object sender, FormClosedEventArgs e)
  987. {
  988. }
  989. private void rbAbout_Click(object sender, EventArgs e)
  990. {
  991. About m_about = new About();
  992. m_about.ShowDialog();
  993. }
  994. }
  995. }