using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; using System.ComponentModel; using System.Runtime.CompilerServices; namespace Model { public class Carte : IContenu, INotifyPropertyChanged { public event PropertyChangedEventHandler? PropertyChanged; void OnPropertyChanged([CallerMemberName] string ?propertyName = null) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } public string Nom { get; set; } public string Description { get => description; set { description = value; OnPropertyChanged(nameof(Description)); } } private string description; public string Pouvoir { get => pouvoir; set { pouvoir = value; OnPropertyChanged(nameof(Pouvoir)); } } private string pouvoir; public string Strategie { get => strategie; set { strategie = value; OnPropertyChanged(nameof(Strategie)); } } private string strategie; private int? note; public int? Note { get { return note; } set { if (value < 0 || value > 10) { throw new ArgumentOutOfRangeException(nameof(value), "La valeur de la note doit être comprise entre 0 et 10."); } note = value; OnPropertyChanged(nameof(Note)); } } public string LienImage { get => lienImage; set { if (string.IsNullOrEmpty(lienImage)) lienImage = "notfound"; else lienImage = value; OnPropertyChanged(nameof(LienImage)); } } 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) { this.Nom = nom; this.description = description; this.pouvoir = pouvoir; this.strategie = strategie; this.note = note; this.lienImage = lienImage; this.commentaires = new List(); } } }