OTSIncAMeasureAppForm.cs 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224
  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. if (m_ProjParam.m_ResultData.m_nPackId.ToString() == "IncA")
  428. {
  429. this.Text = str + " -- Inclusion Analysis System";
  430. }
  431. else if (m_ProjParam.m_ResultData.m_nPackId.ToString() == "CleanlinessA")
  432. {
  433. this.Text = str + " -- Cleanliness Analysis System";
  434. }
  435. }
  436. if ("" == sWSampleName)
  437. {
  438. log.Error("(OTSIncAMeasureAppForm.OpenExistSampleFile) m_DataMgrFun.GetWorkSampleName() = null Failed !");
  439. return false;
  440. }
  441. m_SamplepaceWindow.Rev_MeasureApp_OpenExistSampleFile_Event(m_ProjData.GetStage(), m_ProjData.GetSEMStageData(), SampleMeasureAreaList, sWSampleName);
  442. return true;
  443. }
  444. public bool OpenExistSampleMeasureArea(ref List<SampleMeasurePara> SampleMeasureAreaList)
  445. {
  446. int iSListCount = m_ProjData.GetSampleList().Count;
  447. if (0 == iSListCount)
  448. {
  449. return false;
  450. }
  451. for (int i = 0; i < iSListCount; i++)
  452. {
  453. SampleMeasurePara SampleMeasureArea = new SampleMeasurePara();
  454. //获取样品的测量区域信息
  455. //获取样品名称
  456. SampleMeasureArea.sSampleName = (m_ProjData.GetSampleList())[i].GetName();
  457. // 获取测量区域形状
  458. SampleMeasureArea.iShape = (int)(m_ProjData.GetSampleList())[i].GetMsrArea().GetShape();
  459. //获取样品孔名称
  460. SampleMeasureArea.sHoleName = (m_ProjData.GetSampleList())[i].GetSampleHoleName();
  461. //样品测量区域
  462. SampleMeasureArea.MeasureRect = (Rectangle)(m_ProjData.GetSampleList())[i].GetMsrArea().GetRectDomain();
  463. //多边形点集合
  464. SampleMeasureArea.PolygonPointRegion = (m_ProjData.GetSampleList())[i].GetMsrArea().GetPolygonPoint();
  465. List<PointF> PointRegionF = new List<PointF>();
  466. List<Point> PolygonPoint = m_ProjData.GetSampleList()[i].GetMsrArea().GetPolygonPoint();
  467. if (PolygonPoint != null)
  468. {
  469. foreach (var item in m_ProjData.GetSampleList()[i].GetMsrArea().GetPolygonPoint())
  470. {
  471. PointRegionF.Add(new PointF(item.X, item.Y));
  472. }
  473. }
  474. SampleMeasureArea.PolygonPointRegionF = PointRegionF;
  475. SampleMeasureArea.DrawPolygonPointRegionF = PointRegionF;
  476. SampleMeasureAreaList.Add(SampleMeasureArea);
  477. }
  478. return true;
  479. }
  480. //打开指定路径的文件
  481. private void rbOpen_Click(object sender, EventArgs e)
  482. {
  483. OpenMeasureProjectFile();
  484. }
  485. private void rbDeleteSample_Click(object sender, EventArgs e)
  486. {
  487. //删除样品(样品必须先选中)
  488. string sWSampleName = m_ProjParam.GetWorkSampleName();
  489. if ("" == sWSampleName)
  490. {
  491. log.Error("(OTSIncAMeasureAppForm.rbDeleteSample_Click) m_DataMgrFun.GetWorkSampleName() = null Failed");
  492. return;
  493. }
  494. string message = table["message5"].ToString();
  495. string message6 = table["message6"].ToString();
  496. string sDeleteSampleName = message;
  497. sDeleteSampleName += sWSampleName;
  498. sDeleteSampleName += message6;
  499. if (DialogResult.OK == MessageBox.Show(sDeleteSampleName, "Tip", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning))
  500. {
  501. //删除样品成功
  502. if (!this.DeleteSample(sWSampleName))
  503. {
  504. log.Error("(OTSIncAMeasureAppForm.rbDeleteSample_Click) DeleteSample(sWSampleName) = false Failed, sWSampleName = " + sWSampleName);
  505. return;
  506. }
  507. //m_MeasureRetWindow.SetInit();
  508. sWSampleName = m_ProjParam.GetWorkSampleName();
  509. if ("" == sWSampleName)
  510. {
  511. log.Error("(OTSIncAMeasureAppForm.rbDeleteSample_Click) m_DataMgrFun.GetWorkSampleName() = null Failed");
  512. return;
  513. }
  514. m_SolutionWindows.m_TreeViewBase.GetTreeWorkSampleNode(sWSampleName);
  515. m_SolutionWindows.treeView1.Focus();
  516. }
  517. }
  518. //返回删除的工作样品名
  519. public bool DeleteSample(string sDeleteWSampleName = "")
  520. {
  521. if (!m_ProjParam.DeleteWorkSample(sDeleteWSampleName))
  522. {
  523. log.Error("(OTSIncAMeasureAppForm.DeleteSample) m_DataMgrFun.DeleteWorkSample(sDeleteWSampleName) Failed, sDeleteWSampleName = " + sDeleteWSampleName);
  524. //return false;
  525. }
  526. // 设置 开始 ,停止 和检查参数 按钮状态
  527. m_RibbonFun.SetMeasureRibbonButnStatu();
  528. //设置 删除,复位,圆形,矩形 按钮状态
  529. m_RibbonFun.SetSampleRibbonButnStatus();
  530. // 更新报告ribbon按钮状态
  531. m_RibbonFun.SetAllRibbonButnStatus(true);
  532. int iSampleCount = m_ProjParam.GetSampleCount();
  533. if (0 == iSampleCount)
  534. {
  535. //给工作样品台发送删除样品和新的工作样品名称
  536. m_SamplepaceWindow.Rev_MeasureApp_DeleteWorkSample_Event(sDeleteWSampleName, "");
  537. //清空样品对象列表
  538. if (OTSSamplespaceWindow.m_SampleGDIObjects != null)
  539. {
  540. //清空样品台窗口中样品、测量区域、帧图、照片位置对象列表
  541. OTSSamplespaceWindow.m_SampleGDIObjects.Clear();
  542. OTSSamplespaceWindow.m_MeasureGDIObjects.Clear();
  543. OTSSamplespaceWindow.m_MeasurePathGDIObjects.Clear();
  544. m_SamplepaceWindow.ClearImageAndSingleGDIObjects();
  545. }
  546. //样品全部删除完,将Treeview 和Grid 显示内容清空
  547. m_SPropertyWindows.PropGrid.Hide();
  548. m_SolutionWindows.treeView1.Nodes.Clear();
  549. m_MessureStatuWindow.HideXRayTable();
  550. m_MeasureRetWindow.SetInit();
  551. return true;
  552. }
  553. //获取新工作样品名称
  554. string sNewWSName = m_ProjParam.GetWorkSampleName();
  555. if ("" == sNewWSName)
  556. {
  557. log.Error("(OTSIncAMeasureAppForm.DeleteSample) m_DataMgrFun.GetWorkSampleName() = null Failed");
  558. return true;
  559. }
  560. //获取新的工作样品属性值
  561. OTSSamplePropertyInfo SMInfo = new OTSSamplePropertyInfo();
  562. if (!m_ProjParam.GetWorkSamplePerameter(m_ProjParam.GetWorkSample(), ref SMInfo))
  563. {
  564. log.Error("(OTSIncAMeasureAppForm.DeleteSample) m_DataMgrFun.GetSamplePropertyVal(m_DataMgrFun.GetWorkSample(),ref SMInfo) = false Failed");
  565. return false;
  566. }
  567. //给SolutionWindow 发送新的工作样品名称
  568. m_SolutionWindows.Rev_MeasureApp_DeletSample_Event(m_ProjParam.GetWorkSampleName());
  569. //给工作样品台发送删除样品和新的工作样品名称
  570. m_SamplepaceWindow.Rev_MeasureApp_DeleteWorkSample_Event(sDeleteWSampleName, sNewWSName);
  571. // MeasureApp 窗口给 OTSPropertyWindow窗口 Grid显示的样品属性信息
  572. m_SPropertyWindows.DisplaySampleMeasureInfo(SMInfo);
  573. return true;
  574. }
  575. private void rbAddSample_Click(object sender, EventArgs e)
  576. {
  577. this.AddNewSampleMeasure();//the system will choose the empty hole one by one according to the holeNo sequence.
  578. }
  579. public void AddNewSampleMeasure(string sSampleHoleName = "")
  580. {
  581. //样品的属性值
  582. OTSSamplePropertyInfo SamplePropParam ;
  583. SamplePropParam = m_ProjParam.AddNewSampleMeasure(sSampleHoleName);
  584. if (null == SamplePropParam)
  585. {
  586. // 设置 开始 ,停止 和检查参数 按钮状态
  587. m_RibbonFun.SetMeasureRibbonButnStatu();
  588. log.Error("(OTSIncAMeasureAppForm.AddNewSample) m_DataMgrFun.AddNewSample(sSampleHoleName) = null ");
  589. return;
  590. }
  591. m_SPropertyWindows.TSSaveAs.Enabled = true;
  592. m_SPropertyWindows.TSLoad.Enabled = true;
  593. //给SampleWindow 发送样品信息
  594. OTSSamplePropertyInfo SMInfo = SamplePropParam;
  595. m_SamplepaceWindow.AddOneSampleArea(SMInfo.SMeasurePara);
  596. //给PropWindow 发送工作样品属性信息
  597. m_SPropertyWindows.DisplaySampleMeasureInfo(SMInfo);
  598. //给SoluWindow 发送样品显示信息
  599. m_SolutionWindows.AddSampleMeasure(SMInfo.TSampleParam);
  600. // 设置 开始 ,停止 和检查参数 按钮状态
  601. m_RibbonFun.SetMeasureRibbonButnStatu();
  602. //设置 删除,复位,圆形,矩形 按钮状态
  603. m_RibbonFun.SetSampleRibbonButnStatus();
  604. //清空帧图信息
  605. m_MessageStates = (int)MessageState.StartMeasure;
  606. m_SamplepaceWindow.ClearImageAndSingleGDIObjects();
  607. m_SamplepaceWindow.Invalidate();
  608. }
  609. private void rbSelectDlg_Click(object sender, EventArgs e)
  610. {
  611. //判断样品台是否有样品,如果有样品则不能设置默认参数
  612. if (m_ProjParam.GetSampleCount() > 0)
  613. {
  614. MessageBox.Show("Cann't setup preference parameter,for you have added some samples!");
  615. return;
  616. }
  617. ProgMgrInfoForm ProgMgrForm = new ProgMgrInfoForm();
  618. if (DialogResult.OK == ProgMgrForm.ShowDialog())
  619. {
  620. //m_DataMgrFun.SetSysPartSTDData(ProgMgrForm.GetCPartSTDDataClr());
  621. //检查\\Config\\SysData 是否有OTSProgMgrParam.pmf文件
  622. if (m_ProjParam.LoadParamFile() && m_ProjParam.LoadStageParamFile())
  623. {
  624. //检查\\Config\\SysData 是否有OTSProgMgrParam.pmf文件
  625. if (m_ProjParam.InitResultData())
  626. {
  627. m_RibbonFun.SetAllRibbonButnStatus(true);
  628. //当样品台上有样品,则不更新样品台数据
  629. if (0 == m_ProjParam.GetSampleCount())
  630. {
  631. //通过委托事件将样品台数据发送给SamplespaceWindwo
  632. m_SamplepaceWindow.InitStageDisplay(m_ProjData.GetStage(), m_ProjData.GetSEMStageData());
  633. }
  634. }
  635. else
  636. {
  637. log.Error("(OTSIncAMeasureAppForm.rbSelectDlg_Click) this.CheckMeasureSysFileExist() = false");
  638. }
  639. }
  640. else
  641. {
  642. log.Error("(OTSIncAMeasureAppForm.rbSelectDlg_Click) (m_DataMgrFun.CheckParamFile() && m_DataMgrFun.CheckStageFile()) = false");
  643. }
  644. }
  645. }
  646. // 主Windows框右下角显示鼠标点的SEM坐标(样品台)
  647. public void ShowSemCoordvAL(string sSemCoord)
  648. {
  649. STSemCoordinate.Text = sSemCoord;
  650. // TSGrayVal.Text = sGrayVal;
  651. statusStrip1.Refresh();
  652. }
  653. //// 主Windows框右下角显示鼠标点的灰度值(测量图)
  654. public void ShowGrayVal(string sGrayVal)
  655. {
  656. TSGrayVal.Text = sGrayVal;
  657. statusStrip1.Refresh();
  658. }
  659. //获取工作样品测量锁
  660. public bool GetWorkSampleParamLock(ref CTreeSampleParam TSParamLock)
  661. {
  662. OTSSamplePropertyInfo SMInfo = new OTSSamplePropertyInfo();
  663. if (!m_ProjParam.GetWSampleParaLock(ref SMInfo))
  664. {
  665. return false;
  666. }
  667. TSParamLock = SMInfo.TSampleParam;
  668. return true;
  669. }
  670. /// <summary>
  671. /// 更新属性窗口
  672. /// </summary>
  673. public void UpdatePropertyVal()
  674. {
  675. //获取新的工作样品属性值
  676. OTSSamplePropertyInfo SMInfo = new OTSSamplePropertyInfo();
  677. if (!m_ProjParam.GetWorkSamplePerameter(m_ProjParam.GetWorkSample(), ref SMInfo))
  678. {
  679. log.Error("(OTSIncAMeasureAppForm.SetSEMData) m_DataMgrFun.GetSamplePropertyVal(m_DataMgrFun.GetWorkSample(),ref SMInfo) = false Failed");
  680. }
  681. // MeasureApp 窗口给 OTSPropertyWindow窗口 Grid显示的样品属性信息
  682. m_SPropertyWindows.DisplaySampleMeasureInfo(SMInfo);
  683. }
  684. //获取BSE图
  685. //int iWidth: 宽
  686. //int iHeigh: 高
  687. //byte bImageData: 图像数据
  688. //返回 图像数据长度 = iWidth*iHeigh
  689. //bool bSimulatFlag : True 仿真状态
  690. public int GetImageData(int iWidth, int iHeight, ref byte[] ImageData, bool bSimulatFlag = false)
  691. {
  692. //获取BSE图片数据
  693. OTSBSEImageFun m_GetBseImage = new OTSBSEImageFun();
  694. return m_GetBseImage.GetScanImage(iWidth, iHeight, ref ImageData);
  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. }
  1000. }