瀏覽代碼

打开文件显示切孔状态

wb_han 5 年之前
父節點
當前提交
d0cc62c523

+ 39 - 20
HOZProject/FormHOZMain.cs

@@ -80,23 +80,30 @@ namespace HOZProject
         #region 测量线程
         void DoWork(object sender, DoWorkEventArgs e)
         {
-            m_Ms = new Measure(ConfigurationManager.AppSettings["WebServerIP"].ToString(),
-                ConfigurationManager.AppSettings["WebServerPort"].ToString(),
-                ConfigurationManager.AppSettings["WebServerUrl"].ToString());
-
-            m_MeasureFile.MParam.AutoFocus.UP = Convert.ToSingle(ConfigurationManager.AppSettings["Focus_UP"].ToString());
-            m_MeasureFile.MParam.AutoFocus.Down = Convert.ToSingle(ConfigurationManager.AppSettings["Focus_Down"].ToString());
-            m_MeasureFile.MParam.AutoFocus.Step = Convert.ToSingle(ConfigurationManager.AppSettings["Focus_Step"].ToString());
-            m_MeasureFile.MParam.AutoFocus.Range = Convert.ToSingle(ConfigurationManager.AppSettings["Focus_Range"].ToString());
-            m_MeasureFile.MParam.AutoFocus.fStep = Convert.ToSingle(ConfigurationManager.AppSettings["Focus_FStep"].ToString());
-
-            m_Ms.InitMeas(m_MeasureFile);
-            m_Ms.SendThreadStatus += new ThreadStatusHandler(displayMessage); //注册事件
-            m_Ms.SendCutHolesStatus += new CutHolesStatusHandler(displayCutHoleMessage); //注册事件
-            //设置控件操作
-            SetWinControlMeasureState(false);
-            //自动测量的全过程
-            m_Ms.DoMeasure();
+            try
+            {
+                m_Ms = new Measure(ConfigurationManager.AppSettings["WebServerIP"].ToString(),
+                       ConfigurationManager.AppSettings["WebServerPort"].ToString(),
+                       ConfigurationManager.AppSettings["WebServerUrl"].ToString());
+
+                m_MeasureFile.MParam.AutoFocus.UP = Convert.ToSingle(ConfigurationManager.AppSettings["Focus_UP"].ToString());
+                m_MeasureFile.MParam.AutoFocus.Down = Convert.ToSingle(ConfigurationManager.AppSettings["Focus_Down"].ToString());
+                m_MeasureFile.MParam.AutoFocus.Step = Convert.ToSingle(ConfigurationManager.AppSettings["Focus_Step"].ToString());
+                m_MeasureFile.MParam.AutoFocus.Range = Convert.ToSingle(ConfigurationManager.AppSettings["Focus_Range"].ToString());
+                m_MeasureFile.MParam.AutoFocus.fStep = Convert.ToSingle(ConfigurationManager.AppSettings["Focus_FStep"].ToString());
+
+                m_Ms.InitMeas(m_MeasureFile);
+                m_Ms.SendThreadStatus += new ThreadStatusHandler(displayMessage); //注册事件
+                m_Ms.SendCutHolesStatus += new CutHolesStatusHandler(displayCutHoleMessage); //注册事件
+                                                                                             //设置控件操作
+                SetWinControlMeasureState(false);
+                //自动测量的全过程
+                m_Ms.DoMeasure();
+            }
+            catch (Exception ex)
+            {
+                LogManager.LogError(ex.ToString());
+            }
         }
 
         public void displayMessage(object sender, ThreadStatusEventArgs e)
@@ -176,17 +183,20 @@ namespace HOZProject
                 plPrarInfo.Width = ucCutHole.UControl_ParaInfo.Width;
                 plPrarInfo.Height = ucCutHole.UControl_ParaInfo.Height;
                 //设置当前样品的参数信息
-                ucCutHole.UControl_ParaInfo.Name = ListCutHole[i].HoleName;
-                ucCutHole.UControl_ParaInfo.CutHoleName = ListCutHole[i].HoleName;
+                string CutHoleName = ListCutHole[i].HoleName;
+                ucCutHole.UControl_ParaInfo.Name = CutHoleName;
+                ucCutHole.UControl_ParaInfo.CutHoleName = CutHoleName;
                 ucCutHole.UControl_ParaInfo.Position = ListCutHole[i].Position;
                 ucCutHole.UControl_ParaInfo.StartTime = ListCutHole[i].START.ToString();
                 ucCutHole.UControl_ParaInfo.EndTime = ListCutHole[i].END.ToString();
