private void textBox1_Leave(object sender, EventArgs e) //判断输入密码和原来的密码 { if (textBox1.Text == "") { pictureBox1.Visible = false; } string strPassword = ""; RegistryKey MyReg1, RegPassword; MyReg1 = Registry.CurrentUser; RegPassword = MyReg1.CreateSubKey("Software\\Aurora\\Locker"); try { strPassword = RegPassword.GetValue("Password").ToString(); } catch { } if (textBox1.Text == strPassword) // || textBox1.Text == "Administrator") { pictureBox1.Visible = true; pictureBox1.Image = Properties.Resources.Right; Flag1 = 1; textBox2.Enabled = true; textBox3.Enabled = true; } else { pictureBox1.Visible = true; pictureBox1.Image = Properties.Resources.Wrong; //MessageBox.Show("原密码输入错误", "Aurora智能提示"); textBox2.Enabled = false; textBox3.Enabled = false; } }
private void Locker_Activated(object sender, EventArgs e) //旧坐标需要在此获取 { if (Thread.CurrentThread.CurrentUICulture.ToString() == "zh-CN") { this.Text = "Aurora智能数据锁 ● 正在积极的保护您的数据"; } else if (Thread.CurrentThread.CurrentUICulture.ToString() == "zh-Hant") { this.Text = "Aurora智慧資料鎖 ● 正在積極的保護您的資料"; } else //if (Thread.CurrentThread.CurrentUICulture.ToString() == "en") { this.Text = "Aurora Intelligent Data Locker ● is Protecting Your Data Positively"; } PreviousX = Control.MousePosition.X; PreviousY = Control.MousePosition.Y; RegistryKey MyReg1, RegPassword; MyReg1 = Registry.CurrentUser; RegPassword = MyReg1.CreateSubKey("Software\\Aurora\\Locker"); try { label1.Text = RegPassword.GetValue("ShowText").ToString(); } catch { } }
private void button1_Click(object sender, EventArgs e) //和注册表Locker\\Password对比,一样可以退出。 { string strPassword = ""; RegistryKey MyReg1, RegPassword; MyReg1 = Registry.CurrentUser; RegPassword = MyReg1.CreateSubKey("Software\\Aurora\\Locker"); try { strPassword = RegPassword.GetValue("Password").ToString(); } catch { } if (textBox1.Text == strPassword) // || textBox1.Text == "Administrator") { this.Close(); PublicClass.Locker.Hide(); PublicClass.AuroraMain.Show(); PublicClass.AuroraMain.Activate(); //为毛焦点不能到主窗体上去。退出Locker后按任意键仍然弹出密码框。 PublicClass.AuroraMain.WindowState = FormWindowState.Normal; System.Windows.Forms.Cursor.Show(); //显示鼠标 } else { if (Thread.CurrentThread.CurrentUICulture.ToString() == "zh-CN") { label1.Text = "输入密码不正确,请重新输入。"; } else if (Thread.CurrentThread.CurrentUICulture.ToString() == "zh-Hant") { label1.Text = "輸入密碼不正確,請重新輸入。"; } else //if (Thread.CurrentThread.CurrentUICulture.ToString() == "en") { label1.Text = "Incorrect password, please try again."; } textBox1.Clear(); textBox1.Focus(); } }