private void btnApproveLogin_Click(object sender, RoutedEventArgs e) { SqlConnection co = new SqlConnection(@"HIDE"); co.Open(); SqlCommand cmd = new SqlCommand("select * from players where username='******' and password='******'", co); SqlDataReader dr; dr = cmd.ExecuteReader(); int count = 0; while (dr.Read()) { count += 1; } if (count == 1) { StringUserForNextForm = TbxUsernameLogin.Text; AfterLogin main = new AfterLogin(); App.Current.MainWindow = main; this.Close(); main.Show(); } else { LabelErrorLogin.Content = "Datele nu au fost introduse corect!"; } }
private void btnBackToLogin_Click(object sender, RoutedEventArgs e) { gameTime.Stop(); playTime = 0; AfterLogin main = new AfterLogin(); App.Current.MainWindow = main; this.Close(); main.Show(); }