From 7aa5f738c313326cf31fdf1376cea6412a9cc0c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi?= Date: Fri, 7 Jun 2024 17:16:04 +0200 Subject: [PATCH] =?UTF-8?q?Titre=20de=20r=C3=A8gles=20en=20blanc,=20suppre?= =?UTF-8?q?ssion=20des=20espaces=20au=20d=C3=A9but=20et=20=C3=A0=20la=20fi?= =?UTF-8?q?n=20des=20pseudo=20et=20ajout=20d'un=20popup=20quand=20l'on=20v?= =?UTF-8?q?eut=20supprimer=20un=20pseudo=20qui=20n'existe=20pas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/Trek-12/Models/Game/Player.cs | 3 +++ source/Trek-12/Trek-12/Views/pageProfiles.xaml.cs | 11 ++++++++++- source/Trek-12/Trek-12/Views/pageRegles.xaml | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/source/Trek-12/Models/Game/Player.cs b/source/Trek-12/Models/Game/Player.cs index cb8f095..2650a0e 100644 --- a/source/Trek-12/Models/Game/Player.cs +++ b/source/Trek-12/Models/Game/Player.cs @@ -59,6 +59,9 @@ namespace Models.Game /// The profile picture of the player. public Player(string pseudo, string profilePicture) { + //char[] trim = { ' ', '\n', '\t' }; + //Pseudo = pseudo.Trim(); + //Pseudo = Pseudo.TrimEnd(trim); Pseudo = pseudo; ProfilePicture = profilePicture; CreationDate = DateTime.Now.ToString("dd/MM/yyyy"); diff --git a/source/Trek-12/Trek-12/Views/pageProfiles.xaml.cs b/source/Trek-12/Trek-12/Views/pageProfiles.xaml.cs index cb45c7a..0d1d71e 100644 --- a/source/Trek-12/Trek-12/Views/pageProfiles.xaml.cs +++ b/source/Trek-12/Trek-12/Views/pageProfiles.xaml.cs @@ -25,6 +25,9 @@ public partial class PageProfiles : ContentPage async void Button_ClickedAdd(System.Object sender, System.EventArgs e) { string pseudo = await DisplayPromptAsync("Info", $"Choose a name : ", "Ok"); + char[] trim = { ' ', '\n', '\t' }; + pseudo = pseudo.TrimEnd(trim); + pseudo = pseudo.TrimStart(trim); if (pseudo == null) return; if (ProfileManager.Players.Any(p => p.Pseudo == pseudo)) { @@ -64,7 +67,13 @@ public partial class PageProfiles : ContentPage Debug.WriteLine("bam, deleted"); OnPropertyChanged(nameof(ProfileManager)); } - else Debug.WriteLine("Player not found"); + else + { + await DisplayAlert("Info", "This name do not exist", "Ok"); + Debug.WriteLine("Player not found"); + return; + } + } diff --git a/source/Trek-12/Trek-12/Views/pageRegles.xaml b/source/Trek-12/Trek-12/Views/pageRegles.xaml index 5bafd57..f04ec61 100644 --- a/source/Trek-12/Trek-12/Views/pageRegles.xaml +++ b/source/Trek-12/Trek-12/Views/pageRegles.xaml @@ -12,7 +12,7 @@ -