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.4 KiB
45 lines
1.4 KiB
using CoreLibrary;
|
|
using CoreLibrary.Events;
|
|
|
|
namespace MauiSpark.Pages;
|
|
|
|
public partial class Victoire : ContentPage
|
|
{
|
|
public Victoire()
|
|
{
|
|
NavigationPage.SetHasNavigationBar(this, false);
|
|
|
|
InitializeComponent();
|
|
}
|
|
|
|
public async void QuandPartieTerminee(object? sender, PartieTermineeEventArgs e)
|
|
{
|
|
if (Application.Current == null || Application.Current.MainPage == null)
|
|
return;
|
|
|
|
if (((NavigationPage)Application.Current.MainPage).CurrentPage != this)
|
|
await Application.Current.MainPage.Navigation.PushAsync(this);
|
|
|
|
IEnumerable<Page> pages = Application.Current.MainPage.Navigation.NavigationStack.Reverse().Skip(1);
|
|
|
|
foreach (Page page in pages)
|
|
{
|
|
if (page is Accueil)
|
|
break;
|
|
|
|
Application.Current.MainPage.Navigation.RemovePage(page);
|
|
}
|
|
|
|
if(e.Gagnants.Count() == 1)
|
|
BindingContext = ("Victoire", $"Le joueur {e.Gagnants.First().Nom} a gagné");
|
|
else if(e.Gagnants.Count() > 1)
|
|
BindingContext = ("Egalité", $"Les joueurs {string.Join(' ', e.Gagnants)} ont gagné");
|
|
else
|
|
BindingContext = ("Défaite", "Personne n'a trouvé le code...");
|
|
}
|
|
|
|
public async void QuandMenuPresse(object sender, EventArgs e)
|
|
{
|
|
await Navigation.PopAsync();
|
|
}
|
|
} |