..
continuous-integration/drone/push Build is failing Details

test_old_branch
Jérémy Mouyon 11 months ago
parent 3bd5625035
commit b97c02db00

@ -8,13 +8,14 @@
<VerticalStackLayout MaximumWidthRequest="200" Background="Transparent">
<CollectionView ItemsSource="{Binding ScoreboardList}">
<CollectionView ItemsSource="{Binding ScoreboardList}" BindingContext="{x:Reference root}">
<CollectionView.ItemsLayout>
<GridItemsLayout Orientation="Vertical"/>
</CollectionView.ItemsLayout>
<CollectionView.ItemTemplate>
<DataTemplate>
<controls:ScoreboardLine Nameplayer="{Binding Key.NameTag}"></controls:ScoreboardLine>
<controls:ScoreboardLine Nameplayer="{Binding Key}" Score="{Binding Value}"/>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>

@ -3,6 +3,7 @@ using QwirkleClassLibrary.Games;
using QwirkleClassLibrary.Boards;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
namespace Qwirkle.Views;
@ -12,10 +13,10 @@ public partial class Scoreboard : ContentView, INotifyPropertyChanged
private IOrderedEnumerable<KeyValuePair<string, int>> scoreboard;
private ObservableCollection<KeyValuePair<string, int>> scoreboardList;
private ObservableCollection<KeyValuePair<string, int>>? scoreboardList;
public ObservableCollection<KeyValuePair<string, int>> ScoreboardList
{
get => scoreboardList;
get => scoreboardList!;
set
{
if (scoreboardList != value)
@ -34,13 +35,6 @@ public partial class Scoreboard : ContentView, INotifyPropertyChanged
scoreboard = game.ScoreBoard.OrderByDescending(x => x.Value).ThenBy(x => x.Key);
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;

@ -19,9 +19,8 @@
<Label
Grid.Column="2"
Text="0"
Text="{Binding Score, Source={x:Reference root}}"
Style="{StaticResource ContentTab}"/>
</Grid>
<Rectangle/>
</StackLayout>

@ -1,27 +1,12 @@
using QwirkleClassLibrary.Games;
using QwirkleClassLibrary.Players;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Qwirkle.Views;
public partial class ScoreboardLine : ContentView
namespace Qwirkle.Views
{
public ScoreboardLine()
public partial class ScoreboardLine : ContentView
{
InitializeComponent();
BindingContext = this;
}
public static readonly BindableProperty NameplayerProperty =
BindableProperty.Create(nameof(Nameplayer), typeof(string), typeof(ScoreboardLine), default(string), propertyChanged: OnPlayerChanged);
public string Nameplayer
{
get => (string)GetValue(NameplayerProperty);
@ -34,5 +19,25 @@ public partial class ScoreboardLine : ContentView
bin.OnPropertyChanged(nameof(Nameplayer));
}
public static readonly BindableProperty ScoreProperty =
BindableProperty.Create(nameof(Score), typeof(int), typeof(ScoreboardLine), default(int), propertyChanged: OnScoreChanged);
public int Score
{
get => (int)GetValue(ScoreProperty);
set => SetValue(ScoreProperty, value);
}
private static void OnScoreChanged(BindableObject bindable, object oldValue, object newValue)
{
var bin = (ScoreboardLine)bindable;
bin.OnPropertyChanged(nameof(Score));
}
public ScoreboardLine()
{
InitializeComponent();
BindingContext = this;
}
}
}
Loading…
Cancel
Save