diff --git a/Sources/Stim.Model/Manager.cs b/Sources/Stim.Model/Manager.cs index 8a4d277..d175c5a 100644 --- a/Sources/Stim.Model/Manager.cs +++ b/Sources/Stim.Model/Manager.cs @@ -6,10 +6,12 @@ namespace Model { public IPersistance Mgrpersistance; public ObservableCollection GameList { get;} + public User CurrentUser { get; set; } public Manager(IPersistance persistance) { Mgrpersistance = persistance; + CurrentUser = new User("username", "bio", "email@email.com", "password88"); GameList = persistance.LoadGame(); if (GameList == null) { GameList = new ObservableCollection();} } @@ -26,10 +28,6 @@ namespace Model Mgrpersistance.SaveGame(GameList); } - /*public void LoadGames() - { - _persistance.LoadGame(); - }*/ public void SaveGames() { Mgrpersistance.SaveGame(GameList); diff --git a/Sources/Stim.Model/User.cs b/Sources/Stim.Model/User.cs index 05fa307..12a9bcc 100644 --- a/Sources/Stim.Model/User.cs +++ b/Sources/Stim.Model/User.cs @@ -1,8 +1,10 @@ -using System.Text.RegularExpressions; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Text.RegularExpressions; namespace Model { - public class User + public class User : INotifyPropertyChanged { public string Username { @@ -44,23 +46,36 @@ namespace Model get => password; private set { - Regex rg = new Regex("^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,32}$"); - if (string.IsNullOrWhiteSpace(value) || !rg.IsMatch(value)) value="Default"; - password = value; + Regex rg = new Regex("^(?=.*[A-Za-z])(?=.*\\d)[A-Za-z\\d]{8,}$"); + if (string.IsNullOrWhiteSpace(value) || !rg.IsMatch(value)) return;//throw new ArgumentNullException("password"); + else password = value; } } private string password; + public event PropertyChangedEventHandler? PropertyChanged; + //public int Role { get; } //private int role; - public List Followed_Games + public ObservableCollection Followed_Games { get; private init; } + /*public string UserImage + { get => userImage; + private set + { + if (!string.IsNullOrWhiteSpace(value)) userImage = value; + else userImage = "no_cover.png"; + } + } + private string userImage;*/ - public User(string username, string biographie, string email, string password) + public User(/*string userImage,*/string username, string biographie, string email, string password) { + /*if (userImage == null) UserImage="no_cover.png"; + else UserImage = userImage;*/ if (username == null) Username = "Default"; else Username = username; if (biographie == null) Biographie = "Default"; @@ -69,7 +84,7 @@ namespace Model else Email = email; if (password == null) throw new ArgumentNullException("password"); else Password = password; - Followed_Games = new List(); + Followed_Games = new ObservableCollection(); //Role = 0; } public void AddReview(Game game, float rate, string text) diff --git a/Sources/Stim/DetailledPage.xaml b/Sources/Stim/DetailledPage.xaml index 7a7fefb..4b6c05b 100644 --- a/Sources/Stim/DetailledPage.xaml +++ b/Sources/Stim/DetailledPage.xaml @@ -43,7 +43,7 @@