You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
SAE-S2.01_MAUI/Sources/Model/Carte.cs

89 lines
2.6 KiB

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 IEnumerable<IContenu> ContenuList { get; set; }
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.ContenuList = new List<IContenu>();
}
}
}