OTSIncAMeasureAppForm.cs 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219
  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. namespace OTSMeasureApp
  15. {
  16. public enum MessageState
  17. {
  18. StartMeasure = 0, //开始测量
  19. ShotBSEPicture = 1, //拍摄样品孔图片
  20. MeasureBSEPicture = 2 //拍摄测量区域图片
  21. };
  22. enum ShapeType
  23. {
  24. CIRCUL = 0, //圆形
  25. RECTANGLE = 1 //矩形
  26. };
  27. enum MessageBoxRev
  28. {
  29. DIALOG_YES = 0,
  30. DIALOG_NO = 1,
  31. DIALOG_CANCEL = 2
  32. }
  33. public partial class OTSIncAMeasureAppForm : Form
  34. {
  35. public static string m_SamplespaceWindowName = "样品台";
  36. public static string m_MeasureStauWindowName = "测量状态";
  37. public static string m_MeasureRetWindowName = "测量结果";
  38. public static string m_NoWindowName = "未知工作窗口";
  39. //国际化
  40. OTSSysMgrTools.Language lan;
  41. Hashtable table;
  42. public OTSRibbonFun m_RibbonFun = null;
  43. //判断信息来源 拍摄样品孔图片 或是 测量开始
  44. public MessageState m_MessageStates = (int)MessageState.StartMeasure;
  45. // 初始化日志类
  46. NLog.Logger log ;
  47. // Control m_ControlWindow = null;
  48. public OTSMeasureResultWindow m_MeasureRetWindow = null;
  49. public OTSMeasureStatusWindow m_MessureStatuWindow = null;
  50. public OTSSamplespaceWindow m_SamplepaceWindow = null;
  51. public OTSMeasureOutputNlog m_OTSMeasureOutputNlog = null;
  52. //STMrsSampleRetThreadMsg MSTMsg;
  53. //PostLogMsg m_LogMsg;
  54. public COTSMeasureParam m_ProjParam = null;
  55. public COTSMsrPrjResultData m_ProjData;
  56. public OTSSolutionWindow m_SolutionWindows = null;
  57. public OTSPropertyWindow m_SPropertyWindows = null;
  58. //测量线程对象
  59. public CMeasureThreadWrapper m_MsrThreadWrapper = null;
  60. //获取BSE图数据变量
  61. //public byte[] m_BSEData = null;
  62. // 测量线程当前状态 True: 正在测量; False: 测量结束
  63. public bool MeasureThreadRunFlag { get => m_MsrThreadWrapper.BGWorkThreadIsRunning(); }
  64. public OTSIncAMeasureAppForm()
  65. {
  66. InitializeComponent();
  67. //国际化
  68. lan = new OTSSysMgrTools.Language(this);
  69. table = lan.GetNameTable(this.Name);
  70. m_SamplespaceWindowName = table["m_samplespacewindowname"].ToString();
  71. m_MeasureStauWindowName = table["m_measurestauwindowname"].ToString();
  72. m_MeasureRetWindowName = table["m_measureretwindowname"].ToString();
  73. m_NoWindowName = table["m_nowindowname"].ToString();
  74. m_OTSMeasureOutputNlog = new OTSMeasureOutputNlog();
  75. m_OTSMeasureOutputNlog.Show();
  76. //初始化日志文件名称
  77. // 初始化Docpanle
  78. m_SolutionWindows = new OTSSolutionWindow(this);
  79. m_SPropertyWindows = new OTSPropertyWindow(this);
  80. m_MeasureRetWindow = new OTSMeasureResultWindow(this);
  81. m_MeasureRetWindow.Text = m_MeasureRetWindowName;
  82. m_MessureStatuWindow = new OTSMeasureStatusWindow(this);
  83. m_MessureStatuWindow.Text = m_MeasureStauWindowName;
  84. m_SamplepaceWindow = new OTSSamplespaceWindow(this);
  85. m_SamplepaceWindow.Text = m_SamplespaceWindowName;
  86. //和DataMgr进行数据交互类
  87. m_ProjParam = new COTSMeasureParam(this);
  88. m_ProjData = m_ProjParam.m_ResultData;
  89. //初始化Ribbon类,操作Ribbon按钮的可用或者不可用
  90. m_RibbonFun = new OTSRibbonFun(this);
  91. //初始化测量线程
  92. m_MsrThreadWrapper = new CMeasureThreadWrapper(this);//must be the last sentence of this procedure.
  93. }
  94. private void OTSIncAMeasureAppForm_Load(object sender, EventArgs e)
  95. {
  96. try
  97. {
  98. ArrangWorkspaceWindow();
  99. log = NLog.LogManager.GetCurrentClassLogger();
  100. if (m_ProjParam.LoadParamFile() && m_ProjParam.LoadStageParamFile())
  101. {
  102. if (m_ProjParam.InitResultData())
  103. {
  104. m_RibbonFun.SetAllRibbonButnStatus(true);
  105. m_SamplepaceWindow.InitStageDisplay(m_ProjData.GetStage(),m_ProjData.GetSEMStageData());
  106. //添加启动系统界面显示
  107. if (m_ProjParam.m_DefaultParam.m_nPackId.ToString() == "IncA")
  108. {
  109. this.Text += " -- Inclusion Analysis System";
  110. }
  111. else if (m_ProjParam.m_DefaultParam.m_nPackId.ToString() == "CleanlinessA")
  112. {
  113. this.Text += " -- Cleanliness Analysis System";
  114. }
  115. }
  116. else
  117. {
  118. log.Error("(OTSIncAMeasureAppForm.OTSIncAMeasureAppForm_Load) this.CheckMeasureSysFileExist() = false");
  119. }
  120. }
  121. else
  122. {
  123. log.Error("(OTSIncAMeasureAppForm.OTSIncAMeasureAppForm_Load) (m_DataMgrFun.CheckParamFile() && m_DataMgrFun.CheckStageFile()) = false");
  124. }
  125. }
  126. catch (Exception ex)
  127. {
  128. log.Error("(OTSIncAMeasureAppForm.OTSIncAMeasureAppForm_Load) OTSIncAMeasureAppForm_Load:" + ex.ToString());
  129. }
  130. }
  131. public void ArrangWorkspaceWindow()
  132. {
  133. //Show 样品台窗口
  134. m_SamplepaceWindow.Show(dockPanel);
  135. //Show 测量状态窗口
  136. m_MessureStatuWindow.Show(dockPanel);
  137. //Show 测量结果窗口
  138. m_MeasureRetWindow.Show(dockPanel);
  139. m_SolutionWindows.Show(dockPanel, DockState.DockLeft);
  140. //Show 测量过程中Log显示窗口
  141. m_OTSMeasureOutputNlog.Show(dockPanel, DockState.DockRight);
  142. dockPanel.DockRightPortion = 365;
  143. m_SPropertyWindows.Show(dockPanel);
  144. m_SamplepaceWindow.Activate();
  145. }
  146. private void rbReport_Click(object sender, EventArgs e)
  147. {
  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. }
  317. catch (Exception ex)
  318. {
  319. string message = table["message3"].ToString();
  320. log.Error("OTSIncAMeasureAppForm_FormClosing-"+ message + ":" + ex.ToString());
  321. }
  322. //CloseAllContents();
  323. m_MsrThreadWrapper.SetWorkThreadPending();
  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. }
  429. if ("" == sWSampleName)
  430. {
  431. log.Error("(OTSIncAMeasureAppForm.OpenExistSampleFile) m_DataMgrFun.GetWorkSampleName() = null Failed !");
  432. return false;
  433. }
  434. m_SamplepaceWindow.Rev_MeasureApp_OpenExistSampleFile_Event(m_ProjData.GetStage(), m_ProjData.GetSEMStageData(), SampleMeasureAreaList, sWSampleName);
  435. return true;
  436. }
  437. public bool OpenExistSampleMeasureArea(ref List<SampleMeasurePara> SampleMeasureAreaList)
  438. {
  439. int iSListCount = m_ProjData.GetSampleList().Count;
  440. if (0 == iSListCount)
  441. {
  442. return false;
  443. }
  444. for (int i = 0; i < iSListCount; i++)
  445. {
  446. SampleMeasurePara SampleMeasureArea = new SampleMeasurePara();
  447. //获取样品的测量区域信息
  448. //获取样品名称
  449. SampleMeasureArea.sSampleName = (m_ProjData.GetSampleList())[i].GetName();
  450. // 获取测量区域形状
  451. SampleMeasureArea.iShape = (int)(m_ProjData.GetSampleList())[i].GetMsrArea().GetShape();
  452. //获取样品孔名称
  453. SampleMeasureArea.sHoleName = (m_ProjData.GetSampleList())[i].GetSampleHoleName();
  454. //样品测量区域
  455. SampleMeasureArea.MeasureRect = (Rectangle)(m_ProjData.GetSampleList())[i].GetMsrArea().GetRectDomain();
  456. //多边形点集合
  457. SampleMeasureArea.PolygonPointRegion = (m_ProjData.GetSampleList())[i].GetMsrArea().GetPolygonPoint();
  458. List<PointF> PointRegionF = new List<PointF>();
  459. List<Point> PolygonPoint = m_ProjData.GetSampleList()[i].GetMsrArea().GetPolygonPoint();
  460. if (PolygonPoint != null)
  461. {
  462. foreach (var item in m_ProjData.GetSampleList()[i].GetMsrArea().GetPolygonPoint())
  463. {
  464. PointRegionF.Add(new PointF(item.X, item.Y));
  465. }
  466. }
  467. SampleMeasureArea.PolygonPointRegionF = PointRegionF;
  468. SampleMeasureArea.DrawPolygonPointRegionF = PointRegionF;
  469. SampleMeasureAreaList.Add(SampleMeasureArea);
  470. }
  471. return true;
  472. }
  473. //打开指定路径的文件
  474. private void rbOpen_Click(object sender, EventArgs e)
  475. {
  476. OpenMeasureProjectFile();
  477. }
  478. private void rbDeleteSample_Click(object sender, EventArgs e)
  479. {
  480. //删除样品(样品必须先选中)
  481. string sWSampleName = m_ProjParam.GetWorkSampleName();
  482. if ("" == sWSampleName)
  483. {
  484. log.Error("(OTSIncAMeasureAppForm.rbDeleteSample_Click) m_DataMgrFun.GetWorkSampleName() = null Failed");
  485. return;
  486. }
  487. string message = table["message5"].ToString();
  488. string message6 = table["message6"].ToString();
  489. string sDeleteSampleName = message;
  490. sDeleteSampleName += sWSampleName;
  491. sDeleteSampleName += message6;
  492. if (DialogResult.OK == MessageBox.Show(sDeleteSampleName, "Tip", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning))
  493. {
  494. //删除样品成功
  495. if (!this.DeleteSample(sWSampleName))
  496. {
  497. log.Error("(OTSIncAMeasureAppForm.rbDeleteSample_Click) DeleteSample(sWSampleName) = false Failed, sWSampleName = " + sWSampleName);
  498. return;
  499. }
  500. //m_MeasureRetWindow.SetInit();
  501. sWSampleName = m_ProjParam.GetWorkSampleName();
  502. if ("" == sWSampleName)
  503. {
  504. log.Error("(OTSIncAMeasureAppForm.rbDeleteSample_Click) m_DataMgrFun.GetWorkSampleName() = null Failed");
  505. return;
  506. }
  507. m_SolutionWindows.m_TreeViewBase.GetTreeWorkSampleNode(sWSampleName);
  508. m_SolutionWindows.treeView1.Focus();
  509. }
  510. }
  511. //返回删除的工作样品名
  512. public bool DeleteSample(string sDeleteWSampleName = "")
  513. {
  514. if (!m_ProjParam.DeleteWorkSample(sDeleteWSampleName))
  515. {
  516. log.Error("(OTSIncAMeasureAppForm.DeleteSample) m_DataMgrFun.DeleteWorkSample(sDeleteWSampleName) Failed, sDeleteWSampleName = " + sDeleteWSampleName);
  517. //return false;
  518. }
  519. // 设置 开始 ,停止 和检查参数 按钮状态
  520. m_RibbonFun.SetMeasureRibbonButnStatu();
  521. //设置 删除,复位,圆形,矩形 按钮状态
  522. m_RibbonFun.SetSampleRibbonButnStatus();
  523. // 更新报告ribbon按钮状态
  524. m_RibbonFun.SetAllRibbonButnStatus(true);
  525. int iSampleCount = m_ProjParam.GetSampleCount();
  526. if (0 == iSampleCount)
  527. {
  528. //给工作样品台发送删除样品和新的工作样品名称
  529. m_SamplepaceWindow.Rev_MeasureApp_DeleteWorkSample_Event(sDeleteWSampleName, "");
  530. //清空样品对象列表
  531. if (OTSSamplespaceWindow.m_SampleGDIObjects != null)
  532. {
  533. //清空样品台窗口中样品、测量区域、帧图、照片位置对象列表
  534. OTSSamplespaceWindow.m_SampleGDIObjects.Clear();
  535. OTSSamplespaceWindow.m_MeasureGDIObjects.Clear();
  536. OTSSamplespaceWindow.m_MeasurePathGDIObjects.Clear();
  537. m_SamplepaceWindow.ClearImageAndSingleGDIObjects();
  538. }
  539. //样品全部删除完,将Treeview 和Grid 显示内容清空
  540. m_SPropertyWindows.PropGrid.Hide();
  541. m_SolutionWindows.treeView1.Nodes.Clear();
  542. m_MessureStatuWindow.HideXRayTable();
  543. m_MeasureRetWindow.SetInit();
  544. return true;
  545. }
  546. //获取新工作样品名称
  547. string sNewWSName = m_ProjParam.GetWorkSampleName();
  548. if ("" == sNewWSName)
  549. {
  550. log.Error("(OTSIncAMeasureAppForm.DeleteSample) m_DataMgrFun.GetWorkSampleName() = null Failed");
  551. return true;
  552. }
  553. //获取新的工作样品属性值
  554. OTSSamplePropertyInfo SMInfo = new OTSSamplePropertyInfo();
  555. if (!m_ProjParam.GetWorkSamplePerameter(m_ProjParam.GetWorkSample(), ref SMInfo))
  556. {
  557. log.Error("(OTSIncAMeasureAppForm.DeleteSample) m_DataMgrFun.GetSamplePropertyVal(m_DataMgrFun.GetWorkSample(),ref SMInfo) = false Failed");
  558. return false;
  559. }
  560. //给SolutionWindow 发送新的工作样品名称
  561. m_SolutionWindows.Rev_MeasureApp_DeletSample_Event(m_ProjParam.GetWorkSampleName());
  562. //给工作样品台发送删除样品和新的工作样品名称
  563. m_SamplepaceWindow.Rev_MeasureApp_DeleteWorkSample_Event(sDeleteWSampleName, sNewWSName);
  564. // MeasureApp 窗口给 OTSPropertyWindow窗口 Grid显示的样品属性信息
  565. m_SPropertyWindows.DisplaySampleMeasureInfo(SMInfo);
  566. return true;
  567. }
  568. private void rbAddSample_Click(object sender, EventArgs e)
  569. {
  570. this.AddNewSampleMeasure();//the system will choose the empty hole one by one according to the holeNo sequence.
  571. }
  572. public void AddNewSampleMeasure(string sSampleHoleName = "")
  573. {
  574. //样品的属性值
  575. OTSSamplePropertyInfo SamplePropParam ;
  576. SamplePropParam = m_ProjParam.AddNewSampleMeasure(sSampleHoleName);
  577. if (null == SamplePropParam)
  578. {
  579. // 设置 开始 ,停止 和检查参数 按钮状态
  580. m_RibbonFun.SetMeasureRibbonButnStatu();
  581. log.Error("(OTSIncAMeasureAppForm.AddNewSample) m_DataMgrFun.AddNewSample(sSampleHoleName) = null ");
  582. return;
  583. }
  584. m_SPropertyWindows.TSSaveAs.Enabled = true;
  585. m_SPropertyWindows.TSLoad.Enabled = true;
  586. //给SampleWindow 发送样品信息
  587. OTSSamplePropertyInfo SMInfo = SamplePropParam;
  588. m_SamplepaceWindow.AddOneSampleArea(SMInfo.SMeasurePara);
  589. //给PropWindow 发送工作样品属性信息
  590. m_SPropertyWindows.DisplaySampleMeasureInfo(SMInfo);
  591. //给SoluWindow 发送样品显示信息
  592. m_SolutionWindows.AddSampleMeasure(SMInfo.TSampleParam);
  593. // 设置 开始 ,停止 和检查参数 按钮状态
  594. m_RibbonFun.SetMeasureRibbonButnStatu();
  595. //设置 删除,复位,圆形,矩形 按钮状态
  596. m_RibbonFun.SetSampleRibbonButnStatus();
  597. //清空帧图信息
  598. m_MessageStates = (int)MessageState.StartMeasure;
  599. m_SamplepaceWindow.ClearImageAndSingleGDIObjects();
  600. m_SamplepaceWindow.Invalidate();
  601. }
  602. private void rbSelectDlg_Click(object sender, EventArgs e)
  603. {
  604. //判断样品台是否有样品,如果有样品则不能设置默认参数
  605. if (m_ProjParam.GetSampleCount() > 0)
  606. {
  607. MessageBox.Show("Cann't setup preference parameter,for you have added some samples!");
  608. return;
  609. }
  610. ProgMgrInfoForm ProgMgrForm = new ProgMgrInfoForm();
  611. if (DialogResult.OK == ProgMgrForm.ShowDialog())
  612. {
  613. //m_DataMgrFun.SetSysPartSTDData(ProgMgrForm.GetCPartSTDDataClr());
  614. //检查\\Config\\SysData 是否有OTSProgMgrParam.pmf文件
  615. if (m_ProjParam.LoadParamFile() && m_ProjParam.LoadStageParamFile())
  616. {
  617. //检查\\Config\\SysData 是否有OTSProgMgrParam.pmf文件
  618. if (m_ProjParam.InitResultData())
  619. {
  620. m_RibbonFun.SetAllRibbonButnStatus(true);
  621. //当样品台上有样品,则不更新样品台数据
  622. if (0 == m_ProjParam.GetSampleCount())
  623. {
  624. //通过委托事件将样品台数据发送给SamplespaceWindwo
  625. m_SamplepaceWindow.InitStageDisplay(m_ProjData.GetStage(), m_ProjData.GetSEMStageData());
  626. }
  627. }
  628. else
  629. {
  630. log.Error("(OTSIncAMeasureAppForm.rbSelectDlg_Click) this.CheckMeasureSysFileExist() = false");
  631. }
  632. }
  633. else
  634. {
  635. log.Error("(OTSIncAMeasureAppForm.rbSelectDlg_Click) (m_DataMgrFun.CheckParamFile() && m_DataMgrFun.CheckStageFile()) = false");
  636. }
  637. }
  638. }
  639. // 主Windows框右下角显示鼠标点的SEM坐标(样品台)
  640. public void ShowSemCoordvAL(string sSemCoord)
  641. {
  642. STSemCoordinate.Text = sSemCoord;
  643. // TSGrayVal.Text = sGrayVal;
  644. statusStrip1.Refresh();
  645. }
  646. //// 主Windows框右下角显示鼠标点的灰度值(测量图)
  647. public void ShowGrayVal(string sGrayVal)
  648. {
  649. TSGrayVal.Text = sGrayVal;
  650. statusStrip1.Refresh();
  651. }
  652. //获取工作样品测量锁
  653. public bool GetWorkSampleParamLock(ref CTreeSampleParam TSParamLock)
  654. {
  655. OTSSamplePropertyInfo SMInfo = new OTSSamplePropertyInfo();
  656. if (!m_ProjParam.GetWSampleParaLock(ref SMInfo))
  657. {
  658. return false;
  659. }
  660. TSParamLock = SMInfo.TSampleParam;
  661. return true;
  662. }
  663. /// <summary>
  664. /// 更新属性窗口
  665. /// </summary>
  666. public void UpdatePropertyVal()
  667. {
  668. //获取新的工作样品属性值
  669. OTSSamplePropertyInfo SMInfo = new OTSSamplePropertyInfo();
  670. if (!m_ProjParam.GetWorkSamplePerameter(m_ProjParam.GetWorkSample(), ref SMInfo))
  671. {
  672. log.Error("(OTSIncAMeasureAppForm.SetSEMData) m_DataMgrFun.GetSamplePropertyVal(m_DataMgrFun.GetWorkSample(),ref SMInfo) = false Failed");
  673. }
  674. // MeasureApp 窗口给 OTSPropertyWindow窗口 Grid显示的样品属性信息
  675. m_SPropertyWindows.DisplaySampleMeasureInfo(SMInfo);
  676. }
  677. //获取BSE图
  678. //int iWidth: 宽
  679. //int iHeigh: 高
  680. //byte bImageData: 图像数据
  681. //返回 图像数据长度 = iWidth*iHeigh
  682. //bool bSimulatFlag : True 仿真状态
  683. public int GetImageData(int iWidth, int iHeight, ref byte[] ImageData, bool bSimulatFlag = false)
  684. {
  685. //获取BSE图片数据
  686. OTSBSEImageFun m_GetBseImage = new OTSBSEImageFun();
  687. return m_GetBseImage.GetScanImage(iWidth, iHeight, ref ImageData);
  688. }
  689. private void ribbonOrbMenuItemSaveAs_Click(object sender, EventArgs e)
  690. {
  691. bool iRev = m_ProjData.SaveAs();
  692. if (!iRev)
  693. {
  694. //log.Trace("(OTSIncAMeasureAppForm.ribbonOrbMenuItemSaveAs_Click) m_DataMgrFun.SaveAsFile() Failed !");
  695. return;
  696. }
  697. }
  698. private void rbSaveFile_Click(object sender, EventArgs e)
  699. {
  700. bool iRev = m_ProjData.Save();
  701. if (!iRev)
  702. {
  703. //log.Trace("(OTSIncAMeasureAppForm.rbSaveFile_Click) m_DataMgrFun.SaveFile() Failed !");
  704. return;
  705. }
  706. }
  707. private void rbCheckParam_Click(object sender, EventArgs e)
  708. {
  709. //检查样品测量参数
  710. if (m_ProjParam.CheckSampleParam(true))
  711. {
  712. string message = table["message7"].ToString();
  713. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  714. }
  715. }
  716. private void ribReset_Click(object sender, EventArgs e)
  717. {
  718. //调用样品台窗口中的复位方法
  719. m_SamplepaceWindow.ResetWorkSampleMeasure();
  720. }
  721. //绘制圆形测量区域
  722. private void ribCircle_Click(object sender, EventArgs e)
  723. {
  724. //修改工作样品的测量区域为圆形
  725. m_SamplepaceWindow.Rev_DDrawCircleMeasure_MeasureAppToSampleWindow_Event();
  726. }
  727. //绘制矩形测量区域
  728. private void ribRectangle_Click(object sender, EventArgs e)
  729. {
  730. //修改工作样品的测量区域为矩形
  731. m_SamplepaceWindow.Rev_DDrawRectangleMeasure_MeasureAppToSampleWindow_Event();
  732. }
  733. private void rbExitApp_Click(object sender, EventArgs e)
  734. {
  735. this.Close();
  736. }
  737. /// <summary>
  738. /// 执行样品孔中照片后台线程
  739. /// </summary>
  740. private void StartSampleHoleImageBGWorkThread()
  741. {
  742. if (!m_MsrThreadWrapper.BGWorkThreadIsRunning())
  743. {
  744. m_MessageStates = MessageState.ShotBSEPicture;
  745. m_MsrThreadWrapper.SetDoRunType((int)MSR_THREAD_RunSTATUS.RUNSampleHoleImage);
  746. m_MsrThreadWrapper.StartBGWorkThread();
  747. m_RibbonFun.SetMeasureRibbonButnStatu();
  748. }
  749. }
  750. private void rbStart_Click(object sender, EventArgs e)
  751. {
  752. if (!m_ProjParam.CheckSampleParam(false))
  753. {
  754. return;
  755. }
  756. if (!m_MsrThreadWrapper.BGWorkThreadIsRunning())
  757. {
  758. //设置消息类型 拍摄样品孔
  759. m_MessageStates = (int)MessageState.StartMeasure;
  760. m_MsrThreadWrapper.SetDoRunType((int)MSR_THREAD_RunSTATUS.RUNMEASURE);
  761. m_MsrThreadWrapper.StartBGWorkThread();
  762. m_RibbonFun.SetMeasureRibbonButnStatu();
  763. }
  764. }
  765. public void SetStartMeasureRibbonStatus()
  766. {
  767. //this.PropertyMeasureThreadRunFlag = true;
  768. ribView.Enabled = false;
  769. m_RibbonFun.SetToolButnStatu(false);
  770. //false: 将其他ribbon按钮设置为灰色
  771. rbPanelFile.Enabled = false;
  772. rbPanelSample.Enabled = false;
  773. m_SolutionWindows.Enabled = false;
  774. m_SPropertyWindows.Enabled = false;
  775. rbStart.Enabled = false;
  776. rbStop.Enabled = true;
  777. rbCheckParam.Enabled = false;
  778. }
  779. private void rbStop_Click(object sender, EventArgs e)
  780. {
  781. //如果当前正在测量,则停止测量线程
  782. if (MeasureThreadRunFlag)
  783. {
  784. //停止测量线程
  785. m_MsrThreadWrapper.SetMeasureThreadStatus(otsdataconst.OTS_MSR_THREAD_STATUS.STOPPED);
  786. }
  787. }
  788. private void rbRuler_Click(object sender, EventArgs e)
  789. {
  790. m_SamplepaceWindow.ShowRulerLocation();
  791. }
  792. private void rbSmapleName_Click(object sender, EventArgs e)
  793. {
  794. m_SamplepaceWindow.ChangeSampleHoleFont();
  795. }
  796. private void rbSmaplePhoto_Click(object sender, EventArgs e)
  797. {
  798. m_SamplepaceWindow.ChangeSampleHoleImage();
  799. }
  800. //当点击Ribbon停止按钮时,设置Ribbon状态
  801. public void SetStopMeasureRibbonStatus()
  802. {
  803. //this.PropertyMeasureThreadRunFlag = false;
  804. ribView.Enabled = true;
  805. m_RibbonFun.SetToolButnStatu(true);
  806. rbPanelFile.Enabled = true;
  807. rbPanelSample.Enabled = true;
  808. m_RibbonFun.SetMeasureRibbonButnStatu();
  809. m_SolutionWindows.Enabled = true;
  810. m_SPropertyWindows.Enabled = true;
  811. rbStart.Enabled = true;
  812. rbStop.Enabled = false;
  813. rbCheckParam.Enabled = true;
  814. }
  815. public bool SwitchMeasureSample(string sMsrSampleName)
  816. {
  817. if (!m_ProjParam.SetWorkSample(sMsrSampleName))
  818. {
  819. log.Error("(OTSIncAMeasureAppForm.SwitchMeasureSample) SetWorkSample(sMsrSampleName =" + sMsrSampleName + ") Failed !");
  820. return false;
  821. }
  822. OTSSamplePropertyInfo SMInfo = new OTSSamplePropertyInfo();
  823. if (!m_ProjParam.GetWorkSamplePerameter(m_ProjParam.GetWorkSample(), ref SMInfo))
  824. {
  825. log.Error("(OTSIncAMeasureAppForm.SwitchMeasureSample) m_DataMgrFun.GetSamplePropertyVal(m_DataMgrFun.GetWorkSample(), ref SMInfo) = false Failed !");
  826. return false;
  827. }
  828. // MeasureApp 窗口给 OTSPropertyWindow窗口 Grid显示的样品属性信息
  829. m_SolutionWindows.Rev_MeasureApp_SwitchSample_Event(sMsrSampleName);
  830. m_SPropertyWindows.DisplaySampleMeasureInfo(SMInfo);
  831. return true;
  832. }
  833. #region 开始获取样品孔中的照片
  834. /// <summary>
  835. /// 开始获取样品孔中的照片
  836. /// </summary>
  837. /// <param name="doRunType"></param>
  838. /// <param name="HoleID"></param>
  839. /// <param name="c_DomainMessure"></param>
  840. public void StartSampleHoleBSEImage(int doRunType, int HoleID, CDomain c_DomainMessure)
  841. {
  842. //线程执行类型 1:测量类型 2:获取样品孔图片类型
  843. m_MsrThreadWrapper.SetDoRunType(doRunType);
  844. //设置获取样品孔中照片所需的参数
  845. m_MsrThreadWrapper.SetHoleImagePreview(HoleID, c_DomainMessure);
  846. StartSampleHoleImageBGWorkThread();
  847. }
  848. #endregion
  849. private void rbRecover_Click(object sender, EventArgs e)
  850. {
  851. //关闭所有内容
  852. CloseAllContents();
  853. //显示样品属性窗口与树结构窗口
  854. m_SolutionWindows.Show(dockPanel, DockState.DockLeft);
  855. m_SPropertyWindows.Show(dockPanel);
  856. //显示样品台窗口 测量状态与测量结果窗口
  857. m_SamplepaceWindow.Show(dockPanel);
  858. m_MessureStatuWindow.Show(dockPanel);
  859. m_MeasureRetWindow.Show(dockPanel);
  860. //此处将在父窗体选项卡上显示
  861. foreach (Form child in this.MdiChildren)
  862. {
  863. if (child.Name == "OTSSamplespaceWindow")
  864. {
  865. child.Activate();
  866. break;
  867. }
  868. }
  869. }
  870. private void CloseAllContents()
  871. {
  872. m_SolutionWindows.DockPanel = null;
  873. m_SPropertyWindows.DockPanel = null;
  874. m_SamplepaceWindow.DockPanel = null;
  875. m_MessureStatuWindow.DockPanel = null;
  876. m_MeasureRetWindow.DockPanel = null;
  877. CloseAllDocuments();
  878. }
  879. private void CloseAllDocuments()
  880. {
  881. if (dockPanel.DocumentStyle == DocumentStyle.SystemMdi)
  882. {
  883. foreach (Form form in MdiChildren)
  884. form.Close();
  885. }
  886. else
  887. {
  888. IDockContent[] documents = dockPanel.DocumentsToArray();
  889. foreach (IDockContent content in documents)
  890. content.DockHandler.Close();
  891. }
  892. }
  893. private void rbMeasureCircle_Click(object sender, EventArgs e)
  894. {
  895. m_ProjParam.SetMeasureAreaShape((int)ShapeType.CIRCUL);
  896. //修改工作样品的测量区域为圆形
  897. m_SamplepaceWindow.changeShape((int)ShapeType.CIRCUL);
  898. }
  899. private void rbMeasureRectangle_Click(object sender, EventArgs e)
  900. {
  901. m_ProjParam.SetMeasureAreaShape((int)ShapeType.RECTANGLE);
  902. //修改工作样品的测量区域为矩形
  903. m_SamplepaceWindow.changeShape((int)ShapeType.RECTANGLE);
  904. }
  905. //ctrl+s组合键进行保存
  906. private void OTSIncAMeasureAppForm_KeyDown(object sender, KeyEventArgs e)
  907. {
  908. if (e.KeyCode == Keys.S && e.Modifiers == Keys.Control)
  909. {
  910. bool iRev = m_ProjData.Save();
  911. if (!iRev)
  912. {
  913. log.Error("(OTSIncAMeasureAppForm.rbSaveFile_Click) m_DataMgrFun.SaveFile() Failed !");
  914. return;
  915. }
  916. log.Error("(OTSIncAMeasureAppForm.rbSaveAs_Click) m_DataMgrFun.SaveFile() Success !");
  917. }
  918. }
  919. private void rbSTDEdit_Click_1(object sender, EventArgs e)
  920. {
  921. OpenFileDialog openFileDialog = new OpenFileDialog();
  922. openFileDialog.Filter = "(*.db)|*.db";
  923. openFileDialog.InitialDirectory = Application.StartupPath + "\\Config\\SysData\\";
  924. openFileDialog.RestoreDirectory = true;
  925. openFileDialog.FilterIndex = 1;
  926. if (openFileDialog.ShowDialog() == DialogResult.OK)
  927. {
  928. try
  929. {
  930. System.Diagnostics.Process p = System.Diagnostics.Process.Start(".\\OTSPartA_STDEditor.exe", openFileDialog.FileName);
  931. p.WaitForExit();
  932. }
  933. catch (Exception ex)
  934. {
  935. log.Error("OTSPartA_STDEditor:" + ex.ToString());
  936. }
  937. }
  938. }
  939. private void ribPolygon_Click(object sender, EventArgs e)
  940. {
  941. //修改工作样品的测量区域为矩形
  942. m_SamplepaceWindow.Rev_DDrawPolygonMeasure_MeasureAppToSampleWindow_Event();
  943. }
  944. private void rbReClassify_Click(object sender, EventArgs e)
  945. {
  946. if (m_ProjData.Reclassify())
  947. {
  948. m_ProjData.Save();
  949. MessageBox.Show("reclassification success");
  950. }
  951. else
  952. {
  953. MessageBox.Show("reclassification failed");
  954. }
  955. }
  956. /// <summary>
  957. /// 打开测量项目文件
  958. /// </summary>
  959. private void OpenMeasureProjectFile()
  960. {
  961. bool bOpenFlag=false;
  962. COTSMsrPrjResultData ProjDataMgr = new COTSMsrPrjResultData();
  963. if (ProjDataMgr.Load())
  964. {
  965. m_ProjParam.m_ResultData = ProjDataMgr;
  966. m_ProjParam.InitResultData();
  967. m_ProjData = ProjDataMgr;
  968. bOpenFlag = true;
  969. }
  970. if (bOpenFlag)
  971. {
  972. if (!DisplayExistSampleFile())
  973. {
  974. log.Error("(OTSIncAMeasureAppForm.rbOpen_Click) OpenExistSampleFile() = false Failed !");
  975. return;
  976. }
  977. m_RibbonFun.SetAllRibbonButnStatus(true);
  978. }
  979. else
  980. {
  981. log.Error("(OTSIncAMeasureAppForm.rbOpen_Click) m_DataMgrFun.OpenExistSampleFile() Failed !");
  982. }
  983. }
  984. private void OTSIncAMeasureAppForm_FormClosed(object sender, FormClosedEventArgs e)
  985. {
  986. }
  987. private void rbAbout_Click(object sender, EventArgs e)
  988. {
  989. About m_about = new About();
  990. m_about.ShowDialog();
  991. }
  992. }
  993. }