continuer page plateau
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
parent
643a15c879
commit
d336cb4e92
@ -1,31 +1,66 @@
|
|||||||
using Microsoft.Maui.Controls.Shapes;
|
using CoreLibrary.Core;
|
||||||
|
using CoreLibrary.Exceptions;
|
||||||
namespace MauiSpark.Vues;
|
using MauiSpark.Convertisseurs;
|
||||||
|
using System.Globalization;
|
||||||
public partial class JetonVue : ContentView
|
|
||||||
{
|
namespace MauiSpark.Vues;
|
||||||
public static readonly BindableProperty CouleurProperty = BindableProperty.Create(nameof(Couleur), typeof(Color), typeof(JetonVue), default(Color), propertyChanged: QuandCouleurChangee);
|
|
||||||
|
public partial class JetonVue : ContentView
|
||||||
public Color Couleur
|
{
|
||||||
{
|
public static readonly BindableProperty CouleurProperty = BindableProperty.Create(nameof(Couleur), typeof(Color), typeof(JetonVue), default(Color), propertyChanged: QuandCouleurChangee);
|
||||||
get => (Color)GetValue(CouleurProperty);
|
public static readonly BindableProperty CodeProperty = BindableProperty.Create(nameof(Code), typeof(Code), typeof(JetonVue), null, propertyChanged: QuandCodeChange);
|
||||||
set => SetValue(CouleurProperty, Color.FromRgb(0, 255, 0));
|
|
||||||
}
|
public Color Couleur
|
||||||
|
{
|
||||||
public JetonVue()
|
get => (Color)GetValue(CouleurProperty);
|
||||||
{
|
set => SetValue(CouleurProperty, value);
|
||||||
InitializeComponent();
|
}
|
||||||
BindingContext = this;
|
|
||||||
}
|
public Code? Code
|
||||||
|
{
|
||||||
private void QuandTailleChangee(object sender, EventArgs e)
|
get => (Code?)GetValue(CodeProperty);
|
||||||
{
|
set => SetValue(CodeProperty, value);
|
||||||
double taille = Math.Min(Grid.Width, Grid.Height) / 2;
|
}
|
||||||
Cercle.WidthRequest = Cercle.HeightRequest = taille;
|
|
||||||
}
|
public JetonVue()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
BindingContext = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void QuandTailleChangee(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
double taille = Math.Min(Grid.Width, Grid.Height) / 2;
|
||||||
|
Cercle.WidthRequest = Cercle.HeightRequest = taille;
|
||||||
|
}
|
||||||
|
|
||||||
private static void QuandCouleurChangee(BindableObject bindable, object ancienneValeur, object nouvelleValeur)
|
private static void QuandCouleurChangee(BindableObject bindable, object ancienneValeur, object nouvelleValeur)
|
||||||
{
|
{
|
||||||
((JetonVue)bindable).Cercle.Fill = (Color) nouvelleValeur;
|
if (((Color)nouvelleValeur).Red != 0 || ((Color)nouvelleValeur).Green != 0 || ((Color)nouvelleValeur).Blue != 0)
|
||||||
}
|
{
|
||||||
|
((JetonVue)bindable).Cercle.Fill = (Color)nouvelleValeur;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void QuandCodeChange(BindableObject bindable, object ancienneValeur, object nouvelleValeur)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void JetonPresse(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (Cercle == null || !sender.Equals(Cercle) || Code == null || Application.Current == null || Application.Current.MainPage == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Couleur couleur = (Couleur)new CouleurVersCouleurMAUI().ConvertBack(Cercle.Fill, typeof(Couleur), null, CultureInfo.InvariantCulture);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Code.AjouterJeton(new Jeton(couleur));
|
||||||
|
}
|
||||||
|
catch (CodeCompletException)
|
||||||
|
{
|
||||||
|
Application.Current.MainPage.DisplayAlert("Attention", "La code est plein", "OK");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in new issue