Actualisation pageAccueil lors de l'ajout d'un jeu par l'admin
continuous-integration/drone/push Build is failing Details

pull/63/head
Yvan CALATAYUD 2 years ago
parent 712dc886c2
commit d330e3aa00

@ -15,6 +15,39 @@ namespace GameAtlas.Models
public List<Admin> Admins { 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;
public ObservableCollection<Jeu> ListJeux
{

@ -9,7 +9,7 @@
<Grid x:Name="outerGrid">
<Grid>
<Grid.Background>
<LinearGradientBrush EndPoint="1,0">
@ -45,11 +45,6 @@
</HorizontalStackLayout>
</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
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">
<HorizontalStackLayout BindableLayout.ItemsSource="{Binding ListJeuxAffiches}" Spacing="15">
<HorizontalStackLayout BindableLayout.ItemsSource="{Binding AccueilManager.ListJeuxAffiches}" Spacing="15">
<BindableLayout.ItemTemplate>
<DataTemplate>
<Grid>
@ -114,7 +109,7 @@
/>
<Grid Grid.Row="6">
<VerticalStackLayout Spacing="30" BindableLayout.ItemsSource="{Binding TopRatedGames}">
<VerticalStackLayout Spacing="30" BindableLayout.ItemsSource="{Binding AccueilManager.TopRatedGames}">
<BindableLayout.ItemTemplate>
<DataTemplate>
<Grid ColumnDefinitions="auto,*,auto">

@ -6,8 +6,7 @@ namespace GameAtlas.Views;
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;
@ -15,10 +14,6 @@ public partial class PageAcceuil : ContentPage
{
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;
}

@ -44,6 +44,7 @@ public partial class PageAdmin : ContentPage
string nbTelechargement = string.Empty;
string genre = string.Empty;
string image = string.Empty;
string resume = string.Empty;
int etape = 1;
bool annuler = false;
@ -53,68 +54,75 @@ public partial class PageAdmin : ContentPage
switch (etape)
{
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))
{
annuler = true;
}
break;
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))
{
annuler = true;
}
break;
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))
{
annuler = true;
}
break;
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))
{
annuler = true;
}
break;
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))
{
annuler = true;
}
break;
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))
{
annuler = true;
}
break;
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))
{
annuler = true;
}
break;
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))
{
annuler = true;
}
break;
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))
{
annuler = true;
}
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++;
@ -126,6 +134,8 @@ public partial class PageAdmin : ContentPage
AdminManager.AddJeux(adminJeu);
AdminManager.SauvegardeDonnees();
AdminManager.OnPropertyChanged(nameof(AdminManager.ListJeux));
AdminManager.OnPropertyChanged(nameof(AdminManager.TopRatedGames));
AdminManager.OnPropertyChanged(nameof(AdminManager.ListJeuxAffiches));
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;
if (selectedjeu != null)
{
//await Shell.Current.GoToAsync(nameof(PageJeu(selectedjeu)); ---- Ne marche pas ----
await Navigation.PushAsync(new PageJeu(selectedjeu));
}

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

Loading…
Cancel
Save