Some windows need killing when a puzzle is complete. Close all extra windows.

This commit is contained in:
Tim Young 2017-06-15 08:48:09 -05:00
parent 49be222b5d
commit 5912e1244f

View File

@ -817,14 +817,30 @@ namespace EduNetworkBuilder
Properties.Settings.Default.Save(); Properties.Settings.Default.Save();
} }
} }
//kill all extra windows that no longer need to be open.
KillAllExtraWindows();
DialogResult answer = MessageBox.Show(NB.Translate("N_MarkAsSolvedDone"),NB.Translate("_Solved"),MessageBoxButtons.YesNo); DialogResult answer = MessageBox.Show(NB.Translate("N_MarkAsSolvedDone"),NB.Translate("_Solved"),MessageBoxButtons.YesNo);
if(answer == DialogResult.Yes)
if (answer == DialogResult.Yes)
{ {
ListBoxWindow LBW = new ListBoxWindow(); ListBoxWindow LBW = new ListBoxWindow();
LBW.ShowDialog(); LBW.ShowDialog();
} }
} }
void KillAllExtraWindows()
{
for(int i = Application.OpenForms.Count -1; i >=0; i--)
{
if (Application.OpenForms[i].Name == "BuilderWindow") continue; //We do not kill the builder window
if (Application.OpenForms[i].Name == "RTFWindow") continue; //We do not kill the rtf window
Application.OpenForms[i].Hide(); //make them disappear
Application.OpenForms[i].Close(); //actually close them
}
}
/// <summary> /// <summary>
/// See if we have any tests that are supposed to check for packet arrival. /// See if we have any tests that are supposed to check for packet arrival.
/// </summary> /// </summary>