Change auto-select of puzzle to work when earlier level puzzles are not done. Only select it when it is going to be shown.

This commit is contained in:
Tim Young 2017-06-19 13:02:55 -05:00
parent 0eceb5e3e3
commit 64ff7a72ed

View File

@ -228,20 +228,24 @@ namespace EduNetworkBuilder
List<string> Puzzles = NB.GetPuzzleNames();
NBSettings oursettings = NB.GetSettings();
if (Puzzles == null) return;
bool wasfinished = false;
foreach (string str in Puzzles)
{
wasfinished = false;
if (FilterString == "")
{
pi = NB.GetPuzzleInfoFromName(str);
shown_name = pi.PuzzleName;
if (oursettings.ScoreList.Contains(str))
{
shown_name = "* " + shown_name;
else if (selected == "")
selected = shown_name; //Select the first unfinished puzzle
wasfinished = true;
}
foreach (string tag in pi.PuzzleTags)
{
if (isChecked(tag))
{
if(selected == "" && !wasfinished) selected = shown_name; //Select the first unfinished puzzle
lbWindowData.Items.Add(shown_name);
break;
}
@ -254,9 +258,10 @@ namespace EduNetworkBuilder
bool added = false;
string localFilter = ".*" + FilterString + ".*";
if (oursettings.ScoreList.Contains(str))
{
shown_name = "* " + shown_name;
else if (selected == "")
selected = shown_name; //Select the first unfinished puzzle
wasfinished = true;
}
if (!added && pi.PuzzleName != null && Regex.IsMatch(pi.PuzzleName, localFilter, RegexOptions.IgnoreCase))
{
added = true;
@ -276,6 +281,7 @@ namespace EduNetworkBuilder
{
if (!added && pi.PuzzleTitle != null && Regex.IsMatch(tag, localFilter, RegexOptions.IgnoreCase))
{
if (selected == "" && !wasfinished) selected = shown_name; //Select the first unfinished puzzle
lbWindowData.Items.Add(shown_name);
break;
}