Amelioration de la connexion(Change automatiquement la PageProfil/PageConnexion si user connecté) + Navigation TabBar
continuous-integration/drone/push Build is failing Details

pull/55/head
Yvan CALATAYUD 2 years ago
parent a03af5178f
commit 0f69d9c87c

@ -21,7 +21,7 @@
</ResourceDictionary> </ResourceDictionary>
</Shell.Resources> </Shell.Resources>
<TabBar> <TabBar Route="page">
<ShellContent <ShellContent
Title="Accueil" Title="Accueil"
Icon="home" Icon="home"
@ -37,11 +37,11 @@
Icon="account" Icon="account"
ContentTemplate="{DataTemplate views:PageProfil}" ContentTemplate="{DataTemplate views:PageProfil}"
Route="PageProfil" /> Route="PageProfil" />
<ShellContent <!--<ShellContent
Title="Connexion" Title="Connexion"
Icon="account" Icon="account"
ContentTemplate="{DataTemplate views:PageConnexion}" ContentTemplate="{DataTemplate views:PageConnexion}"
Route="PageConnexion" /> Route="PageConnexion" />-->
</TabBar> </TabBar>

@ -1,13 +1,15 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq; using System.Linq;
using System.Runtime.CompilerServices;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace GameAtlas.Models namespace GameAtlas.Models
{ {
public class Manager public class Manager : INotifyPropertyChanged
{ {
public List<Jeu> ListJeux { get; private set; } public List<Jeu> ListJeux { get; private set; }
public List<Admin> Admins { get; private set; } public List<Admin> Admins { get; private set; }
@ -21,23 +23,29 @@ namespace GameAtlas.Models
set set
{ {
connectedUser = value; connectedUser = value;
//OnPropertyChanged(); OnPropertyChanged();
} }
} }
private Utilisateur connectedUser; private Utilisateur connectedUser;
public event PropertyChangedEventHandler? PropertyChanged;
void OnPropertyChanged([CallerMemberName] string propertyName = null)
=> PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
public Manager(IPersistanceManager persistance) public Manager(IPersistanceManager persistance)
{ {
Utilisateurs = new List<Utilisateur>(); Utilisateurs = new List<Utilisateur>();
ListJeux = new List<Jeu>(); ListJeux = new List<Jeu>();
Persistance = persistance; Persistance = persistance;
ConnectedUser = null;
} }
public Manager() { public Manager() {
ListJeux = new List<Jeu>(); ListJeux = new List<Jeu>();
Admins = new List<Admin>(); Admins = new List<Admin>();
Utilisateurs = new List<Utilisateur>(); Utilisateurs = new List<Utilisateur>();
ConnectedUser = null;
} }
public void AddJeux(Jeu jeux) public void AddJeux(Jeu jeux)

@ -39,7 +39,7 @@
/> />
<Label <Label
Text="Pseudonyme" Text="{Binding ConnectedUser.Pseudo}"
FontFamily="AladinRegular" FontFamily="AladinRegular"
FontSize="18" FontSize="18"
Grid.Row="1" Grid.Row="1"

@ -41,7 +41,9 @@ public partial class PageConnexion : ContentPage
connexionWorked = Verification(username, password); connexionWorked = Verification(username, password);
if (connexionWorked) if (connexionWorked)
{ {
await Navigation.PushAsync(new PageAcceuil()); //await Navigation.PushAsync(new PageAcceuil());
await Navigation.PopAsync();
//await Shell.Current.GoToAsync("//page/PageAccueil");
} }
} }

@ -48,7 +48,8 @@ public partial class PageInscription : ContentPage
//PersistanceManager.SauvegardeUser(utilisateur); //PersistanceManager.SauvegardeUser(utilisateur);
Debug.WriteLine(InscriptionManager.Utilisateurs.Count); Debug.WriteLine(InscriptionManager.Utilisateurs.Count);
await Navigation.PushAsync(new PageAcceuil()); //await Navigation.PushAsync(new PageAcceuil());
await Shell.Current.GoToAsync("//page/PageAccueil");
bool IsPasswordStrong(string password) bool IsPasswordStrong(string password)

@ -9,6 +9,19 @@ public partial class PageProfil : ContentPage
{ {
InitializeComponent(); InitializeComponent();
BindingContext = ProfilManager; BindingContext = ProfilManager;
SwitchPage();
}
async void SwitchPage()
{
if (ProfilManager.ConnectedUser == null)
{
await Navigation.PushAsync(new PageConnexion());
}
else
{
await Shell.Current.GoToAsync("//page/PageProfil");
}
} }
async void OnGame_Tapped(System.Object sender, Microsoft.Maui.Controls.TappedEventArgs e) async void OnGame_Tapped(System.Object sender, Microsoft.Maui.Controls.TappedEventArgs e)

Loading…
Cancel
Save