FormHOZMain.cs 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158
  1. using FileManager;
  2. using MeasureData;
  3. using MeasureThread;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.ComponentModel;
  7. using System.Configuration;
  8. using System.Data;
  9. using System.Drawing;
  10. using System.Drawing.Drawing2D;
  11. using System.IO;
  12. using System.Linq;
  13. using System.Runtime.InteropServices;
  14. using System.Text;
  15. using System.Threading.Tasks;
  16. using System.Windows.Forms;
  17. using static MeasureThread.ThreadStatusEventArgs;
  18. namespace HOZProject
  19. {
  20. public partial class FormHOZMain : Form
  21. {
  22. #region 控制窗体可以调整大小用
  23. const int HTLEFT = 10;
  24. const int HTRIGHT = 11;
  25. const int HTTOP = 12;
  26. const int HTTOPLEFT = 13;
  27. const int HTTOPRIGHT = 14;
  28. const int HTBOTTOM = 15;
  29. const int HTBOTTOMLEFT = 0x10;
  30. const int HTBOTTOMRIGHT = 17;
  31. protected override void WndProc(ref Message m)
  32. {
  33. switch (m.Msg)
  34. {
  35. case 0x0084:
  36. base.WndProc(ref m);
  37. Point vPoint = new Point((int)m.LParam & 0xFFFF,
  38. (int)m.LParam >> 16 & 0xFFFF);
  39. vPoint = PointToClient(vPoint);
  40. if (vPoint.X <= 5)
  41. if (vPoint.Y <= 5)
  42. m.Result = (IntPtr)HTTOPLEFT;
  43. else if (vPoint.Y >= ClientSize.Height - 5)
  44. m.Result = (IntPtr)HTBOTTOMLEFT;
  45. else m.Result = (IntPtr)HTLEFT;
  46. else if (vPoint.X >= ClientSize.Width - 5)
  47. if (vPoint.Y <= 5)
  48. m.Result = (IntPtr)HTTOPRIGHT;
  49. else if (vPoint.Y >= ClientSize.Height - 5)
  50. m.Result = (IntPtr)HTBOTTOMRIGHT;
  51. else m.Result = (IntPtr)HTRIGHT;
  52. else if (vPoint.Y <= 5)
  53. m.Result = (IntPtr)HTTOP;
  54. else if (vPoint.Y >= ClientSize.Height - 5)
  55. m.Result = (IntPtr)HTBOTTOM;
  56. break;
  57. case 0x0201://鼠标左键按下的消息
  58. m.Msg = 0x00A1;//更改消息为非客户区按下鼠标
  59. m.LParam = IntPtr.Zero;//默认值
  60. m.WParam = new IntPtr(2);//鼠标放在标题栏内
  61. base.WndProc(ref m);
  62. break;
  63. default:
  64. base.WndProc(ref m);
  65. break;
  66. }
  67. }
  68. #endregion
  69. #region 成员变量
  70. private NLog.Logger log;
  71. /// <summary>
  72. /// 控制闪烁
  73. /// </summary>
  74. public static bool ControlFlicker;//控制流程闪烁
  75. public BackgroundWorker m_BackgroundWorker;// 申明后台对象
  76. /// <summary>
  77. /// 测量文件
  78. /// </summary>
  79. public MeasureFile m_MeasureFile;
  80. /// 测量线程
  81. public Measure m_Ms;
  82. /// <summary>
  83. /// 显示日志窗体
  84. /// </summary>
  85. Form m_FormLog = null;
  86. /// <summary>
  87. /// 显示实例化窗体
  88. /// </summary>
  89. FormMove m_FormInit = null;
  90. /// <summary>
  91. /// 是否已保存
  92. /// </summary>
  93. public bool IsSave = false;
  94. /// <summary>
  95. /// 初始化用户控件
  96. /// </summary>
  97. UControl_Init uControl_Init = null;
  98. /// <summary>
  99. /// 日志用户控件
  100. /// </summary>
  101. UControl_Log ucLog = null;
  102. //流程控制
  103. public int m_MeasureType = (int)MeasureMsgManage.measureType.FIB;
  104. //是否关闭窗体标识
  105. public bool IsClose = false;
  106. OTSMeasureOutputNlog logwin;
  107. Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
  108. #endregion
  109. #region 构造函数
  110. public FormHOZMain()
  111. {
  112. InitializeComponent();
  113. //在线程操作过程中,可以设置控件属性
  114. Control.CheckForIllegalCrossThreadCalls = false;
  115. m_BackgroundWorker = new BackgroundWorker(); // 实例化后台对象
  116. m_BackgroundWorker.WorkerReportsProgress = true; // 设置可以通告进度
  117. m_BackgroundWorker.WorkerSupportsCancellation = true; // 设置可以取消
  118. m_BackgroundWorker.DoWork += new DoWorkEventHandler(DoWork);
  119. m_BackgroundWorker.ProgressChanged += new ProgressChangedEventHandler(UpdateProgress);
  120. m_BackgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(CompletedWork);
  121. //LogManager.InitManulLog();
  122. }
  123. #endregion
  124. #region 测量线程
  125. void DoWork(object sender, DoWorkEventArgs e)
  126. {
  127. try
  128. {
  129. m_Ms = new Measure(ConfigurationManager.AppSettings["WebServerIP"].ToString(),
  130. ConfigurationManager.AppSettings["WebServerPort"].ToString(),
  131. ConfigurationManager.AppSettings["WebServerUrl"].ToString());
  132. m_MeasureFile.MParam.AutoFocus.UP = Convert.ToSingle(ConfigurationManager.AppSettings["Focus_UP"].ToString());
  133. m_MeasureFile.MParam.AutoFocus.Down = Convert.ToSingle(ConfigurationManager.AppSettings["Focus_Down"].ToString());
  134. m_MeasureFile.MParam.AutoFocus.Step = Convert.ToSingle(ConfigurationManager.AppSettings["Focus_Step"].ToString());
  135. m_MeasureFile.MParam.AutoFocus.Range = Convert.ToSingle(ConfigurationManager.AppSettings["Focus_Range"].ToString());
  136. m_MeasureFile.MParam.AutoFocus.fStep = Convert.ToSingle(ConfigurationManager.AppSettings["Focus_FStep"].ToString());
  137. m_MeasureFile.MParam.FIBFocus.UP = Convert.ToSingle(ConfigurationManager.AppSettings["FIB_UP"].ToString());
  138. m_MeasureFile.MParam.FIBFocus.Down = Convert.ToSingle(ConfigurationManager.AppSettings["FIB_Down"].ToString());
  139. m_MeasureFile.MParam.FIBFocus.Step = Convert.ToSingle(ConfigurationManager.AppSettings["FIB_Step"].ToString());
  140. m_MeasureFile.MParam.FIBFocus.Range = Convert.ToSingle(ConfigurationManager.AppSettings["FIB_Range"].ToString());
  141. m_MeasureFile.MParam.FIBFocus.fStep = Convert.ToSingle(ConfigurationManager.AppSettings["FIB_FStep"].ToString());
  142. m_MeasureFile.MParam.AutoStigX.UP = Convert.ToSingle(ConfigurationManager.AppSettings["StigX_UP"].ToString());
  143. m_MeasureFile.MParam.AutoStigX.Down = Convert.ToSingle(ConfigurationManager.AppSettings["StigX_Down"].ToString());
  144. m_MeasureFile.MParam.AutoStigX.Step = Convert.ToSingle(ConfigurationManager.AppSettings["StigX_Step"].ToString());
  145. m_MeasureFile.MParam.AutoStigX.Range = Convert.ToSingle(ConfigurationManager.AppSettings["StigX_Range"].ToString());
  146. m_MeasureFile.MParam.AutoStigX.fStep = Convert.ToSingle(ConfigurationManager.AppSettings["StigX_FStep"].ToString());
  147. m_MeasureFile.MParam.AutoStigY.UP = Convert.ToSingle(ConfigurationManager.AppSettings["StigY_UP"].ToString());
  148. m_MeasureFile.MParam.AutoStigY.Down = Convert.ToSingle(ConfigurationManager.AppSettings["StigY_Down"].ToString());
  149. m_MeasureFile.MParam.AutoStigY.Step = Convert.ToSingle(ConfigurationManager.AppSettings["StigY_Step"].ToString());
  150. m_MeasureFile.MParam.AutoStigY.Range = Convert.ToSingle(ConfigurationManager.AppSettings["StigY_Range"].ToString());
  151. m_MeasureFile.MParam.AutoStigY.fStep = Convert.ToSingle(ConfigurationManager.AppSettings["StigY_FStep"].ToString());
  152. m_MeasureFile.MParam.FIBDo= Convert.ToBoolean(ConfigurationManager.AppSettings["Is_FIBDo"]);
  153. m_MeasureFile.MParam.FIBAutoBC = Convert.ToBoolean(ConfigurationManager.AppSettings["Is_FIBAutoBc"]);
  154. m_MeasureFile.MParam.FIBB = Convert.ToSingle(ConfigurationManager.AppSettings["FIBB"]);
  155. m_MeasureFile.MParam.FIBC = Convert.ToSingle(ConfigurationManager.AppSettings["FIBC"]);
  156. m_MeasureFile.MParam.MagComp = Convert.ToBoolean(ConfigurationManager.AppSettings["MagComp"]);
  157. m_MeasureFile.MParam.MagRange1 = Convert.ToSingle(ConfigurationManager.AppSettings["MagRange1"]);
  158. m_MeasureFile.MParam.MagRange2 = Convert.ToSingle(ConfigurationManager.AppSettings["MagRange2"]);
  159. m_MeasureFile.MParam.MagRange3 = Convert.ToSingle(ConfigurationManager.AppSettings["MagRange3"]);
  160. m_MeasureFile.MParam.MagCompX1 = Convert.ToSingle(ConfigurationManager.AppSettings["MagCompX1"]);
  161. m_MeasureFile.MParam.MagCompX2 = Convert.ToSingle(ConfigurationManager.AppSettings["MagCompX2"]);
  162. m_MeasureFile.MParam.MagCompX3 = Convert.ToSingle(ConfigurationManager.AppSettings["MagCompX3"]);
  163. m_MeasureFile.MParam.MagCompY1 = Convert.ToSingle(ConfigurationManager.AppSettings["MagCompY1"]);
  164. m_MeasureFile.MParam.MagCompY2 = Convert.ToSingle(ConfigurationManager.AppSettings["MagCompY2"]);
  165. m_MeasureFile.MParam.MagCompY3 = Convert.ToSingle(ConfigurationManager.AppSettings["MagCompY3"]);
  166. m_Ms.X_Min = Convert.ToSingle(ConfigurationManager.AppSettings["X_Min"]);
  167. m_Ms.X_Max = Convert.ToSingle(ConfigurationManager.AppSettings["X_Max"]);
  168. m_Ms.Y_Min = Convert.ToSingle(ConfigurationManager.AppSettings["Y_Min"]);
  169. m_Ms.Y_Max = Convert.ToSingle(ConfigurationManager.AppSettings["Y_Max"]);
  170. m_Ms.Z_Min = Convert.ToSingle(ConfigurationManager.AppSettings["Z_Min"]);
  171. m_Ms.Z_Max = Convert.ToSingle(ConfigurationManager.AppSettings["Z_Max"]);
  172. m_Ms.T_Min = Convert.ToSingle(ConfigurationManager.AppSettings["T_Min"]);
  173. m_Ms.T_Max = Convert.ToSingle(ConfigurationManager.AppSettings["T_Max"]);
  174. m_Ms.R_Min = Convert.ToSingle(ConfigurationManager.AppSettings["R_Min"]);
  175. m_Ms.R_Max = Convert.ToSingle(ConfigurationManager.AppSettings["R_Max"]);
  176. m_Ms.M_Min = Convert.ToSingle(ConfigurationManager.AppSettings["M_Min"]);
  177. m_Ms.M_Max = Convert.ToSingle(ConfigurationManager.AppSettings["M_Max"]);
  178. //人工干预
  179. m_Ms.hand_intervene = Convert.ToInt32(ConfigurationManager.AppSettings["Hand_Intervene"]);
  180. //SmartSEM远程路径
  181. m_Ms.RemoteELYPath = ConfigurationManager.AppSettings["RemoteELYPath"];
  182. m_Ms.RemoteMLFPath = ConfigurationManager.AppSettings["RemoteMLFPath"];
  183. //Z轴移动距离
  184. m_MeasureFile.MParam.ZDistance= Convert.ToSingle(ConfigurationManager.AppSettings["ZDistance"]);
  185. //add by sun 2020-12-15 增加不同样品扫描速度参数
  186. m_MeasureFile.MParam.ScanSpeedNormal = Convert.ToString(ConfigurationManager.AppSettings["ScanSpeedNormal_" + m_MeasureFile.MParam.SampleName]);
  187. m_MeasureFile.MParam.ScanSpeedFocus = Convert.ToString(ConfigurationManager.AppSettings["ScanSpeedFocus_" + m_MeasureFile.MParam.SampleName]);
  188. m_MeasureFile.MParam.ScanSpeedHigh = Convert.ToString(ConfigurationManager.AppSettings["ScanSpeedHigh_" + m_MeasureFile.MParam.SampleName]);
  189. //log.Info("==============="+ ConfigurationManager.AppSettings["ScanSpeedNormal_3"] + "========="+ m_MeasureFile.MParam.SampleName, true);
  190. //add by sun 2020-12-15 增加不同样品扫描速度参数 end
  191. //add by sun 2020-12-17 增加调试时是否切割开关
  192. m_MeasureFile.MParam.IsCutingForDebug = Convert.ToBoolean(ConfigurationManager.AppSettings["IsCutingForDebug"]);
  193. //add by sun 2020-12-17 增加调试时是否切割开关 end
  194. // add by zjx 2020-12-18 为了测试只做能谱部分
  195. m_MeasureFile.MParam.IsonlyEDSForDebug = Convert.ToBoolean(ConfigurationManager.AppSettings["IsonlyEDSForDebug"]);
  196. // add by zjx 2020-12-18 为了测试只做能谱部分 end
  197. m_Ms.InitMeas(m_MeasureFile);
  198. //注册事件
  199. m_Ms.SendThreadStatus += new ThreadStatusHandler(displayMessage);
  200. //注册事件
  201. m_Ms.SendCutHolesStatus += new CutHolesStatusHandler(displayCutHoleMessage);
  202. //设置控件操作
  203. SetWinControlMeasureState(false);
  204. //自动测量的全过程
  205. m_Ms.DoMeasure();
  206. }
  207. catch (Exception ex)
  208. {
  209. log.Error(ex.ToString(),false);
  210. }
  211. }
  212. public void displayMessage(object sender, ThreadStatusEventArgs e)
  213. {
  214. //主界面显示内容
  215. this.BeginInvoke((Action)delegate
  216. {
  217. this.listmsg.Items.Add(e.HoleName +"_" + e.Time.ToString() + "_"+ e.Message + "_" + e.State );
  218. //显示流程中对应编号的内容
  219. MeasureMsgManage.ShowMsgContent(this, e);
  220. AddLogListInfo(e);
  221. });
  222. }
  223. public void displayCutHoleMessage(object sender, CutHolesStatusEventArgs e)
  224. {
  225. //主界面显示内容
  226. this.BeginInvoke((Action)delegate
  227. {
  228. //修改切孔状态
  229. ChangeCutHoleState(e.HoleName.ToString(), Convert.ToInt32(e.State));
  230. });
  231. }
  232. void UpdateProgress(object sender, ProgressChangedEventArgs e)
  233. {
  234. }
  235. void CompletedWork(object sender, RunWorkerCompletedEventArgs e)
  236. {
  237. ControlFlicker = false;
  238. //设置控件操作
  239. MessageBox.Show("测量已完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  240. SetWinControlMeasureState(true);
  241. pbStop.Visible = false;
  242. pbStart.Visible = true;
  243. //UControl_ParaInfo uControl_ParaInfo=new UControl_ParaInfo()
  244. UControl_ParaInfo uControl_ParaInfo = new UControl_ParaInfo(this);
  245. uControl_ParaInfo.pbMeasure.Value = 100;
  246. uControl_ParaInfo.lblCompletedAmount.Text = "100%";
  247. }
  248. #endregion
  249. #region 窗体加载
  250. private void FormHOZMain_Load(object sender, EventArgs e)
  251. {
  252. //加载控件的点击事件
  253. this.Click += new EventHandler(FormHOZMain_Click);
  254. plFill.Click += new EventHandler(FormHOZMain_Click);
  255. plTop.Click += new EventHandler(FormHOZMain_Click);
  256. plLeft.Click += new EventHandler(FormHOZMain_Click);
  257. plLeftContent.Click += new EventHandler(FormHOZMain_Click);
  258. pbImage.Click += new EventHandler(FormHOZMain_Click);
  259. //加载窗口移动事件
  260. this.MouseDown += new MouseEventHandler(FormHOZMain_MouseDown);
  261. this.plTop.MouseDown += new MouseEventHandler(FormHOZMain_MouseDown);
  262. //新建
  263. NewCreate();
  264. //实例初始化窗体对象
  265. if (uControl_Init == null)
  266. {
  267. uControl_Init = new UControl_Init(this);
  268. uControl_Init.ReloadConfig();
  269. }
  270. logwin = new OTSMeasureOutputNlog();
  271. logwin.Show();
  272. NLog.Config.LoggingRule lr = NLog.LogManager.Configuration.LoggingRules.FirstOrDefault(
  273. r => r.Targets.Any(
  274. t => "control" == t.Name
  275. )
  276. );
  277. if (lr != null)
  278. {
  279. }
  280. log = NLog.LogManager.GetCurrentClassLogger();
  281. ConfigurationParameter();
  282. }
  283. #endregion
  284. #region 创建切孔列表信息
  285. /// <summary>
  286. /// 创建切孔列表信息
  287. /// </summary>
  288. /// <param name="ListCutHole"></param>
  289. public void CreateCutHoleList(List<CutHole> ListCutHole)
  290. {
  291. //清空左侧Panel中的切孔控件
  292. ClearPanelControls();
  293. for (int i = ListCutHole.Count - 1; i >= 0; i--)
  294. {
  295. UControl_CutHole ucCutHole = new UControl_CutHole(this);
  296. ucCutHole.Dock = DockStyle.Top;
  297. ucCutHole.CutHoleName = ListCutHole[i].HoleName;
  298. //显示切孔参数信息
  299. if (ucCutHole.UControl_ParaInfo == null)
  300. {
  301. ucCutHole.UControl_ParaInfo = new UControl_ParaInfo(this);
  302. }
  303. plPrarInfo.Width = ucCutHole.UControl_ParaInfo.Width;
  304. plPrarInfo.Height = ucCutHole.UControl_ParaInfo.Height;
  305. //设置当前样品的参数信息
  306. string CutHoleName = ListCutHole[i].HoleName;
  307. ucCutHole.UControl_ParaInfo.Name = CutHoleName;
  308. ucCutHole.UControl_ParaInfo.CutHoleName = CutHoleName;
  309. ucCutHole.UControl_ParaInfo.Position = ListCutHole[i].Position;
  310. ucCutHole.UControl_ParaInfo.StartTime = ListCutHole[i].START.ToString();
  311. ucCutHole.UControl_ParaInfo.EndTime = ListCutHole[i].END.ToString();
  312. int state = (int)ListCutHole[i].STATE;
  313. ucCutHole.UControl_ParaInfo.State = state;
  314. ucCutHole.UControl_ParaInfo.IsSwitch = ListCutHole[i].SWITCH;
  315. ucCutHole.UControl_ParaInfo.ShowParaInfo();
  316. this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
  317. plPrarInfo.Controls.Add(ucCutHole.UControl_ParaInfo);
  318. plLeftContent.Controls.Add(ucCutHole);
  319. ChangeCutHoleState(CutHoleName, state);
  320. }
  321. plPrarInfo.Visible = false;
  322. }
  323. #endregion
  324. #region 隐藏处理层
  325. //隐藏处理层
  326. private void FormHOZMain_Click(object sender, EventArgs e)
  327. {
  328. if (plPrarInfo.Visible)
  329. {
  330. plPrarInfo.Visible = false;
  331. }
  332. }
  333. #endregion
  334. #region 设置控件在线程过程中的编辑状态
  335. /// <summary>
  336. /// 设置控件在线程过程中的编辑状态
  337. /// </summary>
  338. /// <param name="cState"></param>
  339. public void SetWinControlMeasureState(bool cState)
  340. {
  341. pbNew.Enabled = cState;
  342. pbOpen.Enabled = cState;
  343. pbSave.Enabled = cState;
  344. pbInit.Enabled = cState;
  345. pbImportTemplateFile.Enabled = cState;
  346. //pbLog.Enabled = cState;
  347. pbStart.Enabled = cState;
  348. pbStop.Enabled = !cState;
  349. //设置切孔是否执行
  350. foreach (Control item in plPrarInfo.Controls)
  351. {
  352. if (item is UserControl)
  353. {
  354. UControl_ParaInfo ucParaInfo = (UControl_ParaInfo)item;
  355. ucParaInfo.CkIsSwitch.Enabled = cState;
  356. }
  357. }
  358. }
  359. #endregion
  360. #region 窗体中 线程开始 停止 最大化 最小化 关闭 按钮事件
  361. private void pbMin_MouseEnter(object sender, EventArgs e)
  362. {
  363. this.pbMin.BackgroundImage = global::HOZProject.Properties.Resources.Min_2_;
  364. }
  365. private void pbMin_MouseLeave(object sender, EventArgs e)
  366. {
  367. this.pbMin.BackgroundImage = global::HOZProject.Properties.Resources.Min_2_;
  368. }
  369. private void pbMax_MouseEnter(object sender, EventArgs e)
  370. {
  371. this.pbMax.BackgroundImage = global::HOZProject.Properties.Resources.Max_2_;
  372. }
  373. private void pbMax_MouseLeave(object sender, EventArgs e)
  374. {
  375. this.pbMax.BackgroundImage = global::HOZProject.Properties.Resources.Max_2_;
  376. }
  377. private void pbClose_MouseEnter(object sender, EventArgs e)
  378. {
  379. this.pbClose.BackgroundImage = global::HOZProject.Properties.Resources.exit_2_;
  380. }
  381. private void pbClose_MouseLeave(object sender, EventArgs e)
  382. {
  383. this.pbClose.BackgroundImage = global::HOZProject.Properties.Resources.exit_2_;
  384. }
  385. private void pbStart_MouseEnter(object sender, EventArgs e)
  386. {
  387. //this.pbStart.BackgroundImage = global::HOZProject.Properties.Resources.StartMove;
  388. }
  389. private void pbStart_MouseLeave(object sender, EventArgs e)
  390. {
  391. //this.pbStart.BackgroundImage = global::HOZProject.Properties.Resources.Start_3_;
  392. }
  393. private void pbStop_MouseEnter(object sender, EventArgs e)
  394. {
  395. //this.pbStop.BackgroundImage = global::HOZProject.Properties.Resources.StopMove;
  396. }
  397. private void pbStop_MouseLeave(object sender, EventArgs e)
  398. {
  399. //this.pbStop.BackgroundImage = global::HOZProject.Properties.Resources.Stop;
  400. }
  401. private void pbClose_Click(object sender, EventArgs e)
  402. {
  403. try
  404. {
  405. if (m_Ms != null)
  406. {
  407. if (m_BackgroundWorker.IsBusy)
  408. {
  409. if (MessageBox.Show("当前测量正在运行,是否关闭此窗体?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
  410. {
  411. //线程停止变量
  412. m_Ms.key_stop = true;
  413. IsClose = true;
  414. lblStateMessage.Text = "正在关闭窗体...请等待";
  415. pbClose.Enabled = false;
  416. ControlFlicker = false;
  417. }
  418. return;
  419. }
  420. }
  421. if (MessageBox.Show("是否关闭此窗体?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
  422. {
  423. m_MeasureFile.Save();
  424. this.Close();
  425. }
  426. }
  427. catch (Exception ex)
  428. {
  429. log.Error(ex.Message);
  430. }
  431. }
  432. private void pbMin_Click(object sender, EventArgs e)
  433. {
  434. this.WindowState = FormWindowState.Minimized;
  435. }
  436. private void pbMax_Click(object sender, EventArgs e)
  437. {
  438. if (this.WindowState == FormWindowState.Maximized)
  439. {
  440. this.WindowState = FormWindowState.Normal;
  441. }
  442. else
  443. {
  444. this.WindowState = FormWindowState.Maximized;
  445. }
  446. //窗体据中
  447. this.StartPosition = FormStartPosition.CenterScreen;
  448. }
  449. #endregion
  450. #region 新建、保存、打开、初始化、导入配置、查看日志
  451. private void pbNew_Click(object sender, EventArgs e)
  452. {
  453. NewCreate();
  454. }
  455. private void NewCreate()
  456. {
  457. m_MeasureFile = new MeasureFile();
  458. if (!m_MeasureFile.New())
  459. {
  460. return;
  461. }
  462. else
  463. {
  464. //清空内容容器中的控件
  465. ClearPanelControls();
  466. }
  467. //实例初始化窗体对象
  468. if (uControl_Init == null)
  469. {
  470. uControl_Init = new UControl_Init(this);
  471. uControl_Init.ReloadConfig();
  472. }
  473. m_MeasureFile.MParam = uControl_Init.GetMeasureParam();
  474. }
  475. private void pbSave_Click(object sender, EventArgs e)
  476. {
  477. Saveclick();
  478. //if (m_MeasureFile == null)
  479. //{
  480. // MessageBox.Show("请新建一个测量文件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  481. //}
  482. //else
  483. //{
  484. // //保存测量文件
  485. // if (m_MeasureFile.SaveAs())
  486. // {
  487. // //获取测量文件所在路径
  488. // string savePath = m_MeasureFile.FilePath;
  489. // //数据库名称
  490. // string dbFileName = "MeasureFile.db";
  491. // //要复制的文件路径
  492. // string pLocalFilePath = Application.StartupPath +"\\"+dbFileName;
  493. // string pSaveFilePath = savePath + "\\" + dbFileName;//指定存储的路径
  494. // if (File.Exists(pLocalFilePath))//必须判断要复制的文件是否存在
  495. // {
  496. // //三个参数分别是源文件路径,存储路径,若存储路径有相同文件是否替换
  497. // File.Copy(pLocalFilePath, pSaveFilePath, true);
  498. // }
  499. // //将初始化中的参数,配置到测量参数中
  500. // m_MeasureFile.MParam = uControl_Init.GetMeasureParamInfo();
  501. // //设置已保存状态
  502. // IsSave = true;
  503. // }
  504. //}
  505. }
  506. public void Saveclick()
  507. {
  508. if (m_MeasureFile == null)
  509. {
  510. MessageBox.Show("请新建一个测量文件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  511. }
  512. else
  513. {
  514. //保存测量文件
  515. if (m_MeasureFile.SaveAs())
  516. {
  517. //获取测量文件所在路径
  518. string savePath = m_MeasureFile.FilePath;
  519. //数据库名称
  520. string dbFileName = "MeasureFile.db";
  521. //要复制的文件路径
  522. string pLocalFilePath = Application.StartupPath + "\\" + dbFileName;
  523. string pSaveFilePath = savePath + "\\" + dbFileName;//指定存储的路径
  524. if (File.Exists(pLocalFilePath))//必须判断要复制的文件是否存在
  525. {
  526. //三个参数分别是源文件路径,存储路径,若存储路径有相同文件是否替换
  527. File.Copy(pLocalFilePath, pSaveFilePath, true);
  528. }
  529. //将初始化中的参数,配置到测量参数中
  530. m_MeasureFile.MParam = uControl_Init.GetMeasureParamInfo();
  531. //设置已保存状态
  532. IsSave = true;
  533. }
  534. }
  535. }
  536. private void pbOpen_Click(object sender, EventArgs e)
  537. {
  538. try
  539. {
  540. //打开默认路径
  541. OpenFileDialog openFileDialog = new OpenFileDialog();
  542. //设置筛选文件格式
  543. openFileDialog.Filter = "测量文件(*.msf)|*.msf";
  544. if (openFileDialog.ShowDialog() == DialogResult.OK)
  545. {
  546. //读取文件
  547. string measureFileNamePath = openFileDialog.FileName;
  548. m_MeasureFile.FileName = measureFileNamePath;
  549. m_MeasureFile.Open();
  550. List<CutHole> ListCutHole = m_MeasureFile.ListCutHole;
  551. //文件路径
  552. string CutHoleFilePath = m_MeasureFile.CutHoleFilePath;
  553. CreateCutHoleList(ListCutHole);
  554. ////保存测量文件
  555. //m_MeasureFile.Save();
  556. //设置已保存状态
  557. IsSave = true;
  558. }
  559. }
  560. catch (Exception ex)
  561. {
  562. log.Error(ex.Message);
  563. }
  564. }
  565. private void pbInit_Click(object sender, EventArgs e)
  566. {
  567. if (uControl_Init == null)
  568. {
  569. uControl_Init = new UControl_Init(this);
  570. uControl_Init.ReloadConfig();
  571. }
  572. if (m_FormInit == null)
  573. {
  574. m_FormInit = new FormMove();
  575. }
  576. m_FormInit.StartPosition = FormStartPosition.CenterScreen;
  577. m_FormInit.FormBorderStyle = FormBorderStyle.None;
  578. m_FormInit.Width = uControl_Init.Width + 2;
  579. m_FormInit.Height = uControl_Init.Height + 2;
  580. if (m_FormInit.Controls.Count == 0)
  581. {
  582. uControl_Init.Location = new Point(1,1);
  583. m_FormInit.Controls.Add(uControl_Init);
  584. }
  585. m_FormInit.ShowDialog();
  586. ConfigurationParameter();
  587. }
  588. private void pictureBox1_Click(object sender, EventArgs e)
  589. {
  590. //if (UControl_ZoomIn == null)
  591. //{
  592. // UControl_ZoomIn = new UControl_ZoomIn(this);
  593. // UControl_ZoomIn.ReloadConfig();
  594. //}
  595. //if (m_FormZoomIn == null)
  596. //{
  597. // m_FormZoomIn = new FormZoomIn();
  598. //}
  599. //m_FormZoomIn.StartPosition = FormStartPosition.CenterScreen;
  600. //m_FormZoomIn.FormBorderStyle = FormBorderStyle.None;
  601. //m_FormZoomIn.Width = UControl_ZoomIn.Width + 4;
  602. //m_FormZoomIn.Height = UControl_ZoomIn.Height + 4;
  603. //if (m_FormZoomIn.Controls.Count == 0)
  604. //{
  605. // UControl_ZoomIn.Location = new Point(2, 2);
  606. // m_FormZoomIn.Controls.Add(UControl_ZoomIn);
  607. //}
  608. //m_FormZoomIn.ShowDialog();
  609. }
  610. private void pbImportTemplateFile_Click(object sender, EventArgs e)
  611. {
  612. Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
  613. string m_TemplateFilePath = config.AppSettings.Settings["TemplateFilePath"].Value.ToString();
  614. //判断保存的路径是否存在
  615. if (!Directory.Exists(m_TemplateFilePath))
  616. {
  617. ////创建路径
  618. //Directory.CreateDirectory(m_TemplateFilePath);
  619. FolderBrowserDialog dialog = new FolderBrowserDialog();
  620. dialog.Description = "请选择文件路径";
  621. //dialog.RootFolder = Environment.SpecialFolder.Programs;
  622. if (dialog.ShowDialog() == DialogResult.OK)
  623. {
  624. m_TemplateFilePath = dialog.SelectedPath;
  625. config.AppSettings.Settings["TemplateFilePath"].Value = m_TemplateFilePath;
  626. config.Save(ConfigurationSaveMode.Modified);
  627. ConfigurationManager.RefreshSection("appSettings");//重新加载新的配置文件
  628. }
  629. }
  630. //打开默认路径
  631. OpenFileDialog openFileDialog = new OpenFileDialog();
  632. //设置默认打开路径(绝对路径)
  633. openFileDialog.InitialDirectory = m_TemplateFilePath;
  634. openFileDialog.Filter = "样品参数文件|*.cfg";
  635. if (openFileDialog.ShowDialog() == DialogResult.OK)
  636. {
  637. if (uControl_Init == null)
  638. {
  639. uControl_Init = new UControl_Init(this);
  640. }
  641. //设置选择的模板文件
  642. uControl_Init.ReadConfigPath = openFileDialog.FileName;
  643. //获取文件
  644. uControl_Init.ReadConfigInfo();
  645. }
  646. }
  647. private void pbLog_Click(object sender, EventArgs e)
  648. {
  649. m_FormLog = new Form();
  650. m_FormLog.StartPosition = FormStartPosition.CenterScreen;
  651. if (ucLog == null)
  652. {
  653. ucLog = new UControl_Log();
  654. }
  655. m_FormLog.FormBorderStyle = FormBorderStyle.None;
  656. m_FormLog.Width = ucLog.Width;
  657. m_FormLog.Height = ucLog.Height;
  658. ucLog.Name = "UControl_Log";
  659. //获取日志信息
  660. if (listmsg.Items.Count>0)
  661. {
  662. string[] strLog = new string[listmsg.Items.Count];
  663. for (int i = 0; i < listmsg.Items.Count; i++)
  664. {
  665. //赋值给数组
  666. strLog[i] = listmsg.Items[i].ToString();
  667. }
  668. ucLog.ShowProcessLogInfo(strLog);
  669. }
  670. m_FormLog.Controls.Add(ucLog);
  671. m_FormLog.ShowDialog();
  672. }
  673. //显示日志
  674. private void AddLogListInfo(ThreadStatusEventArgs e)
  675. {
  676. if (m_FormLog != null)
  677. {
  678. foreach (Control item in m_FormLog.Controls)
  679. {
  680. if (item is UserControl)
  681. {
  682. if (item.Name == "UControl_Log")
  683. {
  684. ucLog = (UControl_Log)item;
  685. //获取日志信息
  686. if (listmsg.Items.Count > 0)
  687. {
  688. string[] strLog = new string[listmsg.Items.Count];
  689. for (int i = 0; i < listmsg.Items.Count; i++)
  690. {
  691. //赋值给数组
  692. strLog[i] = listmsg.Items[i].ToString();
  693. }
  694. ucLog.ShowProcessLogInfo(strLog);
  695. }
  696. }
  697. }
  698. }
  699. }
  700. }
  701. #endregion
  702. #region 修改切孔状态
  703. /// <summary>
  704. /// 修改切孔状态
  705. /// </summary>
  706. /// <param name="cutHoleCode"></param>
  707. /// <param name="States"></param>
  708. public void ChangeCutHoleState(string CutHoleName, int States)
  709. {
  710. foreach (Control item in plLeftContent.Controls)
  711. {
  712. if (item is UserControl)
  713. {
  714. UControl_CutHole cutHole = (UControl_CutHole)item;
  715. if (cutHole.CutHoleName == CutHoleName)
  716. {
  717. Button btnCutHole = (Button)cutHole.Controls.Find("btnCutHole", false)[0];
  718. switch (States)
  719. {
  720. //运行中
  721. case (int)ThreadState.InProcess:
  722. //btnCutHole.BackColor = Color.Yellow;
  723. btnCutHole.BackgroundImage = Properties.Resources.CutHole_Yellow_2_;
  724. btnCutHole.BackgroundImageLayout = ImageLayout.Center;
  725. ChangeCutHoleMeasureState(CutHoleName, States);
  726. ControlFlicker = true;
  727. break;
  728. //等待
  729. case (int)ThreadState.Waiting:
  730. //btnCutHole.BackColor = Color.Yellow;
  731. btnCutHole.BackgroundImage = Properties.Resources.CutHole_Yellow_2_;
  732. btnCutHole.BackgroundImageLayout = ImageLayout.Center;
  733. ChangeCutHoleMeasureState(CutHoleName, States);
  734. break;
  735. //准备
  736. case (int)ThreadState.Ready:
  737. //btnCutHole.BackColor = Color.White;
  738. btnCutHole.BackgroundImage = Properties.Resources.CutHole_Gray_2_;
  739. btnCutHole.BackgroundImageLayout = ImageLayout.Center;
  740. ChangeCutHoleMeasureState(CutHoleName, States);
  741. break;
  742. //失败
  743. case (int)ThreadState.Failed:
  744. //btnCutHole.BackColor = Color.Red;
  745. btnCutHole.BackgroundImage = Properties.Resources.CutHole_Red_2_;
  746. btnCutHole.BackgroundImageLayout = ImageLayout.Center;
  747. ChangeCutHoleMeasureState(CutHoleName, States);
  748. ControlFlicker = false;
  749. break;
  750. //完成
  751. case (int)ThreadState.Success:
  752. //btnCutHole.BackColor = Color.GreenYellow;
  753. btnCutHole.BackgroundImage = Properties.Resources.CutHole_Green_2_;
  754. btnCutHole.BackgroundImageLayout = ImageLayout.Center;
  755. //修改切孔状态
  756. ChangeCutHoleMeasureState(CutHoleName, States);
  757. ControlFlicker = false;
  758. break;
  759. }
  760. break;
  761. }
  762. }
  763. }
  764. }
  765. #endregion
  766. #region 修改切孔状态
  767. public void ChangeCutHoleMeasureState(string CutHoleName, int States)
  768. {
  769. if (plPrarInfo.Controls.Count > 0)
  770. {
  771. foreach (Control item in plPrarInfo.Controls)
  772. {
  773. if (item is UserControl)
  774. {
  775. if (item.Name == CutHoleName)
  776. {
  777. UControl_ParaInfo uControl_ParaInfo = (UControl_ParaInfo)item;
  778. //获取切孔列表
  779. List<CutHole> aCutHole = m_MeasureFile.ListCutHole;
  780. foreach (CutHole cutHoleItem in aCutHole)
  781. {
  782. if (cutHoleItem.HoleName == CutHoleName)
  783. {
  784. //设置开始时间与结束时间
  785. uControl_ParaInfo.StartTime = cutHoleItem.START.ToString();
  786. uControl_ParaInfo.EndTime = cutHoleItem.END.ToString();
  787. uControl_ParaInfo.ShowTime();
  788. break;
  789. }
  790. }
  791. switch (States)
  792. {
  793. //准备
  794. case (int)ThreadState.Ready:
  795. //修改切孔状态
  796. uControl_ParaInfo.lblShowState.Text = "准备";
  797. break;
  798. //等待
  799. case (int)ThreadState.Waiting:
  800. //修改切孔状态
  801. uControl_ParaInfo.lblShowState.Text = "等待";
  802. break;
  803. //进行中
  804. case (int)ThreadState.InProcess:
  805. //修改切孔状态
  806. uControl_ParaInfo.lblShowState.Text = "进行中";
  807. break;
  808. //完成
  809. case (int)ThreadState.Success:
  810. //修改切孔状态
  811. uControl_ParaInfo.lblShowState.Text = "完成";
  812. break;
  813. //失败
  814. case (int)ThreadState.Failed:
  815. uControl_ParaInfo.lblShowState.Text = "失败";
  816. uControl_ParaInfo.pbMeasure.Value = 100;
  817. uControl_ParaInfo.lblCompletedAmount.Text = "100%";
  818. break;
  819. }
  820. break;
  821. }
  822. }
  823. }
  824. }
  825. }
  826. #endregion
  827. #region 拖动无窗体的控件
  828. [DllImport("user32.dll")]//拖动无窗体的控件
  829. public static extern bool ReleaseCapture();
  830. [DllImport("user32.dll")]
  831. public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
  832. public const int WM_SYSCOMMAND = 0x0112;
  833. public const int SC_MOVE = 0xF010;
  834. public const int HTCAPTION = 0x0002;
  835. private void FormHOZMain_MouseDown(object sender, MouseEventArgs e)
  836. {
  837. if (this.WindowState == FormWindowState.Normal)
  838. {
  839. //拖动窗体
  840. ReleaseCapture();
  841. SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
  842. }
  843. }
  844. #endregion
  845. #region 开始、结束线程事件
  846. private void pbStart_Click(object sender, EventArgs e)
  847. {
  848. if (plLeftContent.Controls.Count==0)
  849. {
  850. MessageBox.Show("请添加切孔信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  851. return;
  852. }
  853. if (IsSave)
  854. {
  855. if (m_BackgroundWorker.IsBusy)
  856. {
  857. MessageBox.Show("线程已经运行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  858. return;
  859. }
  860. if (MessageBox.Show("是否开始测量!", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
  861. {
  862. log.Info("开始", true);
  863. m_BackgroundWorker.RunWorkerAsync(this);
  864. pbStop.Visible = true;
  865. pbStart.Visible = false;
  866. }
  867. }
  868. else
  869. {
  870. MessageBox.Show("请保存当前测量文件", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  871. return;
  872. }
  873. }
  874. private void pbStop_Click(object sender, EventArgs e)
  875. {
  876. if (m_Ms != null)
  877. {
  878. if (MessageBox.Show("是否停止当前测量?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)== DialogResult.Yes)
  879. {
  880. ControlFlicker = false;
  881. //线程停止变量
  882. m_Ms.key_stop = true;
  883. }
  884. }
  885. }
  886. #endregion
  887. #region 清空内容容器中的控件
  888. /// <summary>
  889. /// 清空内容容器中的控件
  890. /// </summary>
  891. private void ClearPanelControls()
  892. {
  893. //清空内容容器中的控件
  894. plLeftContent.Controls.Clear();
  895. plPrarInfo.Controls.Clear();
  896. }
  897. /// <summary>
  898. /// 清空日志控件内容
  899. /// </summary>
  900. private void ClearContrlsContent()
  901. {
  902. try
  903. {
  904. if (ucLog != null)
  905. {
  906. if (ucLog.dgvLog != null)
  907. {
  908. if (ucLog.dgvLog.Rows.Count > 0)
  909. {
  910. ucLog.dgvLog.Rows.Clear();
  911. }
  912. }
  913. }
  914. if (listmsg != null)
  915. {
  916. if (listmsg.Items.Count > 0)
  917. {
  918. listmsg.Items.Clear();
  919. }
  920. }
  921. }
  922. catch (Exception ex)
  923. {
  924. log.Error(ex.Message);
  925. }
  926. }
  927. #endregion
  928. #region 测试修改切孔中流程状态
  929. private void button1_Click(object sender, EventArgs e)
  930. {
  931. if (plPrarInfo.Controls.Count > 0)
  932. {
  933. string name = textBox1.Text;
  934. string code = textBox2.Text;
  935. bool state = Convert.ToBoolean(comboBox1.Text);
  936. foreach (Control item in plPrarInfo.Controls)
  937. {
  938. if (item is UserControl)
  939. {
  940. if (item.Name == name)
  941. {
  942. UControl_ParaInfo uControl_ParaInfo = (UControl_ParaInfo)item;
  943. TimeLineItem[] ParaItem = uControl_ParaInfo.TlItem;
  944. foreach (TimeLineItem tlItem in ParaItem)
  945. {
  946. if (tlItem.Code == code)
  947. {
  948. tlItem.State = Convert.ToInt32(state);
  949. break;
  950. }
  951. }
  952. uControl_ParaInfo.TimeLineInvalidate();
  953. break;
  954. }
  955. }
  956. }
  957. }
  958. }
  959. #endregion
  960. private void FormHOZMain_Resize(object sender, EventArgs e)
  961. {
  962. plMain.Left = 2;
  963. plMain.Top = 2;
  964. plMain.Width = this.Width - 4;
  965. plMain.Height = this.Height - 4;
  966. plFill.Width = plMain.Width - plLeft.Width - 4;
  967. plFill.Height = plMain.Height - plTop.Height - 4;
  968. plFill.Left = plLeft.Width + 4;
  969. plFill.Top = plTop.Height + 4;
  970. if(this.WindowState!= FormWindowState.Maximized)
  971. {
  972. plPrarInfo.Height = 505;
  973. foreach (Control item in plPrarInfo.Controls)
  974. {
  975. if (item is UserControl)
  976. {
  977. if(item.Height>505)
  978. {
  979. item.Height = 505;
  980. }
  981. }
  982. }
  983. }
  984. }
  985. private void FormHOZMain_Paint(object sender, PaintEventArgs e)
  986. {
  987. }
  988. private void ConfigurationParameter()
  989. {
  990. #region 初始化参数的默认值
  991. // add by zjx 2020-12-20 厂商参数
  992. m_MeasureFile.MParam.VendorType0 = Convert.ToString(ConfigurationManager.AppSettings["VendorType0"]);
  993. m_MeasureFile.MParam.VendorType1 = Convert.ToString(ConfigurationManager.AppSettings["VendorType1"]);
  994. m_MeasureFile.MParam.VendorType2 = Convert.ToString(ConfigurationManager.AppSettings["VendorType2"]);
  995. m_MeasureFile.MParam.VendorType3 = Convert.ToString(ConfigurationManager.AppSettings["VendorType3"]);
  996. // add by zjx 2020-12-20 厂商参数 end
  997. // add by zjx 2020-12-21 校正角度
  998. m_MeasureFile.MParam.CorrectionType0 = Convert.ToString(ConfigurationManager.AppSettings["CorrectionType0"]);
  999. m_MeasureFile.MParam.CorrectionType1 = Convert.ToString(ConfigurationManager.AppSettings["CorrectionType1"]);
  1000. m_MeasureFile.MParam.CorrectionType2 = Convert.ToString(ConfigurationManager.AppSettings["CorrectionType2"]);
  1001. m_MeasureFile.MParam.CorrectionType3 = Convert.ToString(ConfigurationManager.AppSettings["CorrectionType3"]);
  1002. // add by zjx 2020-12-21 校正角度 end
  1003. // add by zjx 2020-12-21 拉直操作放大倍数
  1004. m_MeasureFile.MParam.StraightenTimesType0 = Convert.ToString(ConfigurationManager.AppSettings["StraightenTimesType0"]);
  1005. m_MeasureFile.MParam.StraightenTimesType1 = Convert.ToString(ConfigurationManager.AppSettings["StraightenTimesType1"]);
  1006. m_MeasureFile.MParam.StraightenTimesType2 = Convert.ToString(ConfigurationManager.AppSettings["StraightenTimesType2"]);
  1007. m_MeasureFile.MParam.StraightenTimesType3 = Convert.ToString(ConfigurationManager.AppSettings["StraightenTimesType3"]);
  1008. // add by zjx 2020-12-21 拉直操作放大倍数 end
  1009. // add by zjx 2020-12-21 定位电压
  1010. m_MeasureFile.MParam.PositioningVoltageeType0 = Convert.ToString(ConfigurationManager.AppSettings["PositioningVoltageeType0"]);
  1011. m_MeasureFile.MParam.PositioningVoltageeType1 = Convert.ToString(ConfigurationManager.AppSettings["PositioningVoltageeType1"]);
  1012. m_MeasureFile.MParam.PositioningVoltageeType2 = Convert.ToString(ConfigurationManager.AppSettings["PositioningVoltageeType2"]);
  1013. m_MeasureFile.MParam.PositioningVoltageeType3 = Convert.ToString(ConfigurationManager.AppSettings["PositioningVoltageeType3"]);
  1014. // add by zjx 2020-12-21 定位电压 end
  1015. // add by zjx 2020-12-21 定位放大倍数
  1016. m_MeasureFile.MParam.PositioningTimesType0 = Convert.ToString(ConfigurationManager.AppSettings["PositioningTimesType0"]);
  1017. m_MeasureFile.MParam.PositioningTimesType1 = Convert.ToString(ConfigurationManager.AppSettings["PositioningTimesType1"]);
  1018. m_MeasureFile.MParam.PositioningTimesType2 = Convert.ToString(ConfigurationManager.AppSettings["PositioningTimesType2"]);
  1019. m_MeasureFile.MParam.PositioningTimesType3 = Convert.ToString(ConfigurationManager.AppSettings["PositioningTimesType3"]);
  1020. // add by zjx 2020-12-21 定位放大倍数 end
  1021. // add by zjx 2020-12-21 拍照电压
  1022. m_MeasureFile.MParam.PhotoVoltageeType0 = Convert.ToString(ConfigurationManager.AppSettings["PhotoVoltageeType0"]);
  1023. m_MeasureFile.MParam.PhotoVoltageeType1 = Convert.ToString(ConfigurationManager.AppSettings["PhotoVoltageeType1"]);
  1024. m_MeasureFile.MParam.PhotoVoltageeType2 = Convert.ToString(ConfigurationManager.AppSettings["PhotoVoltageeType2"]);
  1025. m_MeasureFile.MParam.PhotoVoltageeType3 = Convert.ToString(ConfigurationManager.AppSettings["PhotoVoltageeType3"]);
  1026. // add by zjx 2020-12-21 拍照电压 end
  1027. // add by zjx 2020-12-21 拍照放大倍数
  1028. m_MeasureFile.MParam.PhotoTimesType0 = Convert.ToString(ConfigurationManager.AppSettings["PhotoTimesType0"]);
  1029. m_MeasureFile.MParam.PhotoTimesType1 = Convert.ToString(ConfigurationManager.AppSettings["PhotoTimesType1"]);
  1030. m_MeasureFile.MParam.PhotoTimesType2 = Convert.ToString(ConfigurationManager.AppSettings["PhotoTimesType2"]);
  1031. m_MeasureFile.MParam.PhotoTimesType3 = Convert.ToString(ConfigurationManager.AppSettings["PhotoTimesType3"]);
  1032. // add by zjx 2020-12-21 拍照放大倍数 end
  1033. // add by zjx 2020-12-21 ScanRotate修正参数
  1034. m_MeasureFile.MParam.ScanRotateType0 = Convert.ToString(ConfigurationManager.AppSettings["ScanRotateType0"]);
  1035. m_MeasureFile.MParam.ScanRotateType1 = Convert.ToString(ConfigurationManager.AppSettings["ScanRotateType1"]);
  1036. m_MeasureFile.MParam.ScanRotateType2 = Convert.ToString(ConfigurationManager.AppSettings["ScanRotateType2"]);
  1037. m_MeasureFile.MParam.ScanRotateType3 = Convert.ToString(ConfigurationManager.AppSettings["ScanRotateType3"]);
  1038. // add by zjx 2020-12-21 ScanRotate修正参数 end
  1039. // add by zjx 2020-12-21 Y轴方向PixelSize修正值
  1040. m_MeasureFile.MParam.PixelSizeType0 = Convert.ToString(ConfigurationManager.AppSettings["PixelSizeType0"]);
  1041. m_MeasureFile.MParam.PixelSizeType1 = Convert.ToString(ConfigurationManager.AppSettings["PixelSizeType1"]);
  1042. m_MeasureFile.MParam.PixelSizeType2 = Convert.ToString(ConfigurationManager.AppSettings["PixelSizeType2"]);
  1043. m_MeasureFile.MParam.PixelSizeType3 = Convert.ToString(ConfigurationManager.AppSettings["PixelSizeType3"]);
  1044. // add by zjx 2020-12-21 Y轴方向PixelSize修正值 end
  1045. // add by zjx 2020-12-21 能谱Z轴移动位置
  1046. m_MeasureFile.MParam.SEMAxis_ZType0 = Convert.ToString(ConfigurationManager.AppSettings["SEMAxis_ZType0"]);
  1047. m_MeasureFile.MParam.SEMAxis_ZType1 = Convert.ToString(ConfigurationManager.AppSettings["SEMAxis_ZType1"]);
  1048. m_MeasureFile.MParam.SEMAxis_ZType2 = Convert.ToString(ConfigurationManager.AppSettings["SEMAxis_ZType2"]);
  1049. m_MeasureFile.MParam.SEMAxis_ZType3 = Convert.ToString(ConfigurationManager.AppSettings["SEMAxis_ZType3"]);
  1050. // add by zjx 2020-12-21 能谱Z轴移动位置 end
  1051. // add by zjx 2020-12-21 能谱电压值
  1052. m_MeasureFile.MParam.SEMVoltageeType0 = Convert.ToString(ConfigurationManager.AppSettings["SEMVoltageeType0"]);
  1053. m_MeasureFile.MParam.SEMVoltageeType1 = Convert.ToString(ConfigurationManager.AppSettings["SEMVoltageeType1"]);
  1054. m_MeasureFile.MParam.SEMVoltageeType2 = Convert.ToString(ConfigurationManager.AppSettings["SEMVoltageeType2"]);
  1055. m_MeasureFile.MParam.SEMVoltageeType3 = Convert.ToString(ConfigurationManager.AppSettings["SEMVoltageeType3"]);
  1056. // add by zjx 2020-12-21 能谱电压值 end
  1057. // add by zjx 2020-12-21 能谱电流值
  1058. m_MeasureFile.MParam.SEMCurrentType0 = Convert.ToString(ConfigurationManager.AppSettings["SEMCurrentType0"]);
  1059. m_MeasureFile.MParam.SEMCurrentType1 = Convert.ToString(ConfigurationManager.AppSettings["SEMCurrentType1"]);
  1060. m_MeasureFile.MParam.SEMCurrentType2 = Convert.ToString(ConfigurationManager.AppSettings["SEMCurrentType2"]);
  1061. m_MeasureFile.MParam.SEMCurrentType3 = Convert.ToString(ConfigurationManager.AppSettings["SEMCurrentType3"]);
  1062. // add by zjx 2020-12-21 能谱电流值 end
  1063. #endregion
  1064. }
  1065. }
  1066. }