Have regression testing return to the listbox window when a test has completed.

This commit is contained in:
Tim Young 2018-09-26 10:33:22 -05:00
parent aaf7afdd65
commit 73b11719b8
4 changed files with 36 additions and 9 deletions

View File

@ -57,6 +57,8 @@ namespace EduNetworkBuilder
string NoTestString = "No Test"; string NoTestString = "No Test";
string PassedString = "Passed"; string PassedString = "Passed";
string FailedString = "Failed;"; string FailedString = "Failed;";
public bool ClosingRegression = false;
/// <summary> /// <summary>
/// Instantiate a ListBoxWindow for use in choosing a network to load /// Instantiate a ListBoxWindow for use in choosing a network to load
@ -494,6 +496,7 @@ namespace EduNetworkBuilder
if (lbWindowData.SelectedItem != null) if (lbWindowData.SelectedItem != null)
NB.LoadNetworkFromResource(TheName); NB.LoadNetworkFromResource(TheName);
} }
Close();
} }
else if (MyMode == LBContents.regressiontest) else if (MyMode == LBContents.regressiontest)
{ {
@ -507,10 +510,13 @@ namespace EduNetworkBuilder
{ {
myWin.Activate(); myWin.Activate();
myWin.replayNetwork(TheName, 1); myWin.replayNetwork(TheName, 1);
//Return back to the listbox window
Visible = true;
Activate();
} }
} }
} }
Close(); else Close();
} }
/// <summary> /// <summary>
@ -622,6 +628,7 @@ namespace EduNetworkBuilder
//In regression, this is the close button //In regression, this is the close button
if (MyMode == LBContents.regressiontest) if (MyMode == LBContents.regressiontest)
{ {
ClosingRegression = true;
Close(); Close();
} }
} }

View File

@ -494,6 +494,7 @@ namespace EduNetworkBuilder
myWin.RegisterInvisibleNet(ToRegister); myWin.RegisterInvisibleNet(ToRegister);
} }
public static void UnregisterInvisibleNetwork() public static void UnregisterInvisibleNetwork()
{ {
BuilderWindow myWin = (BuilderWindow)Application.OpenForms["BuilderWindow"]; BuilderWindow myWin = (BuilderWindow)Application.OpenForms["BuilderWindow"];
@ -501,6 +502,13 @@ namespace EduNetworkBuilder
myWin.UnregisterInvisibleNet(); myWin.UnregisterInvisibleNet();
} }
public static bool ProcessingInvisibleNetwork()
{
BuilderWindow myWin = (BuilderWindow)Application.OpenForms["BuilderWindow"];
if (myWin == null) return false;
return myWin.ProcessingInvisibleNet();
}
/// <summary> /// <summary>
/// Make sure we update the visuals when we have the opportunity to do so /// Make sure we update the visuals when we have the opportunity to do so
/// </summary> /// </summary>

View File

@ -1214,6 +1214,9 @@ namespace EduNetworkBuilder
} }
} }
} }
//If we are processing an invisible replay, do not prompt...
if (!(NB.ProcessingInvisibleNetwork() && oursettings != null && oursettings.ReplayMode))
{
answer = MessageBox.Show(NB.Translate("N_MarkAsSolvedDone"), NB.Translate("_Solved"), MessageBoxButtons.YesNo); answer = MessageBox.Show(NB.Translate("N_MarkAsSolvedDone"), NB.Translate("_Solved"), MessageBoxButtons.YesNo);
if (answer == DialogResult.Yes) if (answer == DialogResult.Yes)
@ -1224,6 +1227,11 @@ namespace EduNetworkBuilder
} }
} }
else else
{
//We should go back to our replay window.
}
}
else
{ {
//It was a randomly generated puzzle. Let them know it was solved. But we do not auto-load a new one. //It was a randomly generated puzzle. Let them know it was solved. But we do not auto-load a new one.
MessageBox.Show(NB.Translate("N_MarkRandomAsSolvedDone"), NB.Translate("_Solved"), MessageBoxButtons.OK); MessageBox.Show(NB.Translate("N_MarkRandomAsSolvedDone"), NB.Translate("_Solved"), MessageBoxButtons.OK);

View File

@ -2965,6 +2965,10 @@ namespace EduNetworkBuilder
private void regressionTestingToolStripMenuItem_Click(object sender, EventArgs e) private void regressionTestingToolStripMenuItem_Click(object sender, EventArgs e)
{ {
ListBoxWindow LBW = new ListBoxWindow(null, LBContents.regressiontest); ListBoxWindow LBW = new ListBoxWindow(null, LBContents.regressiontest);
//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(); LBW.ShowDialog();
} }