优化用户登录

master
lhiven 1 year ago
parent 5457349137
commit 130d5672b1

@ -28,7 +28,7 @@ namespace Rs.MotionPlat.Commom
}
public static bool IsOp()
{
if (!string.IsNullOrEmpty(UserName) && UserName == "操作员")
if (!string.IsNullOrEmpty(UserName) && UserName == "Op")
{
return true;
}
@ -37,7 +37,7 @@ namespace Rs.MotionPlat.Commom
public static bool IsVender()
{
if (!string.IsNullOrEmpty(UserName) && UserName == "厂商")
if (!string.IsNullOrEmpty(UserName) && UserName == "Vender")
{
return true;
}
@ -45,7 +45,7 @@ namespace Rs.MotionPlat.Commom
}
public static bool IsSuper()
{
if(!string.IsNullOrEmpty(UserName) && UserName=="超级用户")
if(!string.IsNullOrEmpty(UserName) && UserName=="Admin")
{
return true;
}

@ -2181,6 +2181,7 @@ namespace Rs.MotionPlat.Flow
default:
break;
}
Thread.Sleep(1);
}
}

@ -3166,6 +3166,7 @@ namespace Rs.MotionPlat.Flow
break;
}
Thread.Sleep(1);
}
}

@ -36,7 +36,6 @@ namespace Rs.MotionPlat
this.FormBorderStyle = FormBorderStyle.None;
this.MaximizedBounds = Screen.PrimaryScreen.WorkingArea;
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
}
void CloseSubWindow()
@ -195,13 +194,29 @@ namespace Rs.MotionPlat
}
else if (button == btnPermission)
{
selectedButton = null;
BaseFormHeader form;
form = new UserForm();
form.StartPosition = FormStartPosition.CenterScreen;
form.Opacity = 1;
form.TopMost = true;
form.ShowDialog(this);
if(btnPermission.ShowText.IndexOf("-")>0)
{
DialogResult dr = Msg.ShowQuestion("Are you sure to exit login?");
if(dr== DialogResult.OK)
{
GlobalUser.UserName = "";
btnPermission.ShowText=btnPermission.ShowText.Substring(0,btnPermission.ShowText.IndexOf("-"));
}
}
else
{
selectedButton = null;
UserForm form;
form = new UserForm();
form.OnloginSuccessEvent += (uname) => {
btnPermission.ShowText += $"-({uname})";
};
form.StartPosition = FormStartPosition.CenterScreen;
form.Opacity = 1;
form.TopMost = true;
form.ShowDialog(this);
}
}
else if (button == btnLanguage)
{
@ -225,7 +240,10 @@ namespace Rs.MotionPlat
}
}
private void Form_OnloginSuccessEvent(string obj)
{
throw new NotImplementedException();
}
private void ShowBtn(string btnname)
{

@ -111,16 +111,16 @@
//
// panel8
//
resources.ApplyResources(this.panel8, "panel8");
this.panel8.Controls.Add(this.btnMain);
resources.ApplyResources(this.panel8, "panel8");
this.panel8.Name = "panel8";
//
// btnMain
//
resources.ApplyResources(this.btnMain, "btnMain");
this.btnMain.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(19)))), ((int)(((byte)(52)))), ((int)(((byte)(104)))));
this.btnMain.ButtonType = Rs.Controls.EButtonType.Main;
this.btnMain.Cursor = System.Windows.Forms.Cursors.Hand;
resources.ApplyResources(this.btnMain, "btnMain");
this.btnMain.FlatAppearance.BorderColor = System.Drawing.Color.White;
this.btnMain.ForeColor = System.Drawing.Color.White;
this.btnMain.Name = "btnMain";
@ -134,16 +134,16 @@
//
// panel9
//
resources.ApplyResources(this.panel9, "panel9");
this.panel9.Controls.Add(this.btnRecipe);
resources.ApplyResources(this.panel9, "panel9");
this.panel9.Name = "panel9";
//
// btnRecipe
//
resources.ApplyResources(this.btnRecipe, "btnRecipe");
this.btnRecipe.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(19)))), ((int)(((byte)(52)))), ((int)(((byte)(104)))));
this.btnRecipe.ButtonType = Rs.Controls.EButtonType.Recipe;
this.btnRecipe.Cursor = System.Windows.Forms.Cursors.Hand;
resources.ApplyResources(this.btnRecipe, "btnRecipe");
this.btnRecipe.FlatAppearance.BorderColor = System.Drawing.Color.White;
this.btnRecipe.ForeColor = System.Drawing.Color.White;
this.btnRecipe.Name = "btnRecipe";
@ -157,16 +157,16 @@
//
// panel10
//
resources.ApplyResources(this.panel10, "panel10");
this.panel10.Controls.Add(this.btnSystem);
resources.ApplyResources(this.panel10, "panel10");
this.panel10.Name = "panel10";
//
// btnSystem
//
resources.ApplyResources(this.btnSystem, "btnSystem");
this.btnSystem.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(19)))), ((int)(((byte)(52)))), ((int)(((byte)(104)))));
this.btnSystem.ButtonType = Rs.Controls.EButtonType.System;
this.btnSystem.Cursor = System.Windows.Forms.Cursors.Hand;
resources.ApplyResources(this.btnSystem, "btnSystem");
this.btnSystem.FlatAppearance.BorderColor = System.Drawing.Color.White;
this.btnSystem.ForeColor = System.Drawing.Color.White;
this.btnSystem.Name = "btnSystem";
@ -180,16 +180,16 @@
//
// panel11
//
resources.ApplyResources(this.panel11, "panel11");
this.panel11.Controls.Add(this.btnAbout);
resources.ApplyResources(this.panel11, "panel11");
this.panel11.Name = "panel11";
//
// btnAbout
//
resources.ApplyResources(this.btnAbout, "btnAbout");
this.btnAbout.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(19)))), ((int)(((byte)(52)))), ((int)(((byte)(104)))));
this.btnAbout.ButtonType = Rs.Controls.EButtonType.About;
this.btnAbout.Cursor = System.Windows.Forms.Cursors.Hand;
resources.ApplyResources(this.btnAbout, "btnAbout");
this.btnAbout.FlatAppearance.BorderColor = System.Drawing.Color.White;
this.btnAbout.ForeColor = System.Drawing.Color.White;
this.btnAbout.Name = "btnAbout";
@ -203,16 +203,16 @@
//
// panel12
//
resources.ApplyResources(this.panel12, "panel12");
this.panel12.Controls.Add(this.btnData);
resources.ApplyResources(this.panel12, "panel12");
this.panel12.Name = "panel12";
//
// btnData
//
resources.ApplyResources(this.btnData, "btnData");
this.btnData.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(19)))), ((int)(((byte)(52)))), ((int)(((byte)(104)))));
this.btnData.ButtonType = Rs.Controls.EButtonType.Language;
this.btnData.Cursor = System.Windows.Forms.Cursors.Hand;
resources.ApplyResources(this.btnData, "btnData");
this.btnData.FlatAppearance.BorderColor = System.Drawing.Color.White;
this.btnData.ForeColor = System.Drawing.Color.White;
this.btnData.Name = "btnData";
@ -226,16 +226,16 @@
//
// panel13
//
resources.ApplyResources(this.panel13, "panel13");
this.panel13.Controls.Add(this.btnLanguage);
resources.ApplyResources(this.panel13, "panel13");
this.panel13.Name = "panel13";
//
// btnLanguage
//
resources.ApplyResources(this.btnLanguage, "btnLanguage");
this.btnLanguage.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(19)))), ((int)(((byte)(52)))), ((int)(((byte)(104)))));
this.btnLanguage.ButtonType = Rs.Controls.EButtonType.Data;
this.btnLanguage.ButtonType = Rs.Controls.EButtonType.Calib;
this.btnLanguage.Cursor = System.Windows.Forms.Cursors.Hand;
resources.ApplyResources(this.btnLanguage, "btnLanguage");
this.btnLanguage.FlatAppearance.BorderColor = System.Drawing.Color.White;
this.btnLanguage.ForeColor = System.Drawing.Color.White;
this.btnLanguage.Name = "btnLanguage";
@ -249,16 +249,16 @@
//
// panel14
//
resources.ApplyResources(this.panel14, "panel14");
this.panel14.Controls.Add(this.btnPermission);
resources.ApplyResources(this.panel14, "panel14");
this.panel14.Name = "panel14";
//
// btnPermission
//
resources.ApplyResources(this.btnPermission, "btnPermission");
this.btnPermission.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(19)))), ((int)(((byte)(52)))), ((int)(((byte)(104)))));
this.btnPermission.ButtonType = Rs.Controls.EButtonType.Permission;
this.btnPermission.Cursor = System.Windows.Forms.Cursors.Hand;
resources.ApplyResources(this.btnPermission, "btnPermission");
this.btnPermission.FlatAppearance.BorderColor = System.Drawing.Color.White;
this.btnPermission.ForeColor = System.Drawing.Color.White;
this.btnPermission.Name = "btnPermission";
@ -272,16 +272,16 @@
//
// panel15
//
resources.ApplyResources(this.panel15, "panel15");
this.panel15.Controls.Add(this.btnQuit);
resources.ApplyResources(this.panel15, "panel15");
this.panel15.Name = "panel15";
//
// btnQuit
//
resources.ApplyResources(this.btnQuit, "btnQuit");
this.btnQuit.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(19)))), ((int)(((byte)(52)))), ((int)(((byte)(104)))));
this.btnQuit.ButtonType = Rs.Controls.EButtonType.Quit;
this.btnQuit.Cursor = System.Windows.Forms.Cursors.Hand;
resources.ApplyResources(this.btnQuit, "btnQuit");
this.btnQuit.FlatAppearance.BorderColor = System.Drawing.Color.White;
this.btnQuit.ForeColor = System.Drawing.Color.White;
this.btnQuit.Name = "btnQuit";
@ -295,7 +295,6 @@
//
// panel1
//
resources.ApplyResources(this.panel1, "panel1");
this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(46)))), ((int)(((byte)(46)))), ((int)(((byte)(46)))));
this.panel1.Controls.Add(this.panel7);
this.panel1.Controls.Add(this.panel6);
@ -305,12 +304,13 @@
this.panel1.Controls.Add(this.panelEx2);
this.panel1.Controls.Add(this.tableLayoutPanel3);
this.panel1.Controls.Add(this.panelEx1);
resources.ApplyResources(this.panel1, "panel1");
this.panel1.Name = "panel1";
//
// panel7
//
resources.ApplyResources(this.panel7, "panel7");
this.panel7.Controls.Add(this.lblMonitorFlow);
resources.ApplyResources(this.panel7, "panel7");
this.panel7.Name = "panel7";
//
// lblMonitorFlow
@ -321,8 +321,8 @@
//
// panel6
//
resources.ApplyResources(this.panel6, "panel6");
this.panel6.Controls.Add(this.lblInitializeState);
resources.ApplyResources(this.panel6, "panel6");
this.panel6.Name = "panel6";
//
// lblInitializeState
@ -333,8 +333,8 @@
//
// panel5
//
resources.ApplyResources(this.panel5, "panel5");
this.panel5.Controls.Add(this.lblMemory);
resources.ApplyResources(this.panel5, "panel5");
this.panel5.Name = "panel5";
//
// lblMemory
@ -345,8 +345,8 @@
//
// panel4
//
resources.ApplyResources(this.panel4, "panel4");
this.panel4.Controls.Add(this.lblTurnoverFlow);
resources.ApplyResources(this.panel4, "panel4");
this.panel4.Name = "panel4";
//
// lblTurnoverFlow
@ -357,8 +357,8 @@
//
// panel3
//
resources.ApplyResources(this.panel3, "panel3");
this.panel3.Controls.Add(this.lblDischargeFlow);
resources.ApplyResources(this.panel3, "panel3");
this.panel3.Name = "panel3";
//
// lblDischargeFlow
@ -369,8 +369,8 @@
//
// panelEx2
//
resources.ApplyResources(this.panelEx2, "panelEx2");
this.panelEx2.Controls.Add(this.lblRunState);
resources.ApplyResources(this.panelEx2, "panelEx2");
this.panelEx2.Name = "panelEx2";
//
// lblRunState
@ -400,14 +400,14 @@
//
// panelEx1
//
resources.ApplyResources(this.panelEx1, "panelEx1");
this.panelEx1.Controls.Add(this.panel2);
resources.ApplyResources(this.panelEx1, "panelEx1");
this.panelEx1.Name = "panelEx1";
//
// panel2
//
resources.ApplyResources(this.panel2, "panel2");
this.panel2.Controls.Add(this.lblVersion);
resources.ApplyResources(this.panel2, "panel2");
this.panel2.Name = "panel2";
//
// lblVersion

