Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public event System.EventHandler LoginSuccess;
- public event System.EventHandler LoginFail;
- public string UserNameLabel
- {
- get { return userNameLabel.Text; }
- set { userNameLabel.Text = value; }
- }
- public string PasswordLabel
- {
- get { return passwordLabel.Text; }
- set { passwordLabel.Text = value; }
- }
- public string LoginButtonText
- {
- get { return loginButton.Text; }
- set { loginButton.Text = value; }
- }
- [Browsable(false)]
- public string UserNameText
- {
- set { userNameText.Text = value; }
- }
- [Browsable(false)]
- public string PasswordText
- {
- set { passwordText.Text = value; }
- }
- private bool userNameAndPasswordAreValid(string userName, string password)
- {
- return password.Equals("TrustMe");
- }
- private void UserControl1_Load(object sender, EventArgs e)
- {
- }
- private void loginButton_Click(object sender, EventArgs e)
- {
- if (userNameText.Text.Length == 0)
- {
- loginProviderError.SetError(userNameText, "Please enter a user name");
- return;
- }
- if (passwordText.Text.Length == 0)
- {
- loginProviderError.SetError(passwordText, "Please enter a password");
- return;
- }
- if (userNameAndPasswordAreValid(userNameText.Text, passwordText.Text))
- {
- if (LoginSuccess != null)
- {
- LoginSuccess(this, new System.EventArgs());
- }
- }
- else
- {
- if (LoginFail != null)
- {
- LoginFail(this, new System.EventArgs());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement