diff --git a/Sources/AppConsole/Program.cs b/Sources/AppConsole/Program.cs index 82354c2..ef64994 100644 --- a/Sources/AppConsole/Program.cs +++ b/Sources/AppConsole/Program.cs @@ -1,4 +1,5 @@ -using Model; +using Microsoft.VisualBasic; +using Model; using StimPersistance; using StimStub; using System.Diagnostics.CodeAnalysis; @@ -10,9 +11,7 @@ namespace AppConsole { static void Main(string[] args) { - Manager stub = new(new Stub()); - Manager persistance = new(new Persistance("../../../../")); - persistance.Mgrpersistance.SaveGame(stub.GameList); + Console.WriteLine(""); } } } \ No newline at end of file diff --git a/Sources/Stim.Model/Manager.cs b/Sources/Stim.Model/Manager.cs index da4e746..bfb45f1 100644 --- a/Sources/Stim.Model/Manager.cs +++ b/Sources/Stim.Model/Manager.cs @@ -19,20 +19,16 @@ namespace Model // il y aura pas le pb car c'est le retour d'une collection Obs // donc potentiellement si les astres sont alignés ça devrait la mettre à jour public ObservableCollection ResearchedGame { get; set; } - public User CurrentUser { get; set; } + public Game? SelectedGame { get; set; } + public User? CurrentUser { get; set; } public HashSet Users { get; set; } public Manager(IPersistance persistance) { Mgrpersistance = persistance; - CurrentUser = new User("","", "", "", "Azerty123*"); GameList = persistance.LoadGame(); ResearchedGame = persistance.LoadGame(); Users = persistance.LoadUser(); - if (GameList == null) - { - GameList = new ObservableCollection(); - } } public IEnumerable FilterGames(string? filterName, string? filterTag1, string? filterTag2) diff --git a/Sources/Stim/App.xaml b/Sources/Stim/App.xaml index 0a0a4fe..9815e5e 100644 --- a/Sources/Stim/App.xaml +++ b/Sources/Stim/App.xaml @@ -9,6 +9,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sources/Stim/App.xaml.cs b/Sources/Stim/App.xaml.cs index 6d9c550..c1d580b 100644 --- a/Sources/Stim/App.xaml.cs +++ b/Sources/Stim/App.xaml.cs @@ -1,6 +1,7 @@ using Model; using StimPersistance; using StimStub; +using System.Diagnostics; namespace Stim; @@ -20,9 +21,19 @@ public partial class App : Application window.Stopped += (s, e) => { - Manager.Mgrpersistance = new Persistance(FileSystem.Current.AppDataDirectory); - Manager.SaveGames(); - Manager.SaveUser(); + if (!(File.Exists(Path.Combine(FileSystem.Current.AppDataDirectory, "games.xml")))) + { + Manager Manager2 = new(new Persistance(FileSystem.Current.AppDataDirectory)); + Manager2.GameList = Manager.GameList; + Manager2.Users = Manager2.Users; + Manager2.SaveGames(); + Manager2.SaveUser(); + } + else + { + Manager.SaveGames(); + Manager.SaveUser(); + } }; return window; diff --git a/Sources/Stim/DetailledPage.xaml b/Sources/Stim/DetailledPage.xaml index 77ee91d..575e31f 100644 --- a/Sources/Stim/DetailledPage.xaml +++ b/Sources/Stim/DetailledPage.xaml @@ -53,13 +53,7 @@