using Rs.Framework; using Rs.MotionPlat.Commom; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Rs.MotionPlat { public partial class UserForm : BaseFormHeader { public event Action OnloginSuccessEvent; public UserForm() { InitializeComponent(); } private void btnCancle_Click(object sender, EventArgs e) { this.Close(); } private void UserForm_Load(object sender, EventArgs e) { cboxUsers.SelectedIndex = 0; } private void btnLogin_Click(object sender, EventArgs e) { string username = cboxUsers.SelectedItem.ToString(); string userpwd = txtPassword.Text.Trim(); if(username=="Op") { if(userpwd == "1") { OnloginSuccessEvent?.Invoke(username); GlobalUser.UserLevel = EUserLevel.Op; GlobalUser.UserName = username; this.Close(); } else { Msgbox.ShowTipDialog( EButtonType.Ok, "userpwd error,please input again"); txtPassword.Text = ""; } } else if (username == "Admin") { if (userpwd == "lhiven@123") { OnloginSuccessEvent?.Invoke(username); GlobalUser.UserLevel = EUserLevel.Admin; GlobalUser.UserName = username; this.Close(); } else { Msgbox.ShowTipDialog(EButtonType.Ok, "userpwd error,please input again"); txtPassword.Text = ""; } } else if (username == "Vender") { if (userpwd == "1") { OnloginSuccessEvent?.Invoke(username); GlobalUser.UserLevel = EUserLevel.Vender; GlobalUser.UserName = username; this.Close(); } else { Msgbox.ShowTipDialog(EButtonType.Ok, "userpwd error,please input again"); txtPassword.Text = ""; } } } } }