Amelioration de la connexion(Change automatiquement la PageProfil/PageConnexion si user connecté) + Navigation TabBar #55

Merged
yvan.calatayud merged 1 commits from yvan into master 2 years ago

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

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

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

@ -41,7 +41,9 @@ public partial class PageConnexion : ContentPage
connexionWorked = Verification(username, password);
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);
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)

@ -9,8 +9,21 @@ public partial class PageProfil : ContentPage
{
InitializeComponent();
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)
{
await Shell.Current.GoToAsync(nameof(PageJeu));

Loading…
Cancel
Save