Mono does not create new RTF windows if the RTF window is already there. It ends up with old puzzle information instead of new info. Kill the RTF window when going from puzzle to puzzle.

This commit is contained in:
Tim Young 2017-06-15 09:11:54 -05:00
parent 148b137c10
commit b7bef436d2

View File

@ -824,17 +824,18 @@ namespace EduNetworkBuilder
if (answer == DialogResult.Yes) if (answer == DialogResult.Yes)
{ {
KillAllExtraWindows(true);
ListBoxWindow LBW = new ListBoxWindow(); ListBoxWindow LBW = new ListBoxWindow();
LBW.ShowDialog(); LBW.ShowDialog();
} }
} }
void KillAllExtraWindows() void KillAllExtraWindows(bool EvenRTF=false)
{ {
for(int i = Application.OpenForms.Count -1; i >=0; i--) 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 == "BuilderWindow") continue; //We do not kill the builder window
if (Application.OpenForms[i].Name == "RTFWindow") continue; //We do not kill the rtf window if (EvenRTF && Application.OpenForms[i].Name == "RTFWindow") continue; //We do not kill the rtf window
Application.OpenForms[i].Hide(); //make them disappear Application.OpenForms[i].Hide(); //make them disappear
Application.OpenForms[i].Close(); //actually close them Application.OpenForms[i].Close(); //actually close them
} }