From 1ab8e0e0fb8e28eb1cc19fe2bafa315952b28e08 Mon Sep 17 00:00:00 2001 From: Tim Young Date: Sat, 29 Jul 2017 18:42:27 -0500 Subject: [PATCH] Mark puzzles as done in the user file --- EduNetworkBuilder/NBSettings.cs | 15 +++++++++++++++ EduNetworkBuilder/Network.cs | 6 +----- EduNetworkBuilder/PersonClass.cs | 8 ++++++++ 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/EduNetworkBuilder/NBSettings.cs b/EduNetworkBuilder/NBSettings.cs index ccd70a1..816ab27 100644 --- a/EduNetworkBuilder/NBSettings.cs +++ b/EduNetworkBuilder/NBSettings.cs @@ -107,6 +107,21 @@ namespace EduNetworkBuilder } } + public void MarkAsDone(string PuzzleName) + { + PersonClass PC = NB.GetUser(); + if(PC != null) + { + PC.MarkAsDone(PuzzleName); //Mark it on the user's personal settings. + } + //we just mark it in the settings class + if (!ScoreList.Contains(PuzzleName)) + { + ScoreList.Add(PuzzleName); + Save(); + } + } + public static string GetFilename() { string BaseDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); diff --git a/EduNetworkBuilder/Network.cs b/EduNetworkBuilder/Network.cs index 76aedbd..7d62696 100644 --- a/EduNetworkBuilder/Network.cs +++ b/EduNetworkBuilder/Network.cs @@ -881,11 +881,7 @@ namespace EduNetworkBuilder if (PuzzleName != "" && PuzzleName != null) { NBSettings oursettings = NB.GetSettings(); - if (!oursettings.ScoreList.Contains(PuzzleName)) - { - oursettings.ScoreList.Add(PuzzleName); - oursettings.Save(); - } + oursettings.MarkAsDone(PuzzleName); } } //kill all extra windows that no longer need to be open. diff --git a/EduNetworkBuilder/PersonClass.cs b/EduNetworkBuilder/PersonClass.cs index fe6a16d..88320e1 100644 --- a/EduNetworkBuilder/PersonClass.cs +++ b/EduNetworkBuilder/PersonClass.cs @@ -178,5 +178,13 @@ namespace EduNetworkBuilder writer.WriteEndElement(); } #endregion + + public void MarkAsDone(string PuzzleName) + { + if (!EverCompletedPuzzles.Contains(PuzzleName)) + { + EverCompletedPuzzles.Add(PuzzleName); + } + } } }