From 06c57cc9cbf36163cb3386ba5150b24573f8f848 Mon Sep 17 00:00:00 2001 From: Nicolas BLONDEAU Date: Mon, 5 Jun 2023 18:54:55 +0200 Subject: [PATCH] =?UTF-8?q?Je=20sais=20pas=20quoi=20mettre,=20j'ai=20juste?= =?UTF-8?q?=20avanc=C3=A9=20:tada:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/Persistance/MonsterManager.cs | 2 +- Sources/Vues/Inscription.xaml.cs | 24 +++++++++++++++--------- Sources/Vues/SearchMob.xaml.cs | 8 +++++++- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/Sources/Persistance/MonsterManager.cs b/Sources/Persistance/MonsterManager.cs index 799eec5..55fbb23 100644 --- a/Sources/Persistance/MonsterManager.cs +++ b/Sources/Persistance/MonsterManager.cs @@ -42,7 +42,7 @@ namespace Persistance where m.Name.Contains(texte, System.StringComparison.CurrentCultureIgnoreCase) select m).ToList(); // LINQ return new ObservableCollection(listMonstre); - } + } //BINDER DIRECTEMENT ICI public MonsterManager(IMonsterDataManager dataMngr) { diff --git a/Sources/Vues/Inscription.xaml.cs b/Sources/Vues/Inscription.xaml.cs index c69c86c..8eef910 100644 --- a/Sources/Vues/Inscription.xaml.cs +++ b/Sources/Vues/Inscription.xaml.cs @@ -1,5 +1,7 @@ using Model; using Persistance; +using static System.Runtime.InteropServices.JavaScript.JSType; + namespace Vues; public partial class Inscription : ContentPage @@ -20,30 +22,34 @@ public partial class Inscription : ContentPage mdp = Mdp.Text; nom = Nom.Text; prenom = Prenom.Text; + User newUser = new User { }; if ((Application.Current as App).userManager.checkIfPseudoExists(id)) { + resultLabel.Text = "Error, this username is already taken!"; resultLabel.IsVisible = true; return; //await Navigation.PushAsync(new SearchMob()); } try { - User newUser = new User(id, nom, prenom, mdp); + newUser = new User(id, nom, prenom, mdp); + (Application.Current as App).userManager.ListUsers.Add(newUser); + (Application.Current as App).User = newUser; + await Navigation.PopAsync(); } - catch (FormatException) + catch (ArgumentException) { resultLabel.IsVisible = true; - resultLabel.Text = "You must complete all entries!"; + resultLabel.Text = "Vous devez compléter tous les champs."; } - catch (ArgumentException) + catch (FormatException) { resultLabel.IsVisible = true; - resultLabel.Text = "You "; + resultLabel.Text = "Votre identifiant / mot de passe ne peut contenir seulement des nombres !"; } - - (Application.Current as App).userManager.ListUsers.Add(newUser); - (Application.Current as App).User = newUser; - await Navigation.PopAsync(); + //resultLabel.IsVisible = true; + //resultLabel.Text = "You must complete all entries!"; + //resultLabel.IsVisible = true; return; } diff --git a/Sources/Vues/SearchMob.xaml.cs b/Sources/Vues/SearchMob.xaml.cs index f23068b..b9c1565 100644 --- a/Sources/Vues/SearchMob.xaml.cs +++ b/Sources/Vues/SearchMob.xaml.cs @@ -21,11 +21,11 @@ public partial class SearchMob : ContentPage, INotifyPropertyChanged set { searchText = value; - MnstrTemp = (Application.Current as App).monsterManager.search(searchText); if (searchText == "") { MnstrTemp = (Application.Current as App).monsterManager.ListMonsters; } + else MnstrTemp = (Application.Current as App).monsterManager.search(searchText); UpdateAffichMobs(); OnPropertyChanged(nameof(MnstrTemp)); } @@ -39,6 +39,10 @@ public partial class SearchMob : ContentPage, INotifyPropertyChanged ListViewMonsters.BindingContext = this; searchBar.BindingContext = this; imageCollection.BindingContext = this; + if ((Application.Current as App).User != null) + { + + } } public void OnClick(object sender, ItemTappedEventArgs e) @@ -51,6 +55,7 @@ public partial class SearchMob : ContentPage, INotifyPropertyChanged var button = sender as Button; // Afficher les champs ŕ remplir pour ajouter un conseil + //FAIRE UN FUCKING X:NAME :> var addConseilLayout = button?.Parent?.FindByName("AddConseilLayout"); if (addConseilLayout != null) { @@ -63,6 +68,7 @@ public partial class SearchMob : ContentPage, INotifyPropertyChanged private void OnValiderConseilClicked(object sender, EventArgs e) { var button = sender as Button; + //FAIRE UN FUCKING ICI AUSSI X:NAME :> var addConseilLayout = button?.Parent?.FindByName("AddConseilLayout"); if (addConseilLayout != null)