File diff suppressed because it is too large Load Diff

@ -57,6 +57,7 @@
this.cboxEnableWorkEnviromentCheck = new System.Windows.Forms.CheckBox();
this.cboxDisableNPressCheck = new System.Windows.Forms.CheckBox();
this.cboxEnableTestFixtureFiberCheck = new System.Windows.Forms.CheckBox();
this.cboxEnableIndexTimeStatistics = new System.Windows.Forms.CheckBox();
this.cboxRunSpace = new System.Windows.Forms.CheckBox();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.groupBox10 = new System.Windows.Forms.GroupBox();
@ -115,7 +116,6 @@
this.txtControlCenterPort = new System.Windows.Forms.TextBox();
this.cboxEnableExceptionHandlingNozzle = new System.Windows.Forms.CheckBox();
this.cboxEnableScanBarCodeByDownCamera = new System.Windows.Forms.CheckBox();
this.cboxEnableIndexTimeStatistics = new System.Windows.Forms.CheckBox();
this.tableLayoutPanel1.SuspendLayout();
this.groupBox8.SuspendLayout();
this.groupBox2.SuspendLayout();
@ -363,6 +363,13 @@
this.cboxEnableTestFixtureFiberCheck.UseVisualStyleBackColor = true;
this.cboxEnableTestFixtureFiberCheck.CheckedChanged += new System.EventHandler(this.cbox_CheckedChanged);
//
// cboxEnableIndexTimeStatistics
//
resources.ApplyResources(this.cboxEnableIndexTimeStatistics, "cboxEnableIndexTimeStatistics");
this.cboxEnableIndexTimeStatistics.Name = "cboxEnableIndexTimeStatistics";
this.cboxEnableIndexTimeStatistics.UseVisualStyleBackColor = true;
this.cboxEnableIndexTimeStatistics.CheckedChanged += new System.EventHandler(this.cbox_CheckedChanged);
//
// cboxRunSpace
//
resources.ApplyResources(this.cboxRunSpace, "cboxRunSpace");
@ -694,6 +701,7 @@
this.groupBox4.Controls.Add(this.cboxEnableExceptionHandlingNozzle);
this.groupBox4.Controls.Add(this.cboxEnableScanBarCodeByDownCamera);
resources.ApplyResources(this.groupBox4, "groupBox4");
this.groupBox4.ForeColor = System.Drawing.Color.White;
this.groupBox4.Name = "groupBox4";
this.groupBox4.TabStop = false;
//
@ -814,13 +822,6 @@
this.cboxEnableScanBarCodeByDownCamera.Name = "cboxEnableScanBarCodeByDownCamera";
this.cboxEnableScanBarCodeByDownCamera.UseVisualStyleBackColor = true;
//
// cboxEnableIndexTimeStatistics
//
resources.ApplyResources(this.cboxEnableIndexTimeStatistics, "cboxEnableIndexTimeStatistics");
this.cboxEnableIndexTimeStatistics.Name = "cboxEnableIndexTimeStatistics";
this.cboxEnableIndexTimeStatistics.UseVisualStyleBackColor = true;
this.cboxEnableIndexTimeStatistics.CheckedChanged += new System.EventHandler(this.cbox_CheckedChanged);
//
// CommonConfig
//
resources.ApplyResources(this, "$this");

