From 296198550ad4dbd8d525819f77d1fc71235ce610 Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Mon, 9 Dec 2019 09:14:25 +0100 Subject: [PATCH] CLosing modeless forms Adjustment.WMErrorsForm and PulsesTest.WMPulsesForm. --- .../TestMethods/Adjustment/AdjustmentSeq.cs | 26 +++++++++++-------- .../TestMethods/Adjustment/WMErrorsForm.cs | 2 ++ .../TestMethods/Adjustment/WMErrorsForm12.cs | 2 ++ .../TestMethods/Adjustment/WMErrorsForm24.cs | 2 ++ .../TestMethods/PulsesTest/PulsesTestSeq.cs | 23 +++++++++------- .../TestMethods/PulsesTest/WMPulsesForm.cs | 2 ++ .../TestMethods/PulsesTest/WMPulsesForm12.cs | 2 ++ .../TestMethods/PulsesTest/WMPulsesForm24.cs | 2 ++ 8 files changed, 41 insertions(+), 20 deletions(-) diff --git a/TBF/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs b/TBF/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs index 02cc6a286..1539a3e2e 100644 --- a/TBF/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs +++ b/TBF/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs @@ -85,7 +85,6 @@ namespace TBF.BenchControl.TestMethods.Adjustment checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, false); - int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }; if (sensPath != null && sensPath.RegisterReaders != null) { @@ -115,7 +114,11 @@ namespace TBF.BenchControl.TestMethods.Adjustment LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse; /// [ltr/pulse], nominal flow in [m3/h] int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f); + int flowSetTime = 0; + /// Start the test, initialize test results + Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, totalPulses)); + string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr); /// Read pressure and temperature once before calling Bridge.OnTestSelected(...) State.Create(string.Format("{0}({1}) : Measuring process data", test.Method, test.Name)) @@ -129,13 +132,9 @@ namespace TBF.BenchControl.TestMethods.Adjustment } while (e.Contains(Event.Busy)); - /// Start the test, initialize test results - Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, totalPulses)); - string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr); - TestStartTime = DateTime.Now; - Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); - int flowSetTime0 = StateMachine.Time; + TestStartTime = DateTime.Now; + int flowSetTime0 = StateMachine.Time; //------------------------------------------------ Bridge.OnActivity(this, Strings.Starting_the_pump); @@ -241,7 +240,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment flow_set: - int flowSetTime = StateMachine.Time - flowSetTime0; + flowSetTime = StateMachine.Time - flowSetTime0; if (test.DoControlWaterTemp && benchPath.TempMtrUp != null && benchPath.TempMtrDown != null) { @@ -488,7 +487,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment /// Update modeless dialog error information Bridge.OnAdjustmentInProgress(this, new AdjustmentInProgressEventArgs(testName)); - /// Test 'Quit' + /// Close the modeless form if ((modelessDlg is GenericDevices.IHasCompleted) && !(modelessDlg as GenericDevices.IHasCompleted).Completed) { goto loop; /// Modeless dilaog not closed, keep looping @@ -500,6 +499,13 @@ namespace TBF.BenchControl.TestMethods.Adjustment stopTest: + /// Close the modeless form + if ((modelessDlg is GenericDevices.IHasCompleted) && !(modelessDlg as GenericDevices.IHasCompleted).Completed) + { + goto loop; /// Modeless dilaog not closed, keep looping + } + modelessDlg = null; /// Modeless dialog is closed now + /// /// Quit this sequence /// @@ -517,8 +523,6 @@ namespace TBF.BenchControl.TestMethods.Adjustment while (!e.Contains(Event.PreviousStopped)); } - stopTestWOStoppingDivGateEtc: - return new List { retVal }; } } diff --git a/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm.cs b/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm.cs index 58f938064..913e61c93 100644 --- a/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm.cs +++ b/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm.cs @@ -67,6 +67,8 @@ namespace TBF.BenchControl.TestMethods.Adjustment completed = false; + StartForceCloseHandler(); + /// Attach to 'AdjustmentInProgress' handler UiBridge.Bridge.AdjustmentInProgressHandler += delegate(object sender, UiBridge.AdjustmentInProgressEventArgs args) { diff --git a/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm12.cs b/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm12.cs index 48c437471..7594e0b52 100644 --- a/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm12.cs +++ b/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm12.cs @@ -72,6 +72,8 @@ namespace TBF.BenchControl.TestMethods.Adjustment completed = false; + StartForceCloseHandler(); + /// Attach to 'AdjustmentInProgress' handler UiBridge.Bridge.AdjustmentInProgressHandler += delegate(object sender, UiBridge.AdjustmentInProgressEventArgs args) { diff --git a/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm24.cs b/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm24.cs index b9ee7a2dc..8869cbe88 100644 --- a/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm24.cs +++ b/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm24.cs @@ -76,6 +76,8 @@ namespace TBF.BenchControl.TestMethods.Adjustment completed = false; + StartForceCloseHandler(); + /// Attach to 'AdjustmentInProgress' handler UiBridge.Bridge.AdjustmentInProgressHandler += delegate(object sender, UiBridge.AdjustmentInProgressEventArgs args) { diff --git a/TBF/BenchControl/TestMethods/PulsesTest/PulsesTestSeq.cs b/TBF/BenchControl/TestMethods/PulsesTest/PulsesTestSeq.cs index 69c285913..e11c2b8e6 100644 --- a/TBF/BenchControl/TestMethods/PulsesTest/PulsesTestSeq.cs +++ b/TBF/BenchControl/TestMethods/PulsesTest/PulsesTestSeq.cs @@ -115,6 +115,10 @@ namespace TBF.BenchControl.TestMethods.PulsesTest LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse; /// [ltr/pulse], nominal flow in [m3/h] int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f); + /// Start the test, initialize test results + Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, totalPulses)); + string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr); + /// Read pressure and temperature once before calling Bridge.OnTestSelected(...) State.Create(string.Format("{0}({1}) : Measuring process data", test.Method, test.Name)) .AddOperation(checkUiOp) @@ -127,13 +131,9 @@ namespace TBF.BenchControl.TestMethods.PulsesTest } while (e.Contains(Event.Busy)); - /// Start the test, initialize test results - Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, totalPulses)); - string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr); - TestStartTime = DateTime.Now; - Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); - int flowSetTime0 = StateMachine.Time; + TestStartTime = DateTime.Now; + int flowSetTime0 = StateMachine.Time; //------------------------------------------------ Bridge.OnActivity(this, Strings.Starting_the_pump); @@ -483,7 +483,7 @@ namespace TBF.BenchControl.TestMethods.PulsesTest /// Update modeless dialog error information Bridge.OnPulsesTestInProgress(this, new PulsesTestInProgressEventArgs(testName, (double)testParams.MinPulsesCount)); - /// Test 'Quit' + /// Close the modeless form if ((modelessDlg is GenericDevices.IHasCompleted) && !(modelessDlg as GenericDevices.IHasCompleted).Completed) { UiBridge.Bridge.OnCloseModelessForm(this, null); /// Close the modeless dialog @@ -497,6 +497,13 @@ namespace TBF.BenchControl.TestMethods.PulsesTest stopTest: + /// Close the modeless form + if ((modelessDlg is GenericDevices.IHasCompleted) && !(modelessDlg as GenericDevices.IHasCompleted).Completed) + { + UiBridge.Bridge.OnCloseModelessForm(this, null); /// Close the modeless dialog + } + modelessDlg = null; /// Modeless dialog is closed now + /// /// Quit this sequence /// @@ -514,8 +521,6 @@ namespace TBF.BenchControl.TestMethods.PulsesTest while (!e.Contains(Event.PreviousStopped)); } - stopTestWOStoppingDivGateEtc: - return new List { retVal }; } } diff --git a/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm.cs b/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm.cs index accb830d3..92bb18452 100644 --- a/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm.cs +++ b/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm.cs @@ -62,6 +62,8 @@ namespace TBF.BenchControl.TestMethods.PulsesTest completed = false; minPulsesCount = 1; /// Must be >0 so that initially the indication is RED + StartForceCloseHandler(); + /// Attach to 'AdjustmentInProgress' handler UiBridge.Bridge.PulsesTestInProgressHandler += delegate(object sender, UiBridge.PulsesTestInProgressEventArgs args) { diff --git a/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm12.cs b/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm12.cs index 49d38e6ac..1ddb6200b 100644 --- a/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm12.cs +++ b/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm12.cs @@ -72,6 +72,8 @@ namespace TBF.BenchControl.TestMethods.PulsesTest completed = false; minPulsesCount = 1; /// Must be >0 so that initially the indication is RED + StartForceCloseHandler(); + /// Attach to 'AdjustmentInProgress' handler UiBridge.Bridge.PulsesTestInProgressHandler += delegate(object sender, UiBridge.PulsesTestInProgressEventArgs args) { diff --git a/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm24.cs b/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm24.cs index 4b35b6283..2b99c214d 100644 --- a/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm24.cs +++ b/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm24.cs @@ -78,6 +78,8 @@ namespace TBF.BenchControl.TestMethods.PulsesTest completed = false; minPulsesCount = 1; /// Must be >0 so that initially the indication is RED + StartForceCloseHandler(); + /// Attach to 'AdjustmentInProgress' handler UiBridge.Bridge.PulsesTestInProgressHandler += delegate(object sender, UiBridge.PulsesTestInProgressEventArgs args) {