From 27aedcc5809ccef9c9d9f624df8d88aeb29e6f29 Mon Sep 17 00:00:00 2001 From: Anthony RICHARD Date: Sun, 11 Jun 2023 18:30:52 +0200 Subject: [PATCH] encapsulation tags --- Sources/Stim.Model/Game.cs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Sources/Stim.Model/Game.cs b/Sources/Stim.Model/Game.cs index 25c006a..e4582dc 100644 --- a/Sources/Stim.Model/Game.cs +++ b/Sources/Stim.Model/Game.cs @@ -60,19 +60,19 @@ namespace Model } } private string cover = default!; - - [DataMember] - public ObservableCollection Tags + + public ReadOnlyCollection Tags { - get => tags; + get => tags.AsReadOnly(); private set { - if (value == null || value.Count > 3) tags = new ObservableCollection(); - else tags = value; + if (value == null || value.Count > 3) tags = new List(); + else tags = value.ToList(); NotifyPropertyChanged(); } } - private ObservableCollection tags; + [DataMember] + private List tags; public ReadOnlyCollection Reviews => reviews.AsReadOnly(); @@ -100,8 +100,8 @@ namespace Model if (string.IsNullOrWhiteSpace(description)) Description = "Pas de description"; else Description = description; Year = year; - if (c_tags is not null) tags = new ObservableCollection(c_tags); - else tags = new ObservableCollection(); + if (c_tags is not null) tags = new List(c_tags); + else tags = new List(); if (string.IsNullOrWhiteSpace(cover)) Cover = "no_cover.png"; else Cover = cover; if (string.IsNullOrWhiteSpace(c_lien)) Lien = "Pas de lien"; @@ -168,7 +168,7 @@ namespace Model } public void TagChange(List newtag) { - if (newtag != null && newtag.Count<=3) tags = new ObservableCollection(newtag); + if (newtag != null && newtag.Count<=3) tags = new List(newtag); } public void NameChange(string newname) {