Ejemplo n.º 1
0
        private void NewWordWindow()
        {
            // Create another word app screen using the same currentUser.
            Form anotherWordScreen = new WordApp(currentUser);

            anotherWordScreen.Show();
        }
Ejemplo n.º 2
0
        private void LoginButton_Click(object sender, EventArgs e)
        {
            // Get user with matching username and password from list of users (if there are any).
            User user = UserList.GetUser(UserNameInput.Text, PasswordInput.Text);

            // Show the word form if a matching user is found, othrewise show error message.
            if (user != null)
            {
                Form wordForm = new WordApp(user);
                wordForm.Show();
                Hide();
            }
            else
            {
                MessageBox.Show(
                    "Username or password is incorrect. Please try again.",
                    "Invalid Credentials",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error
                    );
            }
        }