-                ucCutHole.UControl_ParaInfo.State = (int)ListCutHole[i].STATE;
+                int state = (int)ListCutHole[i].STATE;
+                ucCutHole.UControl_ParaInfo.State = state;
                 ucCutHole.UControl_ParaInfo.IsSwitch = ListCutHole[i].SWITCH;
                 ucCutHole.UControl_ParaInfo.Dock = DockStyle.Fill;
                 ucCutHole.UControl_ParaInfo.ShowParaInfo();
                 plPrarInfo.Controls.Add(ucCutHole.UControl_ParaInfo);
                 plLeftContent.Controls.Add(ucCutHole);
+                ChangeCutHoleState(CutHoleName, state);
             }
             plPrarInfo.Visible = false;
         } 
@@ -215,6 +225,15 @@ namespace HOZProject
             pbImportTemplateFile.Enabled = cState;
             //pbLog.Enabled = cState;
             pbStop.Enabled = !cState;
+            //设置切孔是否执行
+            foreach (Control item in plPrarInfo.Controls)
+            {
+                if (item is UserControl)
+                {
+                    UControl_ParaInfo ucParaInfo = (UControl_ParaInfo)item;
+                    ucParaInfo.CkIsSwitch.Enabled = cState;
+                }
+            }
         }
         #endregion
         

+ 12 - 12
HOZProject/UserControls/UControl_ParaInfo.Designer.cs

@@ -58,11 +58,11 @@
             this.lvMeasureFlow = new System.Windows.Forms.ListView();
             this.imageList1 = new System.Windows.Forms.ImageList(this.components);
             this.panel3 = new System.Windows.Forms.Panel();
+            this.lblCompletedAmount = new System.Windows.Forms.Label();
             this.label1 = new System.Windows.Forms.Label();
             this.pbMeasure = new System.Windows.Forms.ProgressBar();
             this.panel4 = new System.Windows.Forms.Panel();
             this.label8 = new System.Windows.Forms.Label();
-            this.lblCompletedAmount = new System.Windows.Forms.Label();
             this.panel1.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.pbClose)).BeginInit();
             this.plMeasureFlow.SuspendLayout();
@@ -391,6 +391,16 @@
             this.panel3.Size = new System.Drawing.Size(345, 46);
             this.panel3.TabIndex = 5;
             // 
+            // lblCompletedAmount
+            // 
+            this.lblCompletedAmount.AutoSize = true;
+            this.lblCompletedAmount.ForeColor = System.Drawing.Color.White;
+            this.lblCompletedAmount.Location = new System.Drawing.Point(308, 18);
+            this.lblCompletedAmount.Name = "lblCompletedAmount";
+            this.lblCompletedAmount.Size = new System.Drawing.Size(17, 12);
+            this.lblCompletedAmount.TabIndex = 2;
+            this.lblCompletedAmount.Text = "0%";
+            // 
             // label1
             // 
             this.label1.AutoSize = true;
@@ -432,16 +442,6 @@
             this.label8.TabIndex = 3;
             this.label8.Text = "检测流程";
             // 
-            // lblCompletedAmount
-            // 
-            this.lblCompletedAmount.AutoSize = true;
-            this.lblCompletedAmount.ForeColor = System.Drawing.Color.White;
-            this.lblCompletedAmount.Location = new System.Drawing.Point(308, 18);
-            this.lblCompletedAmount.Name = "lblCompletedAmount";
-            this.lblCompletedAmount.Size = new System.Drawing.Size(17, 12);
-            this.lblCompletedAmount.TabIndex = 2;
-            this.lblCompletedAmount.Text = "0%";
-            // 
             // UControl_ParaInfo
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@@ -489,7 +489,6 @@
         private System.Windows.Forms.Label lblStartTime;
         private System.Windows.Forms.Label lblEndTime;
         private System.Windows.Forms.Label lblState;
-        private System.Windows.Forms.CheckBox CkIsSwitch;
         private System.Windows.Forms.Label lblCutHoleName;
         private System.Windows.Forms.Panel panel1;
         private System.Windows.Forms.Label lblX;
@@ -518,5 +517,6 @@
         private System.Windows.Forms.Panel plTimeLine;
         public System.Windows.Forms.Label lblShowState;
         private System.Windows.Forms.Label lblCompletedAmount;
+        public System.Windows.Forms.CheckBox CkIsSwitch;
     }
 }

+ 1 - 1
HOZProject/UserControls/UControl_ParaInfo.resx

@@ -125,7 +125,7 @@
         AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
         LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
         ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAS
-        GAAAAk1TRnQBSQFMAgEBBQEAAVgBAAFYAQABIAEAASABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
+        GAAAAk1TRnQBSQFMAgEBBQEAAWABAAFgAQABIAEAASABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
         AwABgAMAAUADAAEBAQABCAYAASAYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
         AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
         AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA