Save the level we are working on

This commit is contained in:
Tim Young 2015-11-22 09:01:59 -05:00
parent 3f5100dcc0
commit 78bbfa8275
7 changed files with 86 additions and 4 deletions

View File

@ -34,6 +34,9 @@
<setting name="MainWindowHeight" serializeAs="String"> <setting name="MainWindowHeight" serializeAs="String">
<value>-1</value> <value>-1</value>
</setting> </setting>
<setting name="ProcessingLevel" serializeAs="String">
<value>none</value>
</setting>
</EduNetworkBuilder.Properties.Settings> </EduNetworkBuilder.Properties.Settings>
</userSettings> </userSettings>
</configuration> </configuration>

View File

@ -151,14 +151,26 @@ namespace EduNetworkBuilder
if (Properties.Settings.Default.ScoreList == null) if (Properties.Settings.Default.ScoreList == null)
Properties.Settings.Default.ScoreList = new System.Collections.Specialized.StringCollection(); Properties.Settings.Default.ScoreList = new System.Collections.Specialized.StringCollection();
PuzzleInfo PI; 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()) foreach (string str in NB.GetPuzzleNames())
{ {
if(!Properties.Settings.Default.ScoreList.Contains(str)) if(!Properties.Settings.Default.ScoreList.Contains(str))
{ {
PI = NB.GetPuzzleInfoFromName(str); PI = NB.GetPuzzleInfoFromName(str);
return "Level_" + PI.Level; first = "Level_" + PI.Level;
break;
} }
} }
if (first != "")
return first;
return NB.Translate("_All"); return NB.Translate("_All");
} }
@ -308,6 +320,28 @@ namespace EduNetworkBuilder
{ {
processing = true; processing = true;
DebugLevel toFind; 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) if (MyMode == LBContents.messages)
{ {
foreach (Control mycontrol in panelCheckboxes.Controls) foreach (Control mycontrol in panelCheckboxes.Controls)
@ -319,6 +353,8 @@ namespace EduNetworkBuilder
if ((toFind & WhatToDisplay) == toFind) if ((toFind & WhatToDisplay) == toFind)
{ {
cb.Checked = true; cb.Checked = true;
labelname = mycontrol.Text;
mycount++;
} }
else //If not, mark it as not checked. else //If not, mark it as not checked.
{ {

View File

@ -465,6 +465,13 @@ namespace EduNetworkBuilder
return myWin.GetPuzzleTags(); 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<string> GetPuzzleNames() public static List<string> GetPuzzleNames()
{ {
BuilderWindow myWin = (BuilderWindow)Application.OpenForms["BuilderWindow"]; BuilderWindow myWin = (BuilderWindow)Application.OpenForms["BuilderWindow"];

View File

@ -461,6 +461,24 @@ namespace EduNetworkBuilder
return null; 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<string> GetPuzzleTags() public List<string> GetPuzzleTags()
{ {
List<string> PuzzleTags = new List<string>(); List<string> PuzzleTags = new List<string>();
@ -486,6 +504,7 @@ namespace EduNetworkBuilder
LevelTags.AddRange(PuzzleTags); LevelTags.AddRange(PuzzleTags);
return LevelTags; return LevelTags;
} }
public List<string> GetPuzzleNames() public List<string> GetPuzzleNames()
{ {
List<string> PuzzleNames = new List<string>(); List<string> PuzzleNames = new List<string>();
@ -495,6 +514,7 @@ namespace EduNetworkBuilder
} }
return PuzzleNames; return PuzzleNames;
} }
private void btnClick(object sender, EventArgs e) private void btnClick(object sender, EventArgs e)
{ {
foreach(Control btn in Buttons) foreach(Control btn in Buttons)

View File

@ -1,7 +1,7 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // 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 // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.
@ -12,7 +12,7 @@ namespace EduNetworkBuilder.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [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 { internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
@ -129,5 +129,17 @@ namespace EduNetworkBuilder.Properties {
this["MainWindowHeight"] = value; 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;
}
}
} }
} }

View File

@ -29,5 +29,8 @@
<Setting Name="MainWindowHeight" Type="System.Int32" Scope="User"> <Setting Name="MainWindowHeight" Type="System.Int32" Scope="User">
<Value Profile="(Default)">-1</Value> <Value Profile="(Default)">-1</Value>
</Setting> </Setting>
<Setting Name="ProcessingLevel" Type="System.String" Scope="User">
<Value Profile="(Default)">none</Value>
</Setting>
</Settings> </Settings>
</SettingsFile> </SettingsFile>

View File

@ -5,7 +5,8 @@
* Fixed size of labels on IP-Address editor box\par * Fixed size of labels on IP-Address editor box\par
* Hide gateway label when we do not need it. (ip-address editor)\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 * 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 Version 1.0.24 \par
\b0 * Add sound when ctrl-s is pressed so we know we saved.\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 * Add sound fail when save is canceled (will use it later if ctrl-s fails)\par