From fcb586b474706abb685a0ba4194a8952dc700090 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20LAVERGNE?= Date: Mon, 3 Jun 2024 13:21:00 +0200 Subject: [PATCH] Ajout des routes et manager (Persistance de Game) --- source/Trek-12/Trek-12/App.xaml.cs | 18 ++++++++++- source/Trek-12/Trek-12/Trek-12.csproj | 45 ++++++++++++++------------- 2 files changed, 40 insertions(+), 23 deletions(-) diff --git a/source/Trek-12/Trek-12/App.xaml.cs b/source/Trek-12/Trek-12/App.xaml.cs index 08757e4..35a7a0c 100644 --- a/source/Trek-12/Trek-12/App.xaml.cs +++ b/source/Trek-12/Trek-12/App.xaml.cs @@ -1,10 +1,26 @@ -namespace Trek_12 +using DataContractPersistence; +using Models.Game; + +namespace Trek_12 { public partial class App : Application { + public string FileName { get; set; } = "data.json"; + + public string FilePath { get; set; } = Path.Combine(AppDomain.CurrentDomain.BaseDirectory); + + public Game Manager { get; private set; } + public App() { InitializeComponent(); + + if(File.Exists(Path.Combine(FilePath, FileName))) + { + Manager = new Game(new DataContractJson()); + } + + Manager.LoadData(); MainPage = new AppShell(); } diff --git a/source/Trek-12/Trek-12/Trek-12.csproj b/source/Trek-12/Trek-12/Trek-12.csproj index 58891bc..8048ee5 100644 --- a/source/Trek-12/Trek-12/Trek-12.csproj +++ b/source/Trek-12/Trek-12/Trek-12.csproj @@ -56,9 +56,9 @@ - - - + + + @@ -68,32 +68,33 @@ - - - + + + + - - - PageLeaderBoard.xaml - - - PageProfils.xaml - - - PageRegles.xaml - + + + PageLeaderBoard.xaml + + + PageProfils.xaml + + + PageRegles.xaml + - - MSBuild:Compile + + MSBuild:Compile - - MSBuild:Compile + + MSBuild:Compile - - MSBuild:Compile + + MSBuild:Compile