using CoreLibrary.Evenements; using CoreLibrary.Joueurs; namespace MauiSpark.Pages; public partial class ConnexionPage : ContentPage { private int? indice; private Joueur? joueurDemande; public ConnexionPage() { NavigationPage.SetHasNavigationBar(this, false); InitializeComponent(); } public async void QuandDemanderNom(Object? sender, PartieDemanderJoueurEventArgs e) { if(Application.Current != null && Application.Current.MainPage != null && ((NavigationPage)Application.Current.MainPage).CurrentPage != this) await Application.Current.MainPage.Navigation.PushAsync(this); Nom.Text = ""; indice = e.Indice; joueurDemande = e.JoueurDemande; BindingContext = $"Joueur {e.Indice}"; } private void QuandSeConnecterPresse(Object sender, EventArgs e) { if (joueurDemande == null || indice == null) return; if (string.IsNullOrEmpty(Nom.Text)) { joueurDemande.SeConnecter(new Joueur($"Joueur {indice.Value}")); } else { joueurDemande.SeConnecter(MauiProgram.Manageur.DemanderJoueur(Nom.Text)); } } }