Binding PageJeu + Bouton Voir

pull/45/head
Yvan CALATAYUD 2 years ago committed by remi.lavergne
parent b55386a49c
commit 907d897336

@ -15,7 +15,7 @@ namespace GameAtlas.Models
[DataMember]
public string Sortie { get; private set; }
[DataMember]
public List<string> Plateformes { get; private set; }
public string Plateformes { get; private set; }
[DataMember]
public string Developpeur { get; private set; }
[DataMember]
@ -27,11 +27,11 @@ namespace GameAtlas.Models
//[DataMember]
//public List<(string,string)> Revendeurs { get; private set; }
[DataMember]
public List<string> Genres { get; private set; }
public string Genres { get; private set; }
[DataMember]
public string Image { get; private set; }
public Jeu(string nom, string sortie, List<string> plateformes, string developpeur, string editeur, int note, int nbTelechargement, List<string> genres, string image)
public Jeu(string nom, string sortie, string plateformes, string developpeur, string editeur, int note, int nbTelechargement, string genres, string image)
{
Nom = nom;
Sortie = sortie;

@ -132,21 +132,23 @@ namespace GameAtlas.Models
string image = imageEntry.Text;
// Séparer les plateformes par des espaces et les ajouter à une liste
List<string> plateformesList = plateformesText.Split(' ').ToList();
// List<string> plateformesList = plateformesText.Split(' ').ToList();
// Séparer les genres par des espaces et les ajouter à une liste
List<string> genresList = genresText.Split(' ').ToList();
// List<string> genresList = genresText.Split(' ').ToList();
Jeu jeu = new Jeu
(
nom,
sortieString,
plateformesList,
//plateformesList,
plateformesText,
developpeur,
editeur,
note,
nbTelechargement,
genresList,
//genresList,
genresText,
image
);

@ -1,5 +1,7 @@
namespace GameAtlas.Views.Composants;
using GameAtlas.Models;
public partial class BoutonVoir : ContentView
{
public BoutonVoir()
@ -9,6 +11,11 @@ public partial class BoutonVoir : ContentView
private async void OnVoirClicked(object sender, EventArgs e)
{
await Shell.Current.GoToAsync(nameof(PageJeu));
var selectedjeu = (sender as Button)?.BindingContext as Jeu;
if (selectedjeu != null)
{
//await Shell.Current.GoToAsync(nameof(PageJeu(selectedjeu)); ---- Ne marche pas ----
await Navigation.PushAsync(new PageJeu(selectedjeu));
}
}
}

@ -37,7 +37,7 @@
<Label Text="{Binding JeuModel.Nom}" FontFamily="PTSansCBold" FontSize="14" TextColor="{StaticResource Black}"/>
<Label Text="10 février 2023" FontFamily="RobotoRegular" FontSize="11" TextColor="{StaticResource Gray500}"/>
<Label Text="{Binding JeuModel.Sortie}" FontFamily="RobotoRegular" FontSize="11" TextColor="{StaticResource Gray500}"/>
<FlexLayout Direction="Row" JustifyContent="Start" AlignItems="Start" Wrap="Wrap" >
<BindableLayout.ItemsSource>
@ -71,7 +71,7 @@
<Label.FormattedText>
<FormattedString>
<Span Text="Editeur: " TextColor="{StaticResource Gray500}" />
<Span Text="{Binding JeuModel.Developpeur}" TextColor="{StaticResource Black}" />
<Span Text="{Binding JeuModel.Editeur}" TextColor="{StaticResource Black}" />
</FormattedString>
</Label.FormattedText>
</Label>
@ -87,7 +87,7 @@
<Frame BorderColor="{StaticResource Black}" CornerRadius="5" Padding="15" BackgroundColor="Transparent">
<Grid RowDefinitions="auto,auto" ColumnDefinitions="auto,*" ColumnSpacing="15" VerticalOptions="Center">
<Image Grid.RowSpan="2" Source="trophy" WidthRequest="20" VerticalOptions="Center"/>
<Label Grid.Column="1" Text="4.6" FontFamily="RobotoRegular" FontSize="16" TextColor="{StaticResource Black}" VerticalOptions="Center"/>
<Label Grid.Column="1" Text="{Binding JeuModel.Note}" FontFamily="RobotoRegular" FontSize="16" TextColor="{StaticResource Black}" VerticalOptions="Center"/>
<Label Grid.Row="1" Grid.Column="1" Text="Note" FontFamily="RobotoRegular" FontSize="12" TextColor="{StaticResource Gray500}" VerticalOptions="Center"/>
</Grid>
</Frame>

Loading…
Cancel
Save