From 45dfdb77d66b18bbcb1e6d06134e450a44d3ef77 Mon Sep 17 00:00:00 2001 From: Loris OBRY Date: Wed, 31 May 2023 16:25:16 +0200 Subject: [PATCH] Passage en List pour les commentaires, ajout du OnPropertyCHange pour le pack et les commentaires et quelques corrections dans le code --- Sources/Model/Carte.cs | 15 ++++++++++++--- Sources/Model/Pack.cs | 39 +++++++++++++++++++++++++++++++++------ 2 files changed, 45 insertions(+), 9 deletions(-) diff --git a/Sources/Model/Carte.cs b/Sources/Model/Carte.cs index 06e02c0..9264597 100644 --- a/Sources/Model/Carte.cs +++ b/Sources/Model/Carte.cs @@ -67,12 +67,21 @@ namespace Model get => lienImage; set { - if (!string.IsNullOrEmpty(lienImage)) lienImage = "notfound"; + if (string.IsNullOrEmpty(lienImage)) lienImage = "notfound"; else lienImage = value; OnPropertyChanged(nameof(LienImage)); } } - public IEnumerable ContenuList { get; set; } + public List commentaires; + public List Commentaires + { + get => commentaires; + set + { + commentaires = value; + OnPropertyChanged(nameof(Commentaires)); + } + } private string lienImage; public Carte(string nom, string pouvoir, string strategie, int? note, string lienImage, string description) { @@ -82,7 +91,7 @@ namespace Model this.strategie = strategie; this.note = note; this.lienImage = lienImage; - this.ContenuList = new List(); + this.commentaires = new List(); } } } diff --git a/Sources/Model/Pack.cs b/Sources/Model/Pack.cs index 79efae0..06bc9ca 100644 --- a/Sources/Model/Pack.cs +++ b/Sources/Model/Pack.cs @@ -16,9 +16,25 @@ namespace Model { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } - - public string Nom { get; set; } - public string Description { get; set; } + public string nom; + public string Nom + { + get => nom; + set + { + nom = value; + OnPropertyChanged(nameof(Nom)); + } + } + public string description; + public string Description { + get => description; + set + { + nom = value; + OnPropertyChanged(nameof(Description)); + } + } private int? note; public int? Note { @@ -36,11 +52,22 @@ namespace Model OnPropertyChanged(nameof(Note)); } } + public List commentaires; + public List Commentaires + { + get => commentaires; + set + { + commentaires = value; + OnPropertyChanged(nameof(Commentaires)); + } + } public Pack(string nom, string description, int? note) { - Nom = nom; - Description = description; - Note = note; + this.nom = nom; + this.description = description; + this.note = note; + this.commentaires = new List(); } } }