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.
45 lines
1.1 KiB
45 lines
1.1 KiB
using CoreLibrary.Events;
|
|
using CoreLibrary.Joueurs;
|
|
using Microsoft.UI.Xaml.Documents;
|
|
|
|
namespace MauiSpark.Pages;
|
|
|
|
|
|
public partial class ConnexionPage : ContentPage
|
|
{
|
|
private JoueurBuilder? joueurBuilder;
|
|
private int? indice;
|
|
|
|
public ConnexionPage()
|
|
{
|
|
NavigationPage.SetHasNavigationBar(this, false);
|
|
|
|
InitializeComponent();
|
|
}
|
|
|
|
public async void QuandDemanderNom(Object? sender, DemanderNomEventArgs e)
|
|
{
|
|
if(Application.Current != null && Application.Current.MainPage != null && ((NavigationPage)Application.Current.MainPage).CurrentPage != this)
|
|
await Application.Current.MainPage.Navigation.PushAsync(this);
|
|
|
|
Nom.Text = "";
|
|
joueurBuilder = e.JoueurBuilder;
|
|
indice = e.Indice;
|
|
BindingContext = $"Joueur {e.Indice}";
|
|
}
|
|
|
|
private void QuandSeConnecterPresse(Object sender, EventArgs e)
|
|
{
|
|
if(joueurBuilder != null)
|
|
{
|
|
if(string.IsNullOrEmpty(Nom.Text))
|
|
{
|
|
joueurBuilder.Joueur(new Joueur($"Joueur {indice}"));
|
|
}
|
|
else
|
|
{
|
|
joueurBuilder.Joueur(MauiProgram.Manageur.DemanderJoueur(Nom.Text));
|
|
}
|
|
}
|
|
}
|
|
} |