diff --git a/EduNetworkBuilder/ListBoxWindow.cs b/EduNetworkBuilder/ListBoxWindow.cs index 15b635a..31d05b5 100644 --- a/EduNetworkBuilder/ListBoxWindow.cs +++ b/EduNetworkBuilder/ListBoxWindow.cs @@ -57,6 +57,8 @@ namespace EduNetworkBuilder string NoTestString = "No Test"; string PassedString = "Passed"; string FailedString = "Failed;"; + public bool ClosingRegression = false; + /// /// Instantiate a ListBoxWindow for use in choosing a network to load @@ -494,6 +496,7 @@ namespace EduNetworkBuilder if (lbWindowData.SelectedItem != null) NB.LoadNetworkFromResource(TheName); } + Close(); } else if (MyMode == LBContents.regressiontest) { @@ -507,10 +510,13 @@ namespace EduNetworkBuilder { myWin.Activate(); myWin.replayNetwork(TheName, 1); + //Return back to the listbox window + Visible = true; + Activate(); } } } - Close(); + else Close(); } /// @@ -621,7 +627,8 @@ namespace EduNetworkBuilder } //In regression, this is the close button if (MyMode == LBContents.regressiontest) - { + { + ClosingRegression = true; Close(); } } diff --git a/EduNetworkBuilder/NB.cs b/EduNetworkBuilder/NB.cs index 6994210..37190d7 100644 --- a/EduNetworkBuilder/NB.cs +++ b/EduNetworkBuilder/NB.cs @@ -494,6 +494,7 @@ namespace EduNetworkBuilder myWin.RegisterInvisibleNet(ToRegister); } + public static void UnregisterInvisibleNetwork() { BuilderWindow myWin = (BuilderWindow)Application.OpenForms["BuilderWindow"]; @@ -501,6 +502,13 @@ namespace EduNetworkBuilder myWin.UnregisterInvisibleNet(); } + public static bool ProcessingInvisibleNetwork() + { + BuilderWindow myWin = (BuilderWindow)Application.OpenForms["BuilderWindow"]; + if (myWin == null) return false; + return myWin.ProcessingInvisibleNet(); + } + /// /// Make sure we update the visuals when we have the opportunity to do so /// diff --git a/EduNetworkBuilder/Network.cs b/EduNetworkBuilder/Network.cs index 77a3644..4f4f4b4 100644 --- a/EduNetworkBuilder/Network.cs +++ b/EduNetworkBuilder/Network.cs @@ -1214,13 +1214,21 @@ namespace EduNetworkBuilder } } } - answer = MessageBox.Show(NB.Translate("N_MarkAsSolvedDone"), NB.Translate("_Solved"), MessageBoxButtons.YesNo); - - if (answer == DialogResult.Yes) + //If we are processing an invisible replay, do not prompt... + if (!(NB.ProcessingInvisibleNetwork() && oursettings != null && oursettings.ReplayMode)) { - KillAllExtraWindows(true); - ListBoxWindow LBW = new ListBoxWindow(); - LBW.ShowDialog(); + answer = MessageBox.Show(NB.Translate("N_MarkAsSolvedDone"), NB.Translate("_Solved"), MessageBoxButtons.YesNo); + + if (answer == DialogResult.Yes) + { + KillAllExtraWindows(true); + ListBoxWindow LBW = new ListBoxWindow(); + LBW.ShowDialog(); + } + } + else + { + //We should go back to our replay window. } } else diff --git a/EduNetworkBuilder/NetworkBuilder.cs b/EduNetworkBuilder/NetworkBuilder.cs index fc67131..8f36fc2 100644 --- a/EduNetworkBuilder/NetworkBuilder.cs +++ b/EduNetworkBuilder/NetworkBuilder.cs @@ -2965,7 +2965,11 @@ namespace EduNetworkBuilder private void regressionTestingToolStripMenuItem_Click(object sender, EventArgs e) { ListBoxWindow LBW = new ListBoxWindow(null, LBContents.regressiontest); - LBW.ShowDialog(); + //We want to show dialog, but it needs to go to the background. After that, + //It returns from the show dialog. So we need to loop continuously until + //It is completed. + while (!LBW.ClosingRegression) + LBW.ShowDialog(); } #endregion