private void btnLogin_Click(object sender, EventArgs e)
        {
            if (login.Authorize() == null)
            {
                MessageBox.Show("Error please enter a username and password", "Failed Authorization", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (login.Authorize() == false)
            {
                MessageBox.Show("Authorization Unsuccessful please try again", "Failed Authorization", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                MessageBox.Show("Authorization Successful");

                Application.Exit();
            }
            txtPassword.Text = "";
            txtUsername.Text = "";
            txtUsername.Focus();
        }
示例#2
0
        static void Main(string[] args)
        {
            LoginValidator login = new LoginValidator();
            string         check;
            int            success = 0;

            while (success == 0)
            {
                Console.Write("Enter username: "******"Enter password: "******"Please enter a username and password\n");
                }
                else if (isAuthorized == false)
                {
                    Console.Write("Authorization has failed\n");
                }
                else
                {
                    Console.Write("Authorization has been successful\n");
                    success = 1;
                }
            }
            Console.ReadKey();
        }