OTSIncAMeasureAppForm.cs 46 KB

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