using QwirkleClassLibrary.Players; using QwirkleClassLibrary.Games; using QwirkleClassLibrary.Boards; using System.Collections.ObjectModel; using System.ComponentModel; using System.Linq; namespace Qwirkle.Views; public partial class Scoreboard : ContentView, INotifyPropertyChanged { private Game game = ((App)Application.Current!).Game; private IOrderedEnumerable> scoreboard; private ObservableCollection>? scoreboardList; public ObservableCollection> ScoreboardList { get => scoreboardList!; set { if (scoreboardList != value) { scoreboardList = value; OnPropertyChanged(nameof(ScoreboardList)); } } } public Scoreboard() { InitializeComponent(); BindingContext = this; scoreboard = game.ScoreBoard.OrderByDescending(x => x.Value).ThenBy(x => x.Key); ScoreboardList = new ObservableCollection>(scoreboard); } public event PropertyChangedEventHandler? PropertyChanged; protected void OnPropertyChanged(string propertyName) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } }