Example #1
0
        private void pbPlay_Click(object sender, EventArgs e)
        {
            SqlConnection  con = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Andi\Desktop\Heroe\Heroe\Database1.mdf;Integrated Security=True");
            SqlDataAdapter sda = new SqlDataAdapter("Select * From UserInfo where Username='******' and Password='******'", con);

            if (txtPassword.Text == null && txtUsername.Text == null)
            {
                MessageBox.Show("Pleas enter password or username!", "Eror", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                DataTable dt = new DataTable();
                sda.Fill(dt);
                if (dt.Rows.Count == 1)
                {
                    using (ChooseGameMode ChooseGameModeForm = new ChooseGameMode())
                    {
                        if (ChooseGameModeForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            ChooseGameModeForm.Show();
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Wrong username or password!", "Eror", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Example #2
0
 private void pbGuest_Click(object sender, EventArgs e)
 {
     using (ChooseGameMode ChooseGameModeForm = new ChooseGameMode())
     {
         if (ChooseGameModeForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             ChooseGameModeForm.Show();
         }
     }
 }
Example #3
0
 private void materialLabel1_Click(object sender, EventArgs e)
 {
     using (ChooseGameMode chooseGameModeForm = new ChooseGameMode())
     {
         if (chooseGameModeForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             this.Hide();
             chooseGameModeForm.ShowDialog();
             chooseGameModeForm.Close();
         }
     }
 }