diff --git a/Sources/Stim.Model/Game.cs b/Sources/Stim.Model/Game.cs index 0fce76e..9a0707b 100644 --- a/Sources/Stim.Model/Game.cs +++ b/Sources/Stim.Model/Game.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.ComponentModel; using System.Linq; using System.Text; @@ -53,28 +54,28 @@ namespace Model } private string cover; - public string[] Tags + public ObservableCollection Tags { get => tags; set { - if (value == null || value.Length != 3) return; + if (value == null || value.Count != 3) return; tags = value; } } - private string[]? tags; + private ObservableCollection tags; public event PropertyChangedEventHandler? PropertyChanged; public List Reviews { get; private init; } - public Game(string name, string description, int year, string[] tags, string cover) + public Game(string name, string description, int year, List c_tags, string cover) { Name = name; Description = description; Year = year; - tags = new string[3]; - Tags = tags; + if (c_tags != null) tags = new ObservableCollection(c_tags); + else tags = new ObservableCollection(); Cover= cover; Reviews = new List(); } @@ -102,9 +103,9 @@ namespace Model { description = newdesc; } - public void TagChange(string[] newtag) + public void TagChange(List newtag) { - tags=newtag; + if (newtag != null && newtag.Count==3) tags = new ObservableCollection(newtag); } public void NameChange(string newname) { diff --git a/Sources/Stim.Model/Manager.cs b/Sources/Stim.Model/Manager.cs index 5e7b919..095a733 100644 --- a/Sources/Stim.Model/Manager.cs +++ b/Sources/Stim.Model/Manager.cs @@ -15,10 +15,10 @@ namespace Model public Manager(IPersistance persistance) { _persistance = persistance; - Games.Add(new("Elden Ring", "description", 2010, new string[3] { "1", "2", "3" }, "elden_ring.jpg")); - Games.Add(new("Minecraft", "description", 2010, new string[3] { "1", "2", "3" }, "minecraft.jpeg")); - Games.Add(new("Celeste", "description", 2010, new string[3] { "1", "2", "3" }, "celeste.png")); - Games.Add(new("GTA V", "description", 2010, new string[3] { "1", "2", "3" }, "gta_v.png")); + Games.Add(new("Elden Ring", "description", 2010, new List { "1","2","3"}, "elden_ring.jpg")); + Games.Add(new("Minecraft", "description", 2010, new List { "1", "2", "3" }, "minecraft.jpeg")); + Games.Add(new("Celeste", "description", 2010, new List { "1", "2", "3" }, "celeste.png")); + Games.Add(new("GTA V", "description", 2010, new List { "1", "2", "3" }, "gta_v.png")); } } } diff --git a/Sources/Stim/MainPage.xaml b/Sources/Stim/MainPage.xaml index 5ca4bcd..198ff01 100644 --- a/Sources/Stim/MainPage.xaml +++ b/Sources/Stim/MainPage.xaml @@ -35,7 +35,7 @@ - +