@ -124,13 +124,13 @@ namespace Rs.MotionPlat.SysConfig
{
dataGridView1.DataSource = dt;
}
if (GlobalUser.IsVender())
if (GlobalUser.IsSuper())
{
dataGridView1.Visible = true;
groupBox4.Visible = true;
}
else
{
dataGridView1.Visible = false;
groupBox4.Visible = false;
}
}
private void btnSaveSpeedParam_Click(object sender, EventArgs e)

@ -2533,7 +2533,7 @@
<value>4</value>
</data>
<data name="groupBox4.Text" xml:space="preserve">
<value>groupBox4</value>
<value>Menu</value>
</data>
<data name="&gt;&gt;groupBox4.Name" xml:space="preserve">
<value>groupBox4</value>
@ -2623,6 +2623,6 @@
<value>CommonConfig</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>Rs.MotionPlat.BaseForm, Rs.MotionPlat, Version=3.20.24.10, Culture=neutral, PublicKeyToken=null</value>
<value>Rs.MotionPlat.BaseForm, Rs.MotionPlat, Version=3.20.24.14, Culture=neutral, PublicKeyToken=null</value>
</data>
</root>

@ -14,6 +14,8 @@ namespace Rs.MotionPlat
{
public partial class UserForm : BaseFormHeader
{
public event Action<string> OnloginSuccessEvent;
public UserForm()
{
InitializeComponent();
@ -33,10 +35,11 @@ namespace Rs.MotionPlat
{
string username = cboxUsers.SelectedItem.ToString();
string userpwd = txtPassword.Text.Trim();
if(username=="操作员")
if(username=="Op")
{
if(userpwd == "123")
{
OnloginSuccessEvent?.Invoke(username);
GlobalUser.UserLevel = EUserLevel.Op;
GlobalUser.UserName = username;
this.Close();
@ -47,10 +50,11 @@ namespace Rs.MotionPlat
txtPassword.Text = "";
}
}
else if (username == "超级用户")
else if (username == "Admin")
{
if (userpwd == "lhiven@123")
{
OnloginSuccessEvent?.Invoke(username);
GlobalUser.UserLevel = EUserLevel.Admin;
GlobalUser.UserName = username;
this.Close();
@ -61,10 +65,11 @@ namespace Rs.MotionPlat
txtPassword.Text = "";
}
}
else if (username == "厂商")
else if (username == "Vender")
{
if (userpwd == "rs@rs")
{
OnloginSuccessEvent?.Invoke(username);
GlobalUser.UserLevel = EUserLevel.Vender;
GlobalUser.UserName = username;
this.Close();

@ -50,13 +50,14 @@
// cboxUsers
//
this.cboxUsers.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(11)))), ((int)(((byte)(16)))), ((int)(((byte)(36)))));
this.cboxUsers.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboxUsers.Font = new System.Drawing.Font("宋体", 15F);
this.cboxUsers.ForeColor = System.Drawing.Color.White;
this.cboxUsers.FormattingEnabled = true;
this.cboxUsers.Items.AddRange(new object[] {
"操作员",
"超级用户",
"厂商"});
"Op",
"Admin",
"Vender"});
this.cboxUsers.Location = new System.Drawing.Point(135, 77);
this.cboxUsers.Name = "cboxUsers";
this.cboxUsers.Size = new System.Drawing.Size(172, 28);
@ -108,6 +109,7 @@
//
// UserForm
//
this.AcceptButton = this.btnLogin;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(389, 236);

Loading…
Cancel
Save