OTSIncAMeasureAppForm.cs 45 KB

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