Compare commits

..

1 Commits

Author SHA1 Message Date
Rémi LAVERGNE dca28921fc Display the profile picture and pseudo on the Main Page only if connected
continuous-integration/drone/push Build is passing Details
10 months ago

@ -23,7 +23,7 @@
RowDefinitions="auto, auto, auto, auto, auto, auto, *"> RowDefinitions="auto, auto, auto, auto, auto, auto, *">
<Grid HorizontalOptions="Start" Padding="25,20,0,20"> <Grid HorizontalOptions="Start" Padding="25,20,0,20" IsVisible="{Binding IsConnected}">
<HorizontalStackLayout Spacing="10"> <HorizontalStackLayout Spacing="10">
<Frame Grid.Row="0" WidthRequest="50" HeightRequest="50" CornerRadius="25" VerticalOptions="Start" > <Frame Grid.Row="0" WidthRequest="50" HeightRequest="50" CornerRadius="25" VerticalOptions="Start" >
<Frame.Background> <Frame.Background>
@ -35,11 +35,12 @@
</LinearGradientBrush> </LinearGradientBrush>
</Frame.Background> </Frame.Background>
<Frame HeightRequest="48" WidthRequest="48" CornerRadius="24" VerticalOptions="Center" HorizontalOptions="Center" IsClippedToBounds="True"> <Frame HeightRequest="48" WidthRequest="48" CornerRadius="24" VerticalOptions="Center" HorizontalOptions="Center" IsClippedToBounds="True">
<Image Source="{Binding AccueilManager.ConnectedUser.PhotoProfil}" Aspect="AspectFill"/> <Image Source="{Binding ConnectedUser.PhotoProfil}" Aspect="AspectFill"/>
</Frame> </Frame>
</Frame> </Frame>
<Label Text="{Binding AccueilManager.ConnectedUser.Pseudo}" FontSize="18" FontFamily="AladinRegular" TextColor="{StaticResource Black}" VerticalTextAlignment="Center"/> <Label Text="{Binding ConnectedUser.Pseudo}" FontSize="18" FontFamily="AladinRegular" TextColor="{StaticResource Black}" VerticalTextAlignment="Center"/>
</HorizontalStackLayout> </HorizontalStackLayout>
</Grid> </Grid>
@ -52,7 +53,7 @@
/> />
<ScrollView Orientation="Horizontal" Grid.Row="4" Padding="20,0,20,0" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" HorizontalScrollBarVisibility="Never"> <ScrollView Orientation="Horizontal" Grid.Row="4" Padding="20,0,20,0" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" HorizontalScrollBarVisibility="Never">
<HorizontalStackLayout BindableLayout.ItemsSource="{Binding AccueilManager.ListJeuxAffiches}" Spacing="15"> <HorizontalStackLayout BindableLayout.ItemsSource="{Binding ListJeuxAffiches}" Spacing="15">
<BindableLayout.ItemTemplate> <BindableLayout.ItemTemplate>
<DataTemplate> <DataTemplate>
<Grid> <Grid>
@ -106,7 +107,7 @@
/> />
<Grid Grid.Row="6" Padding="0,0,0,20"> <Grid Grid.Row="6" Padding="0,0,0,20">
<VerticalStackLayout Spacing="30" BindableLayout.ItemsSource="{Binding AccueilManager.TopRatedGames}"> <VerticalStackLayout Spacing="30" BindableLayout.ItemsSource="{Binding TopRatedGames}">
<BindableLayout.ItemTemplate> <BindableLayout.ItemTemplate>
<DataTemplate> <DataTemplate>
<Grid ColumnDefinitions="auto,*,auto"> <Grid ColumnDefinitions="auto,*,auto">

@ -16,7 +16,7 @@ public partial class PageAcceuil : ContentPage
{ {
InitializeComponent(); InitializeComponent();
BindingContext = this; BindingContext = AccueilManager;
} }
private async void OnProfil_Tapped(object sender, EventArgs e) private async void OnProfil_Tapped(object sender, EventArgs e)

@ -110,6 +110,7 @@ public partial class PageConnexion : ContentPage
{ {
Debug.WriteLine("Mot de Passe verifié et valide"); Debug.WriteLine("Mot de Passe verifié et valide");
ConnexionManager.ConnectedUser = user; ConnexionManager.ConnectedUser = user;
ConnexionManager.IsConnected = true;
return true; return true;
} }
} }
@ -117,6 +118,7 @@ public partial class PageConnexion : ContentPage
Debug.WriteLine("La connexion a échoué (pseudo ou mot de passe invalide)"); Debug.WriteLine("La connexion a échoué (pseudo ou mot de passe invalide)");
DisplayAlert("Erreur", "Utilisateur ou Mot de Passe invalide.", "Ok"); DisplayAlert("Erreur", "Utilisateur ou Mot de Passe invalide.", "Ok");
ConnexionManager.ConnectedUser = null; ConnexionManager.ConnectedUser = null;
ConnexionManager.IsConnected = false;
return false; return false;
} }

@ -74,5 +74,6 @@ public partial class PageProfil : ContentPage
{ {
await Shell.Current.GoToAsync("//page/PageAccueil"); await Shell.Current.GoToAsync("//page/PageAccueil");
ProfilManager.ConnectedUser = null; ProfilManager.ConnectedUser = null;
ProfilManager.IsConnected = false;
} }
} }

@ -78,6 +78,20 @@ namespace Models
} }
} }
private bool _isConnected;
/// <summary>
/// Indique si un utilisateur est connecté sur l'application.
/// </summary>
public bool IsConnected
{
get => _isConnected;
set
{
_isConnected = value;
OnPropertyChanged();
}
}
/// <summary> /// <summary>
/// Gestionnaire de persistance utilisé pour charger et sauvegarder les donnees. /// Gestionnaire de persistance utilisé pour charger et sauvegarder les donnees.
/// </summary> /// </summary>
@ -116,6 +130,7 @@ namespace Models
Admins = new List<Admin>(); Admins = new List<Admin>();
ListJeux = new ObservableCollection<Jeu>(); ListJeux = new ObservableCollection<Jeu>();
Persistance = persistance; Persistance = persistance;
IsConnected = false;
ConnectedUser = null; ConnectedUser = null;
} }
@ -127,6 +142,7 @@ namespace Models
ListJeux = new ObservableCollection<Jeu>(); ListJeux = new ObservableCollection<Jeu>();
Admins = new List<Admin>(); Admins = new List<Admin>();
Utilisateurs = new List<Utilisateur>(); Utilisateurs = new List<Utilisateur>();
IsConnected = false;
ConnectedUser = null; ConnectedUser = null;
} }

Loading…
Cancel
Save