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;
|
||||
|
||||
namespace MauiSpark.Vues;
|
||||
|
||||
public partial class JetonVue : ContentView
|
||||
{
|
||||
public static readonly BindableProperty CouleurProperty = BindableProperty.Create(nameof(Couleur), typeof(Color), typeof(JetonVue), default(Color), propertyChanged: QuandCouleurChangee);
|
||||
|
||||
public Color Couleur
|
||||
{
|
||||
get => (Color)GetValue(CouleurProperty);
|
||||
set => SetValue(CouleurProperty, Color.FromRgb(0, 255, 0));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
using CoreLibrary.Core;
|
||||
using CoreLibrary.Exceptions;
|
||||
using MauiSpark.Convertisseurs;
|
||||
using System.Globalization;
|
||||
|
||||
namespace MauiSpark.Vues;
|
||||
|
||||
public partial class JetonVue : ContentView
|
||||
{
|
||||
public static readonly BindableProperty CouleurProperty = BindableProperty.Create(nameof(Couleur), typeof(Color), typeof(JetonVue), default(Color), propertyChanged: QuandCouleurChangee);
|
||||
public static readonly BindableProperty CodeProperty = BindableProperty.Create(nameof(Code), typeof(Code), typeof(JetonVue), null, propertyChanged: QuandCodeChange);
|
||||
|
||||
public Color Couleur
|
||||
{
|
||||
get => (Color)GetValue(CouleurProperty);
|
||||
set => SetValue(CouleurProperty, value);
|
||||
}
|
||||
|
||||
public Code? Code
|
||||
{
|
||||
get => (Code?)GetValue(CodeProperty);
|
||||
set => SetValue(CodeProperty, value);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
((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