You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.4 KiB
53 lines
1.4 KiB
using CoreLibrary.Evenements;
|
|
using CoreLibrary.Joueurs;
|
|
|
|
namespace MauiSpark.Pages;
|
|
|
|
/// <summary>
|
|
/// Page de connexions où l'on rentre les joueurs de la partie
|
|
/// </summary>
|
|
public partial class ConnexionPage : ContentPage
|
|
{
|
|
/// <summary>
|
|
/// Indice du joueur à rentré.
|
|
/// </summary>
|
|
private int? indice;
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
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));
|
|
}
|
|
}
|
|
} |