static bool Prefix1(RollingBar __instance, OneArmBandit ___oneArmBandit) { if (!Main.enabled) { return(true); } ___oneArmBandit.RollingEnd(); return(false); }
private void btnLogIn_Click(object sender, EventArgs e) { var userName = this.txbUserName.Text; var passWord = this.txbPassWord.Text; var IsSavePWD = this.chkSavePWD.Checked; var errorId = 0; var isLogin = false; string[] infoList = { "1", "haiyabtx", "password", "2", "系统管理员", "2016-12-14", "2016-12-14" }; #region 验证用户名和密码不能为空 if (string.IsNullOrEmpty(userName)) { DialogResult result; result = MessageBox.Show("用户名不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); if (result == DialogResult.OK) { if (!this.prbLoading.ContainsFocus) { this.FindForm().Activate(); } this.txbUserName.Focus(); } return; } if (string.IsNullOrEmpty(passWord)) { DialogResult result; result = MessageBox.Show("密码不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); if (result == DialogResult.OK) { if (!this.prbLoading.ContainsFocus) { this.FindForm().Activate(); } this.txbPassWord.Focus(); } return; } #endregion //登入判定 //isLogin = WebClient.Login(userName, passWord, out errorId, out infoList); isLogin = LoginInfo.ClientLogin(userName, passWord, out errorId, out infoList, FirstFlag); if (isLogin) { FirstFlag = false; //登入成功 RegistryKey rsg = null; rsg = Registry.Users.OpenSubKey(LoginInfo.RegeditPathString, true);//true表示可以修改 if (LoginInfo.IsManager == false) { #region 注册表写入用户名跟密码 rsg.SetValue("username", userName); //写入注册表 rsg.SetValue("password", passWord); //写入注册表 rsg.SetValue("issavepsd", chkSavePWD.Checked); //写入注册表 rsg.SetValue("first", FirstFlag); //写入注册表 #endregion } else { rsg.SetValue("issavepsd", chkSavePWD.Checked); //写入注册表 rsg.SetValue("first", FirstFlag); //写入注册表 } btnLogIn.Enabled = false; btnLogOut.Enabled = false; txbPassWord.Enabled = false; txbUserName.Enabled = false; RollingBar.Visible = true; RollingBar.StartRolling(); Thread thread = new Thread(new ThreadStart(Send)); thread.Start(); LoginInfo.UserName = rsg.GetValue("username") as string ?? "管理员"; LoginInfo.PassWord = rsg.GetValue("password") as string ?? "dugu"; rsg.Close(); } else { //登入失败 var result = MessageBox.Show(string.Format("用户登入失败,{0}!", loginMessage[errorId]), "提示", MessageBoxButtons.OK); this.txbPassWord.Focus(); } }