OTSIncAMeasureAppForm.cs 45 KB

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