Merge pull request 'Actualisation pageAccueil lors de l'ajout d'un jeu par l'admin' (#63) from yvan into master
continuous-integration/drone/push Build is failing Details

Reviewed-on: remi.lavergne/SAE2.01-IHM_-_Remi_LAVERGNE_-_Yvan_CALATAYUD#63
pull/64/head^2
Rémi LAVERGNE 2 years ago
commit a08f6802b4

@ -15,6 +15,39 @@ namespace GameAtlas.Models
public List<Admin> Admins { get; private set; } public List<Admin> Admins { get; private set; }
public List<Utilisateur> Utilisateurs { get; private set; } public List<Utilisateur> Utilisateurs { get; private set; }
private ObservableCollection<Jeu> topRatedGames;
public ObservableCollection<Jeu> TopRatedGames
{
get
{
return topRatedGames = new ObservableCollection<Jeu>(ListJeux.OrderByDescending(jeu => jeu.Note).Take(4));
}
set
{
topRatedGames = value;
OnPropertyChanged();
}
}
private ObservableCollection<Jeu> listJeuxAffiches;
public ObservableCollection<Jeu> ListJeuxAffiches
{
get
{
var cinqPremiersJeux = ListJeux.Take(5);
return listJeuxAffiches = new ObservableCollection<Jeu>(cinqPremiersJeux);
}
set
{
listJeuxAffiches = value;
OnPropertyChanged();
}
}
private ObservableCollection<Jeu> listJeux; private ObservableCollection<Jeu> listJeux;
public ObservableCollection<Jeu> ListJeux public ObservableCollection<Jeu> ListJeux
{ {

@ -9,7 +9,7 @@
<Grid x:Name="outerGrid"> <Grid>
<Grid.Background> <Grid.Background>
<LinearGradientBrush EndPoint="1,0"> <LinearGradientBrush EndPoint="1,0">
@ -45,11 +45,6 @@
</HorizontalStackLayout> </HorizontalStackLayout>
</Grid> </Grid>
<StackLayout HorizontalOptions="Center" VerticalOptions="Center" Grid.Row="2">
<Frame HeightRequest="40" WidthRequest="250" CornerRadius="8">
<SearchBar Placeholder="Rechercher" TextColor="Black" BackgroundColor="#D9D9D9"/>
</Frame>
</StackLayout>
<Label <Label
Text="Parcourir les jeux" Text="Parcourir les jeux"
@ -60,7 +55,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 ListJeuxAffiches}" Spacing="15"> <HorizontalStackLayout BindableLayout.ItemsSource="{Binding AccueilManager.ListJeuxAffiches}" Spacing="15">
<BindableLayout.ItemTemplate> <BindableLayout.ItemTemplate>
<DataTemplate> <DataTemplate>
<Grid> <Grid>
@ -114,7 +109,7 @@
/> />
<Grid Grid.Row="6"> <Grid Grid.Row="6">
<VerticalStackLayout Spacing="30" BindableLayout.ItemsSource="{Binding TopRatedGames}"> <VerticalStackLayout Spacing="30" BindableLayout.ItemsSource="{Binding AccueilManager.TopRatedGames}">
<BindableLayout.ItemTemplate> <BindableLayout.ItemTemplate>
<DataTemplate> <DataTemplate>
<Grid ColumnDefinitions="auto,*,auto"> <Grid ColumnDefinitions="auto,*,auto">

@ -6,8 +6,7 @@ namespace GameAtlas.Views;
public partial class PageAcceuil : ContentPage public partial class PageAcceuil : ContentPage
{ {
public ObservableCollection<Jeu> TopRatedGames { get; set; }
public ObservableCollection<Jeu> ListJeuxAffiches { get; set; }
public Manager AccueilManager => (App.Current as App).MyManager; public Manager AccueilManager => (App.Current as App).MyManager;
@ -15,10 +14,6 @@ public partial class PageAcceuil : ContentPage
{ {
InitializeComponent(); InitializeComponent();
TopRatedGames = new ObservableCollection<Jeu>(AccueilManager.ListJeux.OrderByDescending(jeu => jeu.Note).Take(3));
var cinqPremiersJeux = AccueilManager.ListJeux.Take(5);
ListJeuxAffiches = new ObservableCollection<Jeu>(cinqPremiersJeux);
BindingContext = this; BindingContext = this;
} }

@ -44,6 +44,7 @@ public partial class PageAdmin : ContentPage
string nbTelechargement = string.Empty; string nbTelechargement = string.Empty;
string genre = string.Empty; string genre = string.Empty;
string image = string.Empty; string image = string.Empty;
string resume = string.Empty;
int etape = 1; int etape = 1;
bool annuler = false; bool annuler = false;
@ -53,68 +54,75 @@ public partial class PageAdmin : ContentPage
switch (etape) switch (etape)
{ {
case 1: case 1:
nom = await DisplayPromptAsync("Informations sur le Jeu [1/9]", "Quel est le Titre ?", accept: "Suivant", cancel: "Annuler", placeholder: "GTA VI"); nom = await DisplayPromptAsync("Informations sur le Jeu [1/10]", "Quel est le Titre ?", accept: "Suivant", cancel: "Annuler", placeholder: "GTA VI");
if (string.IsNullOrEmpty(nom)) if (string.IsNullOrEmpty(nom))
{ {
annuler = true; annuler = true;
} }
break; break;
case 2: case 2:
sortie = await DisplayPromptAsync("Informations sur le Jeu [2/9]", "Date de Sortie", accept: "Suivant", cancel: "Annuler", placeholder: "JJ/MM/AAAA"); sortie = await DisplayPromptAsync("Informations sur le Jeu [2/10]", "Date de Sortie", accept: "Suivant", cancel: "Annuler", placeholder: "JJ/MM/AAAA");
if (string.IsNullOrEmpty(sortie)) if (string.IsNullOrEmpty(sortie))
{ {
annuler = true; annuler = true;
} }
break; break;
case 3: case 3:
plateformes = await DisplayPromptAsync("Informations sur le Jeu [3/9]", "Plateforme(s), un espace pour séparer", accept: "Suivant", cancel: "Annuler", placeholder: "Ex: XOne PC PS5"); plateformes = await DisplayPromptAsync("Informations sur le Jeu [3/10]", "Plateforme(s), un espace pour séparer", accept: "Suivant", cancel: "Annuler", placeholder: "Ex: XOne PC PS5");
if (string.IsNullOrEmpty(plateformes)) if (string.IsNullOrEmpty(plateformes))
{ {
annuler = true; annuler = true;
} }
break; break;
case 4: case 4:
developpeur = await DisplayPromptAsync("Informations sur le Jeu [4/9]", "Développeur", accept: "Suivant", cancel: "Annuler", placeholder: "Rockstar Games"); developpeur = await DisplayPromptAsync("Informations sur le Jeu [4/10]", "Développeur", accept: "Suivant", cancel: "Annuler", placeholder: "Rockstar Games");
if (string.IsNullOrEmpty(developpeur)) if (string.IsNullOrEmpty(developpeur))
{ {
annuler = true; annuler = true;
} }
break; break;
case 5: case 5:
editeur = await DisplayPromptAsync("Informations sur le Jeu [5/9]", "Editeur", accept: "Suivant", cancel: "Annuler", placeholder: "Take-Two Interactive"); editeur = await DisplayPromptAsync("Informations sur le Jeu [5/10]", "Editeur", accept: "Suivant", cancel: "Annuler", placeholder: "Take-Two Interactive");
if (string.IsNullOrEmpty(editeur)) if (string.IsNullOrEmpty(editeur))
{ {
annuler = true; annuler = true;
} }
break; break;
case 6: case 6:
note = await DisplayPromptAsync("Informations sur le Jeu [6/9]", "Note de 0 à 5", accept: "Suivant", cancel: "Annuler", maxLength: 1, placeholder: "5"); note = await DisplayPromptAsync("Informations sur le Jeu [6/10]", "Note de 0 à 5", accept: "Suivant", cancel: "Annuler", maxLength: 1, placeholder: "5");
if (string.IsNullOrEmpty(note)) if (string.IsNullOrEmpty(note))
{ {
annuler = true; annuler = true;
} }
break; break;
case 7: case 7:
nbTelechargement = await DisplayPromptAsync("Informations sur le Jeu [7/9]", "Nombre de Téléchargements (en milliers, ex: 630k)", accept: "Suivant", cancel: "Annuler", placeholder: "630"); nbTelechargement = await DisplayPromptAsync("Informations sur le Jeu [7/10]", "Nombre de Téléchargements (en milliers, ex: 630k)", accept: "Suivant", cancel: "Annuler", placeholder: "630");
if (string.IsNullOrEmpty(nbTelechargement)) if (string.IsNullOrEmpty(nbTelechargement))
{ {
annuler = true; annuler = true;
} }
break; break;
case 8: case 8:
genre = await DisplayPromptAsync("Informations sur le Jeu [8/9]", "Genre(s), un espace pour séparer", accept: "Suivant", cancel: "Annuler", placeholder: "Action Aventure"); genre = await DisplayPromptAsync("Informations sur le Jeu [8/10]", "Genre(s), un espace pour séparer", accept: "Suivant", cancel: "Annuler", placeholder: "Action Aventure");
if (string.IsNullOrEmpty(genre)) if (string.IsNullOrEmpty(genre))
{ {
annuler = true; annuler = true;
} }
break; break;
case 9: case 9:
image = await DisplayPromptAsync("Informations sur le Jeu [9/9]", "Image de couverture (préférez URL finissant par .png)", accept: "Terminer", cancel: "Annuler", placeholder: "http://example.com/monimage.png"); image = await DisplayPromptAsync("Informations sur le Jeu [9/10]", "Image de couverture (préférez URL finissant par .png)", accept: "Terminer", cancel: "Annuler", placeholder: "http://example.com/monimage.png");
if (string.IsNullOrEmpty(image)) if (string.IsNullOrEmpty(image))
{ {
annuler = true; annuler = true;
} }
break; break;
case 10:
resume = await DisplayPromptAsync("Informations sur le Jeu [10/10]", "Résumé du jeu", accept: "Terminer", cancel: "Annuler", placeholder: "Résumé du jeu");
if (string.IsNullOrEmpty(resume))
{
annuler = true;
}
break;
} }
etape++; etape++;
@ -126,6 +134,8 @@ public partial class PageAdmin : ContentPage
AdminManager.AddJeux(adminJeu); AdminManager.AddJeux(adminJeu);
AdminManager.SauvegardeDonnees(); AdminManager.SauvegardeDonnees();
AdminManager.OnPropertyChanged(nameof(AdminManager.ListJeux)); AdminManager.OnPropertyChanged(nameof(AdminManager.ListJeux));
AdminManager.OnPropertyChanged(nameof(AdminManager.TopRatedGames));
AdminManager.OnPropertyChanged(nameof(AdminManager.ListJeuxAffiches));
Debug.WriteLine($"Le jeu \"{adminJeu.Nom}\" a été ajouté."); Debug.WriteLine($"Le jeu \"{adminJeu.Nom}\" a été ajouté.");
} }

@ -18,7 +18,7 @@ public partial class PageParcourir : ContentPage
var selectedjeu = (sender as ImageButton)?.BindingContext as Jeu; var selectedjeu = (sender as ImageButton)?.BindingContext as Jeu;
if (selectedjeu != null) if (selectedjeu != null)
{ {
//await Shell.Current.GoToAsync(nameof(PageJeu(selectedjeu)); ---- Ne marche pas ----
await Navigation.PushAsync(new PageJeu(selectedjeu)); await Navigation.PushAsync(new PageJeu(selectedjeu));
} }

@ -29,7 +29,7 @@ public partial class PageProfil : ContentPage
var selectedjeu = (sender as ImageButton)?.BindingContext as Jeu; var selectedjeu = (sender as ImageButton)?.BindingContext as Jeu;
if (selectedjeu != null) if (selectedjeu != null)
{ {
//await Shell.Current.GoToAsync(nameof(PageJeu(selectedjeu)); ---- Ne marche pas ----
await Navigation.PushAsync(new PageJeu(selectedjeu)); await Navigation.PushAsync(new PageJeu(selectedjeu));
} }

Loading…
Cancel
Save