You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sae201_qwirkle/Qwirkle/QwirkleViews/PopUpEndGame.xaml.cs

41 lines
1.0 KiB

using CommunityToolkit.Maui.Views;
using Microsoft.Maui.Controls;
using QwirkleClassLibrary.Games;
using System.Collections.ObjectModel;
namespace Qwirkle;
public partial class PopUpEndGame : Popup
{
public PopUpEndGame()
{
InitializeComponent();
var scoreboard = game.ObservableScoreBoard.OrderByDescending(x => x.Value).ThenBy(x => x.Key);
ScoreboardList = new ObservableCollection<KeyValuePair<string, int>>(scoreboard);
}
private Game game = ((App)Application.Current!).Game;
private ObservableCollection<KeyValuePair<string, int>>? scoreboardList;
public ObservableCollection<KeyValuePair<string, int>>? ScoreboardList
{
get => scoreboardList;
set
{
if (scoreboardList != value)
{
scoreboardList = value;
OnPropertyChanged(nameof(ScoreboardList));
}
}
}
public async void OnButtonNextClick(object sender, EventArgs e)
{
Close();
await Shell.Current.GoToAsync("MainPage");
}
}