OTSIncAMeasureAppForm.cs 45 KB

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