From 03c9f3404af2354883ff0b85afc0b11fe568e3d7 Mon Sep 17 00:00:00 2001 From: Tim Young Date: Fri, 28 Sep 2018 08:07:54 -0500 Subject: [PATCH] Make a test-all button --- EduNetworkBuilder/ListBoxWindow.cs | 33 ++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/EduNetworkBuilder/ListBoxWindow.cs b/EduNetworkBuilder/ListBoxWindow.cs index 85eff67..9fed7b5 100644 --- a/EduNetworkBuilder/ListBoxWindow.cs +++ b/EduNetworkBuilder/ListBoxWindow.cs @@ -396,10 +396,13 @@ namespace EduNetworkBuilder if (MyMode == LBContents.regressiontest) { cbLoadPuzzlesAtStart.Visible = false; - btnReset.Visible = false; + btnReset.Visible = true; + btnReset.Text = "Close"; tbSearchBox.Visible = false; - btnOK.Text = "Test"; + btnAdd.Text = "Test All"; + + btnOK.Text = "Test One"; PuzzleInfo pi; string shown_name; @@ -408,6 +411,7 @@ namespace EduNetworkBuilder NBSettings oursettings = NB.GetSettings(); if (Puzzles == null) return; bool wasfinished = false; + int count = 0; foreach (string str in Puzzles) { wasfinished = false; @@ -443,6 +447,7 @@ namespace EduNetworkBuilder MPE.HasTest = oursettings.HasReplay(puzzle_name); if (selected == "" && !wasfinished) selected = shown_name; //Select the first unfinished puzzle lbWindowData.Items.Add(MPE); + if(MPE.HasTest) count++; //we can only test-all if there are tests to do break; } } @@ -460,6 +465,8 @@ namespace EduNetworkBuilder { btnOK.Enabled = false; } + if (count > 0) btnAdd.Enabled = true; + else btnAdd.Enabled = false; } } @@ -633,7 +640,7 @@ namespace EduNetworkBuilder } Close(); } - //In regression, this is the close button + //In regression, this is the test all button if (MyMode == LBContents.regressiontest) { ClosingRegression = true; @@ -742,12 +749,22 @@ namespace EduNetworkBuilder private void btnReset_Click(object sender, EventArgs e) { - DialogResult answer = MessageBox.Show(NB.Translate("LBW_btnResetYouSure"), NB.Translate("LBW_btnResetForget"), MessageBoxButtons.YesNo); - if (answer == System.Windows.Forms.DialogResult.Yes) + if (MyMode == LBContents.regressiontest) { - NBSettings oursettings = NB.GetSettings(); - oursettings.ScoreList.Clear(); - UpdateForm(); + //In regressiontest mode, this is the cancel. + ClosingRegression = true; + Close(); + return; + } + else + { + DialogResult answer = MessageBox.Show(NB.Translate("LBW_btnResetYouSure"), NB.Translate("LBW_btnResetForget"), MessageBoxButtons.YesNo); + if (answer == System.Windows.Forms.DialogResult.Yes) + { + NBSettings oursettings = NB.GetSettings(); + oursettings.ScoreList.Clear(); + UpdateForm(); + } } }