private void btnBack_Click(object sender, EventArgs e)
        {
            formMainMenu mainMenu = new formMainMenu(this);

            this.Close();
            mainMenu.Show();
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            this.Hide();



            formMainMenu mainMenuFrm = new formMainMenu();

            mainMenuFrm.Show();
        }
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            MarioCraftModel ctx         = new MarioCraftModel();
            GAMEUSER        addGameUser = new GAMEUSER();

            var user = from u in ctx.GAMEUSERs where u.USEREMAIL == txtEmail.Text select u;

            //check if user email matches database
            var userExist = user.FirstOrDefault(a => a.USEREMAIL.Equals(txtEmail.Text));

            //if either email or password field empty display error message
            if (txtEmail.Text.Equals("") && txtPassword.Text.Equals(""))
            {
                MessageBox.Show("Email and Password field must not be empty", "Email or Password field empty",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtEmail.Focus();
                return;
            }

            //if email matches records in database
            if (userExist != null)
            {
                //if password matches records in database
                if (userExist.USERPASSWORD.Equals(txtPassword.Text))
                {
                    MessageBox.Show("Game User already exist, please log in", "Registeration error",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);

                    formMainMenu mainMenu = new formMainMenu(this);
                    this.Close();
                    mainMenu.Show();
                }
            }
            else //insert user
            {
                using (var context = new MarioCraftModel())
                {
                    addGameUser.USEREMAIL    = txtEmail.Text;
                    addGameUser.USERPASSWORD = txtPassword.Text;

                    try
                    {
                        context.GAMEUSERs.Add(addGameUser);
                        context.SaveChanges();
                        MessageBox.Show(addGameUser.USEREMAIL + "\n" + addGameUser.USERPASSWORD + "\n" +
                                        "You have Successfully Registered, Please log in", "Registered", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        formMainMenu mainMenu = new formMainMenu(this);
                        this.Close();
                        mainMenu.Show();

                        ClearForm();
                    }

                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.GetBaseException().ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }