OTSIncAMeasureAppForm.cs 45 KB

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