Kaynağa Gözat

测试项目上锁不需要判断账户。

Dail 1 yıl önce
ebeveyn
işleme
24b0986ba8

BIN
.vs/Welling_Motor_Debug_Tool/v17/.suo


BIN
Welling_Motor_Debug_Tool/bin/Debug/Welling_Motor_Debug_Tool.exe


BIN
Welling_Motor_Debug_Tool/bin/Debug/Welling_Motor_Debug_Tool.pdb


+ 62 - 40
Welling_Motor_Debug_Tool/mainForm.cs

@@ -5290,12 +5290,21 @@ namespace Welling_Motor_Debug_Tool
         /// <param name="e"></param>
         private void button__FacMode_Start_Click(object sender, EventArgs e)
         {
+            //关闭测试项目编译
+            pictureBox_WriteLock.Image = global::Welling_Motor_Debug_Tool.Properties.Resources.Lock;
+            foreach (Control c in groupBox2.Controls)
+            {
+                if (c is CheckBox)
+                    c.Enabled = false;
+            }
+            WriteLockStatus = true;
+            //检查串口
             if (!mySerialProcess.mySerial.IsOpen)
             {
                 MessageBox.Show("请检查串口连接!!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 return;
             }
-            
+            //开始测试
             TestStart();
         }
         /// <summary>
@@ -6559,12 +6568,21 @@ namespace Welling_Motor_Debug_Tool
         /// <param name="e"></param>
         private void button_CheckModeStart_Click(object sender, EventArgs e)
         {
+            //测试项目关闭编辑
+            pictureBox_ReadLock.Image = global::Welling_Motor_Debug_Tool.Properties.Resources.Lock;
+            foreach (Control c in groupBox29.Controls)
+            {
+                if (c is CheckBox)
+                    c.Enabled = false;
+            }
+            ReadLockStatus = true;
+            //检查串口
             if (!mySerialProcess.mySerial.IsOpen)
             {
                 MessageBox.Show("请检查串口连接!!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 return;
             }
-
+            //开始测试
             CheckTestStart();
         }
 
@@ -7165,94 +7183,98 @@ namespace Welling_Motor_Debug_Tool
         bool WriteLockStatus = true;
         private void pictureBox_WriteLock_Click(object sender, EventArgs e)
         {
-            EnterForm1.ShowDialog();
-            try
+            if (WriteLockStatus == true)
             {
-                if (EnterForm1.textBox_Passwd.Text == EnterForm1.UserAccount[EnterForm1.comboBox_User.Text])//检验模式所有用户支持
+                EnterForm1.ShowDialog();
+                try
                 {
-                    if (EnterForm1.comboBox_User.Text == "工程配置")
+                    if (EnterForm1.textBox_Passwd.Text == EnterForm1.UserAccount[EnterForm1.comboBox_User.Text])//检验模式所有用户支持
                     {
-                        if (WriteLockStatus == true)
+                        if (EnterForm1.comboBox_User.Text == "工程配置")
                         {
                             pictureBox_WriteLock.Image = global::Welling_Motor_Debug_Tool.Properties.Resources.Unlock;
                             foreach (Control c in groupBox2.Controls)
                             {
                                 if (c is CheckBox)
-                                    c.Enabled = true;                                
+                                    c.Enabled = true;
                             }
+                            WriteLockStatus = !WriteLockStatus;                                                            
                         }
-                        else                         
+                        else
                         {
-                            pictureBox_WriteLock.Image = global::Welling_Motor_Debug_Tool.Properties.Resources.Lock;
-                            foreach (Control c in groupBox2.Controls)
-                            {
-                                if (c is CheckBox)
-                                    c.Enabled = false;
-                            }
+                            MessageBox.Show("权限不支持", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                         }
-
-                        WriteLockStatus = !WriteLockStatus;
                     }
                     else
                     {
-                        MessageBox.Show("权限不支持", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
+                        MessageBox.Show("密码错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     }
                 }
-                else
+                catch (Exception)
                 {
-                    MessageBox.Show("密码错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
+                    MessageBox.Show("用户不存在或密码错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
-            catch (Exception)
+            else
             {
-                MessageBox.Show("用户不存在或密码错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
+                pictureBox_WriteLock.Image = global::Welling_Motor_Debug_Tool.Properties.Resources.Lock;
+                foreach (Control c in groupBox2.Controls)
+                {
+                    if (c is CheckBox)
+                        c.Enabled = false;
+                }
+
+                WriteLockStatus = !WriteLockStatus;
             }
+            
         }
 
         bool ReadLockStatus = true;
         private void pictureBox_ReadLock_Click(object sender, EventArgs e)
         {
-            EnterForm1.ShowDialog();
-            try
+            if (ReadLockStatus == true)
             {
-                if (EnterForm1.textBox_Passwd.Text == EnterForm1.UserAccount[EnterForm1.comboBox_User.Text])//检验模式所有用户支持
+                EnterForm1.ShowDialog();
+                try
                 {
-                    if (EnterForm1.comboBox_User.Text == "工程配置")
+                    if (EnterForm1.textBox_Passwd.Text == EnterForm1.UserAccount[EnterForm1.comboBox_User.Text])//检验模式所有用户支持
                     {
-                        if (ReadLockStatus == true)
-                        {
+                        if (EnterForm1.comboBox_User.Text == "工程配置")
+                        {                            
                             pictureBox_ReadLock.Image = global::Welling_Motor_Debug_Tool.Properties.Resources.Unlock;
                             foreach (Control c in groupBox29.Controls)
                             {
                                 if (c is CheckBox)
                                     c.Enabled = true;
                             }
+                            ReadLockStatus = !ReadLockStatus;                            
                         }
                         else
                         {
-                            pictureBox_ReadLock.Image = global::Welling_Motor_Debug_Tool.Properties.Resources.Lock;
-                            foreach (Control c in groupBox29.Controls)
-                            {
-                                if (c is CheckBox)
-                                    c.Enabled = false;
-                            }
+                            MessageBox.Show("权限不支持", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                         }
-                        ReadLockStatus = !ReadLockStatus;
                     }
                     else
                     {
-                        MessageBox.Show("权限不支持", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
+                        MessageBox.Show("密码错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     }
                 }
-                else
+                catch (Exception)
                 {
-                    MessageBox.Show("密码错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
+                    MessageBox.Show("用户不存在或密码错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
-            catch (Exception)
+            else
             {
-                MessageBox.Show("用户不存在或密码错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
+                pictureBox_ReadLock.Image = global::Welling_Motor_Debug_Tool.Properties.Resources.Lock;
+                foreach (Control c in groupBox29.Controls)
+                {
+                    if (c is CheckBox)
+                        c.Enabled = false;
+                }
+                ReadLockStatus = !ReadLockStatus;
             }
+
         }
     }
 }

BIN
Welling_Motor_Debug_Tool/obj/Debug/Welling_Motor_Debug_Tool.exe


BIN
Welling_Motor_Debug_Tool/obj/Debug/Welling_Motor_Debug_Tool.pdb