select the first unfinished puzzle on the level if one is available

This commit is contained in:
Tim Young 2018-10-17 16:23:13 -05:00
parent b74f9932bb
commit 8d848eaa39

View File

@ -261,6 +261,8 @@ namespace EduNetworkBuilder
private void UpdateForm()
{
int selectedIndex = lbWindowData.SelectedIndex;
int FirstUnfinishedIndex = -1;
string selected = "";
int topmost = lbWindowData.TopIndex;
int totalcount = lbWindowData.Items.Count;
@ -338,7 +340,10 @@ namespace EduNetworkBuilder
break;
}
}
}else
if (!wasfinished && FirstUnfinishedIndex == -1)
FirstUnfinishedIndex = lbWindowData.Items.Count - 1;
}
else
{
//We are filtering stuff
pi = NB.GetPuzzleInfoFromName(str);
@ -390,6 +395,11 @@ namespace EduNetworkBuilder
lbWindowData.TopIndex = topmost;
}
}
if(lbWindowData.SelectedIndex == -1 && FirstUnfinishedIndex != -1 )
{
if(lbWindowData.Items.Count > FirstUnfinishedIndex)
lbWindowData.SelectedIndex = FirstUnfinishedIndex; //Select the first unselected item if nothing else was selected
}
if(lbWindowData.SelectedIndex != -1)
{
btnOK.Enabled = true;