From 4bafc35d28ab8774b3900fcf5ad6ab2b1300f45a Mon Sep 17 00:00:00 2001 From: V J Date: Sun, 7 May 2023 17:10:16 +0200 Subject: [PATCH] test data-binding sur la page d'accueil --- MangaMap/Model/Manager.cs | 9 +++++++++ MangaMap/Model/Oeuvre.cs | 4 +++- MangaMap/Views/homePage.xaml | 14 ++++++++++++++ MangaMap/Views/homePage.xaml.cs | 1 + 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/MangaMap/Model/Manager.cs b/MangaMap/Model/Manager.cs index ffc2982..db43780 100644 --- a/MangaMap/Model/Manager.cs +++ b/MangaMap/Model/Manager.cs @@ -43,6 +43,15 @@ namespace MangaMap.Model ajouterUtilisateur(u1); ajouterUtilisateur(u2); ajouterUtilisateur(u3); + + List genres = new List(); + genres.Add("Action"); + genres.Add("Future"); + Oeuvre o1 = new Oeuvre("test",genres, "TV", "C'est une bonne série", 4, 150, "test.jpg"); + Oeuvre o2 = new Oeuvre("test2", genres, "DVD", "A la fin il meurt", 2, 24, "test2.png"); + + ajouterOeuvre(o1); + ajouterOeuvre(o2); } } } diff --git a/MangaMap/Model/Oeuvre.cs b/MangaMap/Model/Oeuvre.cs index c8465b1..5892e2a 100644 --- a/MangaMap/Model/Oeuvre.cs +++ b/MangaMap/Model/Oeuvre.cs @@ -14,8 +14,9 @@ namespace MangaMap.Model public string Description { get; private set; } public int Note { get; private set; } public int NbEpisodes { get; private set; } + public string Affiche { get; private set; } - public Oeuvre(string nom, List genre, string type, string description, int note, int nbEpisode) + public Oeuvre(string nom, List genre, string type, string description, int note, int nbEpisode, string affiche) { Nom = nom; Genre = genre; @@ -23,6 +24,7 @@ namespace MangaMap.Model Description = description; Note = note; NbEpisodes = nbEpisode; + Affiche = affiche; } public void AjouterEpisode(int nb) diff --git a/MangaMap/Views/homePage.xaml b/MangaMap/Views/homePage.xaml index e73c1de..fefd8a2 100644 --- a/MangaMap/Views/homePage.xaml +++ b/MangaMap/Views/homePage.xaml @@ -27,6 +27,20 @@ Margin="30" /> + + + + + + + + + + diff --git a/MangaMap/Views/homePage.xaml.cs b/MangaMap/Views/homePage.xaml.cs index 832d230..c8a9da0 100644 --- a/MangaMap/Views/homePage.xaml.cs +++ b/MangaMap/Views/homePage.xaml.cs @@ -10,5 +10,6 @@ public partial class homePage : ContentPage { InitializeComponent(); a1.BindingContext = my_manager; + a2.BindingContext = my_manager; } } \ No newline at end of file