using MisDataName; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading; using System.Windows.Forms; using SystemFramework; namespace MisDataName { public partial class MainLockConfirm : Form { MisData Mainform; Form SecondForm; public MainLockConfirm() { InitializeComponent(); textBox_PassWord.Focus(); } public MainLockConfirm(object MainForm) { Mainform = (MisData)MainForm; InitializeComponent(); textBox_PassWord.Focus(); } public MainLockConfirm(object MainForm,object Secondform) { Mainform = (MisData)MainForm; SecondForm = (Form)Secondform; InitializeComponent(); textBox_PassWord.Focus(); } private void button_OK_Click(object sender, EventArgs e) { try { if (textBox_PassWord.Text == "") { MessageBox.Show("密码不能为空!"); return; } if (textBox_PassWord.Text == textBox_PassWordConfirm.Text) { Mainform.BeginInvoke(MisData.MainFormLock); MisMenuFunHash.PassWord_Write("MainFormLock", textBox_PassWord.Text); this.Close(); Thread t = new Thread(OpenLockForm_Thread); t.Start(); if (MisData.SecondFormClose != null) SecondForm.BeginInvoke(MisData.SecondFormClose); } else { MessageBox.Show("密码不一致,请重新输入!"); } } catch (Exception err) { ApplicationLog.WriteLog(err, err.Message); } } void OpenLockForm_Thread() { MainLockForm LockFork = new MainLockForm(Mainform); LockFork.ShowDialog(); } private void button_Cancel_Click(object sender, EventArgs e) { this.Close(); this.Dispose(); } private void checkBox_ShowPWD_CheckedChanged(object sender, EventArgs e) { try { if (checkBox_ShowPWD.Checked) { textBox_PassWord.UseSystemPasswordChar = false; textBox_PassWordConfirm.UseSystemPasswordChar = false; } else { textBox_PassWord.UseSystemPasswordChar = true; textBox_PassWordConfirm.UseSystemPasswordChar = true ; } } catch (Exception err) { ApplicationLog.WriteLog(err, err.Message); } } } }