|
|
@ -1,5 +1,6 @@
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
using System.ComponentModel;
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
|
|
|
using System.Runtime.CompilerServices;
|
|
|
|
using System.Runtime.Serialization;
|
|
|
|
using System.Runtime.Serialization;
|
|
|
|
using System.Text;
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
|
@ -9,16 +10,20 @@ namespace Model
|
|
|
|
public class Game : INotifyPropertyChanged, IEquatable<Game>
|
|
|
|
public class Game : INotifyPropertyChanged, IEquatable<Game>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
[DataMember]
|
|
|
|
[DataMember]
|
|
|
|
public string Name
|
|
|
|
public string? Name
|
|
|
|
{
|
|
|
|
{
|
|
|
|
get => name;
|
|
|
|
get => name;
|
|
|
|
private set
|
|
|
|
private set
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (string.IsNullOrWhiteSpace(value)) name="Default";
|
|
|
|
if (string.IsNullOrWhiteSpace(value)) name="Default";
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
name = value;
|
|
|
|
name = value;
|
|
|
|
|
|
|
|
NotifyPropertyChanged();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private string name;
|
|
|
|
private string? name;
|
|
|
|
|
|
|
|
|
|
|
|
[DataMember]
|
|
|
|
[DataMember]
|
|
|
|
public string? Description
|
|
|
|
public string? Description
|
|
|
@ -27,7 +32,11 @@ namespace Model
|
|
|
|
private set
|
|
|
|
private set
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (string.IsNullOrWhiteSpace(value)) return;
|
|
|
|
if (string.IsNullOrWhiteSpace(value)) return;
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
description = value;
|
|
|
|
description = value;
|
|
|
|
|
|
|
|
NotifyPropertyChanged();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private string? description;
|
|
|
|
private string? description;
|
|
|
@ -39,22 +48,30 @@ namespace Model
|
|
|
|
private set
|
|
|
|
private set
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (value < 1957 || value > 2023) return;
|
|
|
|
if (value < 1957 || value > 2023) return;
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
year = value;
|
|
|
|
year = value;
|
|
|
|
|
|
|
|
NotifyPropertyChanged();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private int year;
|
|
|
|
private int year;
|
|
|
|
|
|
|
|
|
|
|
|
[DataMember]
|
|
|
|
[DataMember]
|
|
|
|
public string Cover
|
|
|
|
public string? Cover
|
|
|
|
{
|
|
|
|
{
|
|
|
|
get => cover;
|
|
|
|
get => cover;
|
|
|
|
private set
|
|
|
|
private set
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (string.IsNullOrWhiteSpace(value)) cover="no_cover.png";
|
|
|
|
if (string.IsNullOrWhiteSpace(value)) cover="no_cover.png";
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
cover = value;
|
|
|
|
cover = value;
|
|
|
|
|
|
|
|
NotifyPropertyChanged();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private string cover;
|
|
|
|
private string? cover;
|
|
|
|
|
|
|
|
|
|
|
|
[DataMember]
|
|
|
|
[DataMember]
|
|
|
|
public ObservableCollection<string> Tags
|
|
|
|
public ObservableCollection<string> Tags
|
|
|
@ -63,7 +80,11 @@ namespace Model
|
|
|
|
private set
|
|
|
|
private set
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (value == null || value.Count > 3) return;
|
|
|
|
if (value == null || value.Count > 3) return;
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
tags = value;
|
|
|
|
tags = value;
|
|
|
|
|
|
|
|
NotifyPropertyChanged();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private ObservableCollection<string> tags;
|
|
|
|
private ObservableCollection<string> tags;
|
|
|
@ -72,18 +93,31 @@ namespace Model
|
|
|
|
public List<Review> Reviews { get; private init; }
|
|
|
|
public List<Review> Reviews { get; private init; }
|
|
|
|
|
|
|
|
|
|
|
|
[DataMember]
|
|
|
|
[DataMember]
|
|
|
|
public float Average { get; private set; }
|
|
|
|
public float Average
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get => average;
|
|
|
|
|
|
|
|
private set
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
average = value;
|
|
|
|
|
|
|
|
NotifyPropertyChanged();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private float average;
|
|
|
|
|
|
|
|
|
|
|
|
[DataMember]
|
|
|
|
[DataMember]
|
|
|
|
public string Lien {
|
|
|
|
public string? Lien {
|
|
|
|
get => lien;
|
|
|
|
get => lien;
|
|
|
|
private set
|
|
|
|
private set
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (string.IsNullOrWhiteSpace(value)) return;
|
|
|
|
if (string.IsNullOrWhiteSpace(value)) return;
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
lien = value;
|
|
|
|
lien = value;
|
|
|
|
|
|
|
|
NotifyPropertyChanged();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private string lien;
|
|
|
|
private string? lien;
|
|
|
|
|
|
|
|
|
|
|
|
public Game(string name, string description, int year, List<string> c_tags, string cover, string c_lien)
|
|
|
|
public Game(string name, string description, int year, List<string> c_tags, string cover, string c_lien)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -104,6 +138,14 @@ namespace Model
|
|
|
|
|
|
|
|
|
|
|
|
public event PropertyChangedEventHandler? PropertyChanged;
|
|
|
|
public event PropertyChangedEventHandler? PropertyChanged;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (PropertyChanged != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override int GetHashCode()
|
|
|
|
public override int GetHashCode()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (string.IsNullOrWhiteSpace(Name)) return 0;
|
|
|
|
if (string.IsNullOrWhiteSpace(Name)) return 0;
|
|
|
|