diff --git a/Sources/MauiSpark/Pages/PlateauPage.xaml b/Sources/MauiSpark/Pages/PlateauPage.xaml index 4b5e23d..7491d88 100644 --- a/Sources/MauiSpark/Pages/PlateauPage.xaml +++ b/Sources/MauiSpark/Pages/PlateauPage.xaml @@ -59,7 +59,7 @@ BindableLayout.ItemsSource="{Binding [0]}"> - + diff --git a/Sources/MauiSpark/Pages/PlateauPage.xaml.cs b/Sources/MauiSpark/Pages/PlateauPage.xaml.cs index e6fd132..1367b3c 100644 --- a/Sources/MauiSpark/Pages/PlateauPage.xaml.cs +++ b/Sources/MauiSpark/Pages/PlateauPage.xaml.cs @@ -24,7 +24,7 @@ internal class Tour (IEnumerable, IEnumerable)[] plateau = new (IEnumerable, IEnumerable)[e.Grille.Count()]; for (int i = 0; i < e.Grille.Count(); ++i) { - plateau[i] = (e.Grille.ElementAt(i).Where(x => x.HasValue).Select(x => x!.Value), e.Indicateurs.ElementAt(i)); + plateau[i] = ([new Jeton(Couleur.ROUGE), new Jeton(Couleur.VERT), new Jeton(Couleur.BLEU), new Jeton(Couleur.JAUNE)], e.Indicateurs.ElementAt(i)); } Plateau = plateau; } diff --git a/Sources/MauiSpark/Resources/Styles/Styles.xaml b/Sources/MauiSpark/Resources/Styles/Styles.xaml index e08fe8d..d54d87a 100644 --- a/Sources/MauiSpark/Resources/Styles/Styles.xaml +++ b/Sources/MauiSpark/Resources/Styles/Styles.xaml @@ -43,4 +43,8 @@ + + diff --git a/Sources/MauiSpark/Vues/JetonVue.xaml.cs b/Sources/MauiSpark/Vues/JetonVue.xaml.cs index 1634905..bc686a5 100644 --- a/Sources/MauiSpark/Vues/JetonVue.xaml.cs +++ b/Sources/MauiSpark/Vues/JetonVue.xaml.cs @@ -1,13 +1,15 @@ +using Microsoft.Maui.Controls.Shapes; + namespace MauiSpark.Vues; public partial class JetonVue : ContentView { - public static readonly BindableProperty CouleurPropriete = BindableProperty.Create(nameof(Couleur), typeof(Color), typeof(JetonVue), default(Color), propertyChanged: QuandCouleurChange); + public static readonly BindableProperty CouleurProperty = BindableProperty.Create(nameof(Couleur), typeof(Color), typeof(JetonVue), default(Color), propertyChanged: QuandCouleurChangee); - public Color? Couleur + public Color Couleur { - get => (Color?)GetValue(CouleurPropriete); - set => SetValue(CouleurPropriete, value); + get => (Color)GetValue(CouleurProperty); + set => SetValue(CouleurProperty, Color.FromRgb(0, 255, 0)); } public JetonVue() @@ -22,26 +24,8 @@ public partial class JetonVue : ContentView Cercle.WidthRequest = Cercle.HeightRequest = taille; } - private static void QuandCouleurChange(BindableObject bindable, object oldValue, object newValue) - { - var view = bindable as JetonVue; - if (view != null) - { - view.UpdateCouleur(); - } - } - - private void UpdateCouleur() - { - // Gérer la couleur null - if (Couleur == null) - { - // Définir une couleur par défaut si null - BackgroundColor = Colors.Transparent; // Ou toute autre couleur par défaut - } - else - { - BackgroundColor = Couleur; - } + private static void QuandCouleurChangee(BindableObject bindable, object ancienneValeur, object nouvelleValeur) + { + ((JetonVue)bindable).Cercle.Fill = (Color) nouvelleValeur; } } \ No newline at end of file