OTSIncAMeasureAppForm.cs 45 KB

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