using System; using System.Windows.Forms; using TBF.Resources; namespace TBF.Forms { public partial class EnterPasswordDlg : Form { /// /// If set, this is the password that should be entered by the user to pass, /// otherwise user has to enter the current user password (Entities.User.CurrentUser). /// public string Password; public EnterPasswordDlg() { InitializeComponent(); } private void PasswordDlg_Load(object sender, EventArgs e) { Text = Strings.Enter_password; passwordLabel.Text = Strings.Password; okButton.Text = Strings.OkBtnText; cancelButton.Text = Strings.CancelBtnText; } private void okButton_Click(object sender, EventArgs e) { if ((Password != null && Password.Equals(passwordTextBox.Text)) || (Password == null && Entities.User.CurrentUser.CheckPassword(passwordTextBox.Text))) { DialogResult = DialogResult.OK; Close(); return; } MessageBox.Show(Strings.Invalid_password, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error); DialogResult = DialogResult.None; } private void cancelButton_Click(object sender, EventArgs e) { DialogResult = DialogResult.Cancel; Close(); } } }