From b00cee2d3ed46c530a470c37b1463592cf8d3bf1 Mon Sep 17 00:00:00 2001 From: Alexandre Agostinho Date: Sat, 10 Jun 2023 04:38:06 +0200 Subject: [PATCH] fix saving --- MCTG/Views/App.xaml.cs | 1 - MCTG/Views/ContentPages/AddRecipe.xaml.cs | 8 ++++++++ MCTG/Views/ContentPages/Login.xaml.cs | 8 ++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/MCTG/Views/App.xaml.cs b/MCTG/Views/App.xaml.cs index a36e2a5..0dd959c 100644 --- a/MCTG/Views/App.xaml.cs +++ b/MCTG/Views/App.xaml.cs @@ -73,7 +73,6 @@ namespace Views base.OnSleep(); } - /// /// Load XML raw assets from data. diff --git a/MCTG/Views/ContentPages/AddRecipe.xaml.cs b/MCTG/Views/ContentPages/AddRecipe.xaml.cs index fa62bdb..c6ca924 100644 --- a/MCTG/Views/ContentPages/AddRecipe.xaml.cs +++ b/MCTG/Views/ContentPages/AddRecipe.xaml.cs @@ -82,6 +82,14 @@ namespace Views newRecipe.Ingredients.AddRange(IngredientList); bool isRecipeSave = Master.Recipe.AddRecipeToData(newRecipe); + + // Save data. + Debug.Write($"[ {DateTime.Now:H:mm:ss} ] Saving...\t"); + Master.Data.SaveData(); + + Debug.WriteLine("Done."); + Debug.WriteLine(FileSystem.Current.AppDataDirectory); + if (isRecipeSave) { await DisplayAlert("Succès", "La recette a été ajoutée avec succès", "OK"); diff --git a/MCTG/Views/ContentPages/Login.xaml.cs b/MCTG/Views/ContentPages/Login.xaml.cs index ac40aa2..4bdb2c6 100644 --- a/MCTG/Views/ContentPages/Login.xaml.cs +++ b/MCTG/Views/ContentPages/Login.xaml.cs @@ -1,5 +1,6 @@ using AppException; using Model; +using System.Diagnostics; namespace Views; @@ -24,6 +25,13 @@ public partial class Login : ContentPage try { usermgr.AddUserToData(usermgr.CreateUser(mail, password)); + + // Save data. + Debug.Write($"[ {DateTime.Now:H:mm:ss} ] Saving...\t"); + Master.Data.SaveData(); + + Debug.WriteLine("Done."); + Debug.WriteLine(FileSystem.Current.AppDataDirectory); } catch (BadMailFormatException) {