|
|
@ -3,6 +3,7 @@ using QwirkleClassLibrary.Games;
|
|
|
|
using QwirkleClassLibrary.Boards;
|
|
|
|
using QwirkleClassLibrary.Boards;
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
using System.ComponentModel;
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Qwirkle.Views;
|
|
|
|
namespace Qwirkle.Views;
|
|
|
|
|
|
|
|
|
|
|
@ -12,10 +13,10 @@ public partial class Scoreboard : ContentView, INotifyPropertyChanged
|
|
|
|
|
|
|
|
|
|
|
|
private IOrderedEnumerable<KeyValuePair<string, int>> scoreboard;
|
|
|
|
private IOrderedEnumerable<KeyValuePair<string, int>> scoreboard;
|
|
|
|
|
|
|
|
|
|
|
|
private ObservableCollection<KeyValuePair<string, int>> scoreboardList;
|
|
|
|
private ObservableCollection<KeyValuePair<string, int>>? scoreboardList;
|
|
|
|
public ObservableCollection<KeyValuePair<string, int>> ScoreboardList
|
|
|
|
public ObservableCollection<KeyValuePair<string, int>> ScoreboardList
|
|
|
|
{
|
|
|
|
{
|
|
|
|
get => scoreboardList;
|
|
|
|
get => scoreboardList!;
|
|
|
|
set
|
|
|
|
set
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (scoreboardList != value)
|
|
|
|
if (scoreboardList != value)
|
|
|
@ -34,13 +35,6 @@ public partial class Scoreboard : ContentView, INotifyPropertyChanged
|
|
|
|
scoreboard = game.ScoreBoard.OrderByDescending(x => x.Value).ThenBy(x => x.Key);
|
|
|
|
scoreboard = game.ScoreBoard.OrderByDescending(x => x.Value).ThenBy(x => x.Key);
|
|
|
|
ScoreboardList = new ObservableCollection<KeyValuePair<string, int>>(scoreboard);
|
|
|
|
ScoreboardList = new ObservableCollection<KeyValuePair<string, int>>(scoreboard);
|
|
|
|
|
|
|
|
|
|
|
|
game.Board.PropertyChanged += Board_PropertyChanged;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void Board_PropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
scoreboard = game.ScoreBoard.OrderByDescending(x => x.Value).ThenBy(x => x.Key.NameTag);
|
|
|
|
|
|
|
|
ScoreboardList = new ObservableCollection<KeyValuePair<string, int>>(scoreboard);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public event PropertyChangedEventHandler? PropertyChanged;
|
|
|
|
public event PropertyChangedEventHandler? PropertyChanged;
|
|
|
|