Ajout connectedUser. Système de connexion
continuous-integration/drone/push Build is failing Details

pull/49/head
Rémi LAVERGNE 2 years ago
parent 14beb13e02
commit 1078d4a5ad

@ -35,6 +35,11 @@
<ShellContent
Title="Profil"
Icon="account"
ContentTemplate="{DataTemplate views:PageProfil}"
Route="PageProfil" />
<ShellContent
Title="Connexion"
Icon="account"
ContentTemplate="{DataTemplate views:PageConnexion}"
Route="PageConnexion" />
</TabBar>

@ -12,8 +12,20 @@ namespace GameAtlas.Models
public List<Jeu> ListJeux { get; private set; }
public List<Admin> Admins { get; private set; }
public List<Utilisateur> 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)
{

@ -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;
}
}

@ -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);
}
}

@ -32,7 +32,7 @@
</Grid>
<VerticalStackLayout Grid.Column="1" VerticalOptions="Center" Spacing="3">
<Label Text="Pseudonyme" FontSize="20" FontFamily="AladinRegular" TextColor="{StaticResource Black}"/>
<Label Text="{Binding ConnectedUser.Pseudo}" FontSize="20" FontFamily="AladinRegular" TextColor="{StaticResource Black}"/>
<Label Text="Compte créé le 13/01/2023" FontSize="12" FontFamily="RobotoRegular" TextColor="{StaticResource Black}"/>
</VerticalStackLayout>
@ -66,7 +66,7 @@
<Label Text="Liste de profil" FontFamily="PTSansCBold" FontSize="24" TextColor="{StaticResource Black}" HorizontalOptions="Center"/>
<Grid>
<CollectionView ItemsSource="{Binding ListeFavoris}" Margin="0,10,0,0" VerticalScrollBarVisibility="Never">
<CollectionView ItemsSource="{Binding ConnectedUser.ListeFavoris}" Margin="0,10,0,0" VerticalScrollBarVisibility="Never">
<CollectionView.ItemTemplate>
<DataTemplate>
<Border HeightRequest="97.5" StrokeShape="RoundRectangle 5" VerticalOptions="Start" HorizontalOptions="Center">

Loading…
Cancel
Save