private void OpenHighScore(object obj) { HighScoreWindow highScore = new HighScoreWindow(); highScore.Show(); mainWindow.Close(); }
private void SelectSide() { if (GameModel.SelectSide()) { tbRedScore.Text = GameModel.RedScore.ToString(); tbBlueScore.Text = GameModel.BlueScore.ToString(); if (GameOver()) { canvas.Children.Clear(); DrawSquares(); DrawGrid(); var score = new Score(); if (GameModel.RedScore > GameModel.BlueScore) { MessageBox.Show($"{tbRedName.Text} WIN!"); score.Name = tbRedName.Text; score.Value = GameModel.RedScore; } else if (GameModel.RedScore < GameModel.BlueScore) { MessageBox.Show($"{tbBlueName.Text} WIN!"); score.Name = tbBlueName.Text; score.Value = GameModel.BlueScore; } else { MessageBox.Show("It's a DRAW!"); } score.Date = DateTime.Now; score.MaxScore = GameModel.RedScore + GameModel.BlueScore; score.Square = !GameModel.Rombus; if (score.Name != "Computer" || _multiplayer) { ScoresRepository.StoreScore(score); } var scoreWindow = new HighScoreWindow(); scoreWindow.Show(); this.Close(); //NewGame(); } } }
private void BtnHighScores_Click(object sender, RoutedEventArgs e) { HighScoreWindow highScoreWindow = new HighScoreWindow(this.highScore); highScoreWindow.Show(); }