diff --git a/GameAtlas/GameAtlas/AppShell.xaml b/GameAtlas/GameAtlas/AppShell.xaml index b2ff4c2..381d174 100644 --- a/GameAtlas/GameAtlas/AppShell.xaml +++ b/GameAtlas/GameAtlas/AppShell.xaml @@ -35,6 +35,11 @@ + diff --git a/GameAtlas/GameAtlas/Models/Manager.cs b/GameAtlas/GameAtlas/Models/Manager.cs index 235409c..5f4bf7d 100644 --- a/GameAtlas/GameAtlas/Models/Manager.cs +++ b/GameAtlas/GameAtlas/Models/Manager.cs @@ -12,8 +12,20 @@ namespace GameAtlas.Models public List ListJeux { get; private set; } public List Admins { get; private set; } public List Utilisateurs { get; private set; } + public IPersistanceManager Persistance { get; set; } + public Utilisateur ConnectedUser + { + get => connectedUser; + set + { + connectedUser = value; + //OnPropertyChanged(); + } + } + private Utilisateur connectedUser; + public Manager(IPersistanceManager persistance) { diff --git a/GameAtlas/GameAtlas/Views/PageConnexion.xaml.cs b/GameAtlas/GameAtlas/Views/PageConnexion.xaml.cs index 5d13115..69d0fb6 100644 --- a/GameAtlas/GameAtlas/Views/PageConnexion.xaml.cs +++ b/GameAtlas/GameAtlas/Views/PageConnexion.xaml.cs @@ -1,8 +1,13 @@ namespace GameAtlas.Views; + +using GameAtlas.Models; +using System.Diagnostics; using System.Text.RegularExpressions; public partial class PageConnexion : ContentPage { + + public Manager ConnexionManager => (App.Current as App).MyManager; public PageConnexion() { InitializeComponent(); @@ -21,7 +26,26 @@ public partial class PageConnexion : ContentPage return; } + Verification(username, password); await Navigation.PushAsync(new PageAcceuil()); } + + public bool Verification(string username, string password) + { + foreach (Utilisateur user in ConnexionManager.Utilisateurs) + { + if (user.Pseudo == username) + { + Debug.WriteLine($"Pseudo \"{user.Pseudo}\" vérifié et valide"); + if (user.Mdp == password) + { + Debug.WriteLine("Mot de Passe verifié et valide"); + ConnexionManager.ConnectedUser = user; + return true; + } + } + } + return false; + } } \ No newline at end of file diff --git a/GameAtlas/GameAtlas/Views/PageJeu.xaml.cs b/GameAtlas/GameAtlas/Views/PageJeu.xaml.cs index 3127271..acef4df 100644 --- a/GameAtlas/GameAtlas/Views/PageJeu.xaml.cs +++ b/GameAtlas/GameAtlas/Views/PageJeu.xaml.cs @@ -33,7 +33,10 @@ public partial class PageJeu : ContentPage string action = await DisplayActionSheet("Choix de la liste:", "Annuler", null, "Mes Favoris", "Jeux Possédés", "Ma Wishlist"); Debug.WriteLine("Popup Action: " + action); - //if (action == "") + if (action == "Mes Favoris") + { + JeuManager.ConnectedUser.ListeFavoris.Add(JeuModel); + } } diff --git a/GameAtlas/GameAtlas/Views/PageProfil.xaml b/GameAtlas/GameAtlas/Views/PageProfil.xaml index 8a4e2b6..738fc73 100644 --- a/GameAtlas/GameAtlas/Views/PageProfil.xaml +++ b/GameAtlas/GameAtlas/Views/PageProfil.xaml @@ -32,7 +32,7 @@ - @@ -66,7 +66,7 @@