From 78bbfa827569c9850f63fb1df241c8f9a77fde18 Mon Sep 17 00:00:00 2001 From: Tim Young Date: Sun, 22 Nov 2015 09:01:59 -0500 Subject: [PATCH] Save the level we are working on --- EduNetworkBuilder/App.config | 3 ++ EduNetworkBuilder/ListBoxWindow.cs | 38 ++++++++++++++++++- EduNetworkBuilder/NB.cs | 7 ++++ EduNetworkBuilder/NetworkBuilder.cs | 20 ++++++++++ .../Properties/Settings.Designer.cs | 16 +++++++- .../Properties/Settings.settings | 3 ++ EduNetworkBuilder/Resources/ReleaseNotes.rtf | 3 +- 7 files changed, 86 insertions(+), 4 deletions(-) diff --git a/EduNetworkBuilder/App.config b/EduNetworkBuilder/App.config index 0e0349b..b358003 100644 --- a/EduNetworkBuilder/App.config +++ b/EduNetworkBuilder/App.config @@ -34,6 +34,9 @@ -1 + + none + \ No newline at end of file diff --git a/EduNetworkBuilder/ListBoxWindow.cs b/EduNetworkBuilder/ListBoxWindow.cs index f594ac8..58bd8d3 100644 --- a/EduNetworkBuilder/ListBoxWindow.cs +++ b/EduNetworkBuilder/ListBoxWindow.cs @@ -151,14 +151,26 @@ namespace EduNetworkBuilder if (Properties.Settings.Default.ScoreList == null) Properties.Settings.Default.ScoreList = new System.Collections.Specialized.StringCollection(); PuzzleInfo PI; + string first = ""; + + string OriginalChoice = Properties.Settings.Default.ProcessingLevel; + if(OriginalChoice != null) + { + if (NB.PuzzleLevelHasUnsolved(OriginalChoice)) + return OriginalChoice; + } + foreach (string str in NB.GetPuzzleNames()) { if(!Properties.Settings.Default.ScoreList.Contains(str)) { PI = NB.GetPuzzleInfoFromName(str); - return "Level_" + PI.Level; + first = "Level_" + PI.Level; + break; } } + if (first != "") + return first; return NB.Translate("_All"); } @@ -308,6 +320,28 @@ namespace EduNetworkBuilder { processing = true; DebugLevel toFind; + int mycount = 0; + string labelname = ""; + if (MyMode == LBContents.puzzles) + { + foreach (Control mycontrol in panelCheckboxes.Controls) + { + //pull out the name + CheckBox cb = (CheckBox)mycontrol; + //make an enum. See if that is set. If so, mark it as checked + if (cb.Checked) + { + mycount++; + labelname = mycontrol.Text; + } + } + if (mycount == 1) + { + //We only have one item checked. Store this value for later + Properties.Settings.Default.ProcessingLevel = labelname; + Properties.Settings.Default.Save(); + } + } if (MyMode == LBContents.messages) { foreach (Control mycontrol in panelCheckboxes.Controls) @@ -319,6 +353,8 @@ namespace EduNetworkBuilder if ((toFind & WhatToDisplay) == toFind) { cb.Checked = true; + labelname = mycontrol.Text; + mycount++; } else //If not, mark it as not checked. { diff --git a/EduNetworkBuilder/NB.cs b/EduNetworkBuilder/NB.cs index ad64041..111f882 100644 --- a/EduNetworkBuilder/NB.cs +++ b/EduNetworkBuilder/NB.cs @@ -465,6 +465,13 @@ namespace EduNetworkBuilder return myWin.GetPuzzleTags(); } + public static bool PuzzleLevelHasUnsolved(string LevelName) + { + BuilderWindow myWin = (BuilderWindow)Application.OpenForms["BuilderWindow"]; + if (myWin == null) return false; + return myWin.PuzzleLevelHasUnsolved(LevelName); + } + public static List GetPuzzleNames() { BuilderWindow myWin = (BuilderWindow)Application.OpenForms["BuilderWindow"]; diff --git a/EduNetworkBuilder/NetworkBuilder.cs b/EduNetworkBuilder/NetworkBuilder.cs index 685a2fd..b88f01c 100644 --- a/EduNetworkBuilder/NetworkBuilder.cs +++ b/EduNetworkBuilder/NetworkBuilder.cs @@ -461,6 +461,24 @@ namespace EduNetworkBuilder return null; } + public bool PuzzleLevelHasUnsolved(string LevelName) + { + if (Properties.Settings.Default.ScoreList == null) + Properties.Settings.Default.ScoreList = new System.Collections.Specialized.StringCollection(); + + foreach (PuzzleInfo pi in PuzzleList) + { + if ("Level_" + pi.Level.ToString() == LevelName) + { + if (!Properties.Settings.Default.ScoreList.Contains(pi.PuzzleName)) + { + return true; //We have one puzzle in the level which has not been solved + } + } + } + return false; + } + public List GetPuzzleTags() { List PuzzleTags = new List(); @@ -486,6 +504,7 @@ namespace EduNetworkBuilder LevelTags.AddRange(PuzzleTags); return LevelTags; } + public List GetPuzzleNames() { List PuzzleNames = new List(); @@ -495,6 +514,7 @@ namespace EduNetworkBuilder } return PuzzleNames; } + private void btnClick(object sender, EventArgs e) { foreach(Control btn in Buttons) diff --git a/EduNetworkBuilder/Properties/Settings.Designer.cs b/EduNetworkBuilder/Properties/Settings.Designer.cs index 9ceefb0..dcdb7af 100644 --- a/EduNetworkBuilder/Properties/Settings.Designer.cs +++ b/EduNetworkBuilder/Properties/Settings.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.34209 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -12,7 +12,7 @@ namespace EduNetworkBuilder.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); @@ -129,5 +129,17 @@ namespace EduNetworkBuilder.Properties { this["MainWindowHeight"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("none")] + public string ProcessingLevel { + get { + return ((string)(this["ProcessingLevel"])); + } + set { + this["ProcessingLevel"] = value; + } + } } } diff --git a/EduNetworkBuilder/Properties/Settings.settings b/EduNetworkBuilder/Properties/Settings.settings index 9c65c3b..1dd92c8 100644 --- a/EduNetworkBuilder/Properties/Settings.settings +++ b/EduNetworkBuilder/Properties/Settings.settings @@ -29,5 +29,8 @@ -1 + + none + \ No newline at end of file diff --git a/EduNetworkBuilder/Resources/ReleaseNotes.rtf b/EduNetworkBuilder/Resources/ReleaseNotes.rtf index fa747ab..291597f 100644 --- a/EduNetworkBuilder/Resources/ReleaseNotes.rtf +++ b/EduNetworkBuilder/Resources/ReleaseNotes.rtf @@ -5,7 +5,8 @@ * Fixed size of labels on IP-Address editor box\par * Hide gateway label when we do not need it. (ip-address editor)\par * rename "mixed network" puzzle to be "adding devices" (the puzzle was about adding devices)\par -* Changed layout of many messages\b\par +* Changed layout of many messages\par +* Save the level we are working on. Allows us to finish level 5 before level 3 if we want to.\b\par Version 1.0.24 \par \b0 * Add sound when ctrl-s is pressed so we know we saved.\par * Add sound fail when save is canceled (will use it later if ctrl-s fails)\par