|
|
@ -81,15 +81,10 @@ namespace Model
|
|
|
|
|
|
|
|
|
|
|
|
public event PropertyChangedEventHandler? PropertyChanged;
|
|
|
|
public event PropertyChangedEventHandler? PropertyChanged;
|
|
|
|
|
|
|
|
|
|
|
|
private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
|
|
|
|
public ReadOnlyCollection<Game> Followed_Games => followed_Games.AsReadOnly();
|
|
|
|
=> PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[DataMember]
|
|
|
|
[DataMember]
|
|
|
|
public ObservableCollection<Game> Followed_Games
|
|
|
|
private readonly List<Game> followed_Games;
|
|
|
|
{
|
|
|
|
|
|
|
|
get;
|
|
|
|
|
|
|
|
private init;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public User(string userImage,string username, string biographie, string email, string password)
|
|
|
|
public User(string userImage,string username, string biographie, string email, string password)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -103,8 +98,11 @@ namespace Model
|
|
|
|
else Email = email;
|
|
|
|
else Email = email;
|
|
|
|
if (password == null) throw new ArgumentNullException(nameof(password));
|
|
|
|
if (password == null) throw new ArgumentNullException(nameof(password));
|
|
|
|
else Password = password;
|
|
|
|
else Password = password;
|
|
|
|
Followed_Games = new ObservableCollection<Game>();
|
|
|
|
followed_Games = new List<Game>();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
|
|
|
|
|
|
|
|
=> PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
|
|
|
|
|
|
|
|
|
|
|
public bool Equals(User? other)
|
|
|
|
public bool Equals(User? other)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (string.IsNullOrWhiteSpace(Username)) return false;
|
|
|
|
if (string.IsNullOrWhiteSpace(Username)) return false;
|
|
|
@ -143,12 +141,12 @@ namespace Model
|
|
|
|
public void FollowAGame(Game game)
|
|
|
|
public void FollowAGame(Game game)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (Followed_Games.Contains(game)) return;
|
|
|
|
if (Followed_Games.Contains(game)) return;
|
|
|
|
Followed_Games.Add(game);
|
|
|
|
followed_Games.Add(game);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public void RemoveAGame(Game game)
|
|
|
|
public void RemoveAGame(Game game)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!Followed_Games.Contains(game)) return;
|
|
|
|
if (!Followed_Games.Contains(game)) return;
|
|
|
|
Followed_Games.Remove(game);
|
|
|
|
followed_Games.Remove(game);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override string ToString()
|
|
|
|
public override string ToString()
|
|
|
@ -158,6 +156,5 @@ namespace Model
|
|
|
|
foreach (Game game in Followed_Games) builder.Append($"{game.Name}\n");
|
|
|
|
foreach (Game game in Followed_Games) builder.Append($"{game.Name}\n");
|
|
|
|
return builder.ToString();
|
|
|
|
return builder.ToString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|