private void RegButton_Click(object sender, EventArgs e) { regMessageTextBox.Text = ""; loginMessageTextBox.Text = ""; string username = usernameRegTextBox.Text; string password = passwordRegTextBox.Text; if (string.IsNullOrWhiteSpace(usernameRegTextBox.Text) || string.IsNullOrWhiteSpace(passwordRegTextBox.Text)) { regMessageTextBox.Text = "Fältet för användarnamn eller lösenord är tomt."; } else { Player play = controller.FindPlayer(username, password); if (play != null) { regMessageTextBox.Text = "Användarnamn är upptaget."; } else { controller.AddPlayer(username, password); controller.UpdateNewPlayerHighscore(username, 1, 1); Plays pl = controller.FindPlayerInTblPlays(username); Plays plays = controller.FindPlayerPoints(pl); currentPlayerPoints = plays.points; currentPlayerUsername = username; this.Hide(); new View.LoggedInForm(username, currentPlayerPoints).Show(); } } }
private void backToStartButton_Click(object sender, EventArgs e) { Plays pl = controller.FindPlayerInTblPlays(tempUsername); Plays plays = controller.FindPlayerPoints(pl); highscore = plays.points; this.Hide(); new LoggedInForm(tempUsername, highscore).Show(); }
private void Timer_Tick(object sender, EventArgs e) { if (timeLeft > 0) { timeLeft--; tickingTimeLabel.Text = timeLeft.ToString(); } if (timeLeft == 0) { timer.Stop(); Plays pl = controller.FindPlayerInTblPlays(currentPlayerUsername); Plays plays = controller.FindPlayerPoints(pl); highschore = plays.points; this.Hide(); new ScoreForm(currentSum, currentPlayerUsername, highschore).Show(); } }
private void BackButton_Click(object sender, EventArgs e) { Plays player = controller.FindPlayerInTblPlays(tempUsername); Plays plays = controller.FindPlayerPoints(player); currentHighscore = plays.points; //currentHighscore = player.points; //player.points = currentHighscore; if (tempNewPoints > currentHighscore) { controller.UpdatePlayerHighscore(tempNewPoints, player); newHighscore = tempNewPoints; this.Hide(); new LoggedInForm(tempUsername, newHighscore).Show(); } else { newHighscore = currentHighscore; this.Hide(); new LoggedInForm(tempUsername, newHighscore).Show(); } }