Browse Source

添加开始测量提示

wb_han 5 years ago
parent
commit
0926f7929e
1 changed files with 22 additions and 17 deletions
  1. 22 17
      HOZProject/FormHOZMain.cs

+ 22 - 17
HOZProject/FormHOZMain.cs

@@ -107,9 +107,11 @@ namespace HOZProject
 
 
                 m_Ms.InitMeas(m_MeasureFile);
-                m_Ms.SendThreadStatus += new ThreadStatusHandler(displayMessage); //注册事件
-                m_Ms.SendCutHolesStatus += new CutHolesStatusHandler(displayCutHoleMessage); //注册事件
-                                                                                             //设置控件操作
+                //注册事件
+                m_Ms.SendThreadStatus += new ThreadStatusHandler(displayMessage);
+                //注册事件
+                m_Ms.SendCutHolesStatus += new CutHolesStatusHandler(displayCutHoleMessage); 
+                //设置控件操作
                 SetWinControlMeasureState(false);
                 //自动测量的全过程
                 m_Ms.DoMeasure();
@@ -242,6 +244,7 @@ namespace HOZProject
             pbInit.Enabled = cState;
             pbImportTemplateFile.Enabled = cState;
             //pbLog.Enabled = cState;
+            pbStart.Enabled = cState;
             pbStop.Enabled = !cState;
             //设置切孔是否执行
             foreach (Control item in plPrarInfo.Controls)
@@ -426,8 +429,8 @@ namespace HOZProject
                     //文件路径
                     string CutHoleFilePath = m_MeasureFile.CutHoleFilePath;
                     CreateCutHoleList(ListCutHole);
-                    //保存测量文件
-                    m_MeasureFile.Save();
+                    ////保存测量文件
+                    //m_MeasureFile.Save();
                     //设置已保存状态
                     IsSave = true;
                 }
@@ -689,27 +692,29 @@ namespace HOZProject
         #region 开始、结束线程事件
         private void pbStart_Click(object sender, EventArgs e)
         {
-            if (m_MeasureFile == null)
+            if (plLeftContent.Controls.Count==0)
             {
-                MessageBox.Show("请新建一个测量文件", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
+                MessageBox.Show("请添加切孔信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 //listmsg.Items.Clear();
+                return;
             }
-            else
+            if (IsSave)
             {
-                if (IsSave)
+                if (m_BackgroundWorker.IsBusy)
                 {
-                    if (m_BackgroundWorker.IsBusy)
-                    {
-                        MessageBox.Show("线程已经运行!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
-                        return;
-                    }
-                    m_BackgroundWorker.RunWorkerAsync(this);
+                    MessageBox.Show("线程已经运行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
+                    return;
                 }
-                else
+                if (MessageBox.Show("是否开始测量!", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                 {
-                    MessageBox.Show("请保存当前测量文件", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
+                    m_BackgroundWorker.RunWorkerAsync(this);
                 }
             }
+            else
+            {
+                MessageBox.Show("请保存当前测量文件", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
+                return;
+            }
         }
 
         private void pbStop_Click(object sender, EventArgs e)