private void FinishGame(bool win) { try { if (win) { PlayerDAO.InsertPlayerScore(_player.Score, _player.PlayerId); int historicalScore = PlayerDAO.BestScore(_player.PlayerId); //La variable top almacena si el jugador se encuentra posicionado en el Top 10 o no. bool top = false; List <Player> top10 = PlayerDAO.GetTop10PlayersList(); top10.ForEach(player => { if (string.Equals(player.Name, _player.Name, StringComparison.OrdinalIgnoreCase)) { top = true; } }); String result = $"Score: {_player.Score} \nBest score: {historicalScore} " + $"\n{(top ? "You are in the top 10!" : "You are not in the top 10. :(")}"; if (MessageBox.Show(result, "ARKANOID", MessageBoxButtons.OK, MessageBoxIcon.Information) == DialogResult.OK) { ((Form)Parent).Close(); } } else { throw new NoLivesException($"You've lost. Thank you for playing! " + $"\nScore: {_player.Score}"); } } catch (NoLivesException ex) { _musicPlayer = new SoundPlayer("../../Resources/GameOverMusic.wav"); _musicPlayer.Play(); if (MessageBox.Show(ex.Message, "ARKANOID", MessageBoxButtons.OK, MessageBoxIcon.Information) == DialogResult.OK) { ((Form)Parent).Close(); } } }