private void backButton_Click(object sender, EventArgs e)
        {
            timer1.Stop();

            using (WelcomeForm wF1 = new WelcomeForm())
            {
                this.Hide();
                wF1.ShowDialog();
                this.Close();
            }
        }
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (CheckTheAnswer(this.level))
            {
                timer1.Stop();
                MessageBox.Show("You got all the answers right!",
                                "Congratulations");

                UserInformation.Level = ++this.level;
                WriteNewLevelToFile();
                using (WelcomeForm wF1 = new WelcomeForm())
                {
                    this.Hide();
                    wF1.ShowDialog();
                    this.Close();
                }
            }
            else if (timeLeft > 0)
            {
                timeLeft--;
                timeLabel.Text = timeLeft + " seconds";
            }
            else
            {
                timer1.Stop();
                timeLabel.Text = "Time's up!";
                MessageBox.Show("You didn't finish in time.", "Sorry");
               // startButton.Enabled = true;

                using (WelcomeForm wF1 = new WelcomeForm())
                {
                    this.Hide();
                    wF1.ShowDialog();
                    this.Close();
                }
            }
        }
 private void submitButton_Click(object sender, EventArgs e)
 {
     if (isUsernameAndPasswordAlreadyExists(userNameTextBox.Text, passwordTextBox.Text) == true)
     {
         //MessageBox.Show("OK");
         //UserInformation uI1 = new UserInformation(userNameTextBox.Text, UsersCurrentLevel(userNameTextBox.Text));
         UserInformation.User = userNameTextBox.Text;
         UserInformation.Level = UsersCurrentLevel(userNameTextBox.Text);
         using (WelcomeForm wF1 = new WelcomeForm())
         {
             this.Hide();
             wF1.ShowDialog();
             this.Close();
         }
     }
     else
     {
         MessageBox.Show("Credentials do not match anyone in database!",
             "Important", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (CheckTheAnswer(this.level))
            {
                // If the user got the answer right, stop the timer
                // and show a MessageBox.
                timer1.Stop();
                MessageBox.Show("You got all the answers right!",
                                "Congratulations");

                UserInformation.Level = ++this.level;
                WriteNewLevelToFile();
                using (WelcomeForm wF1 = new WelcomeForm())
                {
                    this.Hide();
                    wF1.ShowDialog();
                    this.Close();
                }
            }
            else if (timeLeft > 0)
            {
                // Decrease the time left by one second and display
                // the new time left by updating the Time Left label.
                timeLeft--;
                timeLabel.Text = timeLeft + " seconds";
            }
            else
            {
                // If the user ran out of time, stop the timer, show
                // a MessageBox, and fill in the answers.
                timer1.Stop();
                timeLabel.Text = "Time's up!";
                MessageBox.Show("You didn't finish in time.", "Sorry");
                // startButton.Enabled = true;

                using (WelcomeForm wF1 = new WelcomeForm())
                {
                    this.Hide();
                    wF1.ShowDialog();
                    this.Close();
                }
            }
        }
        protected void submitButton_Click(object sender, EventArgs e)
        {
            bool passwordCorrect = true;
            //isUsernameAlreadyExists(userNameTextBox.Text);
            if (userNameTextBox.Text != "" && isUsernameAlreadyExists(userNameTextBox.Text) == false)
            {
                if (passwordTextBox.Text != "" && rePasswordTextBox.Text != "")
                {
                    if (passwordTextBox.Text == rePasswordTextBox.Text)
                    {
                        PasswordVerifier pv1 = new PasswordVerifier(passwordTextBox.Text);
                        if (!pv1.IsCharacterLengthCorrect())
                        {
                            passwordCorrect = false;
                            MessageBox.Show("Password must include at least six characters!",
                                "Important", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        if (!pv1.IsUpperLowerCharacterCaseAmountCorrect())
                        {
                            passwordCorrect = false;
                            MessageBox.Show
                                ("Password must include at least one uppercase letter and one lowercase letter!",
                                "Important", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        if (!pv1.IsDigitAmountCorrect())
                        {
                            passwordCorrect = false;
                            MessageBox.Show("Password must include at least one digit!",
                                "Important", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    else
                    {
                        passwordCorrect = false;
                        MessageBox.Show("The two passwords entered do not match each other!",
                            "Important", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    passwordCorrect = false;
                    MessageBox.Show("Neither password box can be empty!",
                        "Important", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                if (userNameTextBox.Text == "")
                {
                    passwordCorrect = false;
                    MessageBox.Show("Username cannot be empty!",
                        "Important", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    passwordCorrect = false;
                    MessageBox.Show("Username already exists!",
                        "Important", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }

            if (passwordCorrect == true)
            {
                WriteToFlatFile(userNameTextBox.Text, passwordTextBox.Text);
                //UserInformation uI1 = new UserInformation(userNameTextBox.Text, 1);
                UserInformation.User = userNameTextBox.Text;
                UserInformation.Level = 1;
                using (WelcomeForm wF1 = new WelcomeForm())
                {
                    this.Hide();
                    wF1.ShowDialog();
                    this.Close();
                }
            }
        }