You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
2.0 KiB
79 lines
2.0 KiB
using Models;
|
|
|
|
namespace GameAtlas.Views;
|
|
|
|
/// <summary>
|
|
/// Code-Behind pour la page de profil.
|
|
/// </summary>
|
|
public partial class PageProfil : ContentPage
|
|
{
|
|
/// <summary>
|
|
/// Gestionnaire de profil. Manager
|
|
/// </summary>
|
|
public Manager ProfilManager => (App.Current as App).MyManager;
|
|
|
|
/// <summary>
|
|
/// Constructeur de la page de profil.
|
|
/// </summary>
|
|
public PageProfil()
|
|
{
|
|
InitializeComponent();
|
|
BindingContext = ProfilManager;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Méthode appelée lorsque la page est affichée.
|
|
/// </summary>
|
|
protected override void OnAppearing()
|
|
{
|
|
base.OnAppearing();
|
|
SwitchPage();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Méthode pour basculer vers une autre page en fonction de l'utilisateur connecté.
|
|
/// </summary>
|
|
async void SwitchPage()
|
|
{
|
|
if (ProfilManager.ConnectedUser == null)
|
|
{
|
|
await Navigation.PushAsync(new PageConnexion());
|
|
}
|
|
else
|
|
{
|
|
await Shell.Current.GoToAsync("//page/PageProfil");
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Méthode appelée lorsqu'un jeu est sélectionné.
|
|
/// </summary>
|
|
async void OnGame_Tapped(System.Object sender, EventArgs e)
|
|
{
|
|
var selectedjeu = (sender as ImageButton)?.BindingContext as Jeu;
|
|
if (selectedjeu != null)
|
|
{
|
|
|
|
await Navigation.PushAsync(new PageJeu(selectedjeu));
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// Méthode appelée lorsqu'on appuie sur l'icône d'administration.
|
|
/// </summary>
|
|
async void OnAdmin_Tapped(System.Object sender, Microsoft.Maui.Controls.TappedEventArgs e)
|
|
{
|
|
await Shell.Current.GoToAsync(nameof(PageAdmin));
|
|
}
|
|
|
|
/// <summary>
|
|
/// Méthode appelée lorsqu'on appuie sur l'icône de déconnexion.
|
|
/// </summary>
|
|
async void OnDisconnect_Tapped(System.Object sender, Microsoft.Maui.Controls.TappedEventArgs e)
|
|
{
|
|
await Shell.Current.GoToAsync("//page/PageAccueil");
|
|
ProfilManager.ConnectedUser = null;
|
|
ProfilManager.IsConnected = false;
|
|
}
|
|
} |