diff --git a/TestBenchFramework/BenchControl/Events.cs b/TestBenchFramework/BenchControl/Events.cs index 49cf2a42f..ffdf6c100 100644 --- a/TestBenchFramework/BenchControl/Events.cs +++ b/TestBenchFramework/BenchControl/Events.cs @@ -57,6 +57,12 @@ namespace TBF.BenchControl FC, /// FC protocol with Siemens address (1..31), default serial settings are 9600Bd, 8bits, PE, 1stop } + public enum UIFlowControl + { + Continue, + Stop, + } + /// /// StateMachine events (issued by operations, IOperation derived classes) /// diff --git a/TestBenchFramework/BenchControl/Sequences/MainSeq.cs b/TestBenchFramework/BenchControl/Sequences/MainSeq.cs index 890e663e8..6e5e63b25 100644 --- a/TestBenchFramework/BenchControl/Sequences/MainSeq.cs +++ b/TestBenchFramework/BenchControl/Sequences/MainSeq.cs @@ -244,7 +244,9 @@ namespace TBF.BenchControl.Sequences cycle_or_test_selected: - if (WaitBeginFormClosed()) goto stop_within_cycle; /// Make sure the entry form is closed + UiBridge.Bridge.OnError(this, string.Empty); /// Clear an error message (if any) + + if (UIFlowControl.Stop == WaitBeginFormClosed()) goto stop_within_cycle; /// Make sure the entry form is closed Bridge.Bench2UI(ButtonsEtc.StopBtnEn); /// Hide buttons @@ -371,11 +373,12 @@ namespace TBF.BenchControl.Sequences purge_end: save_results: - Bridge.Bench2UI(ButtonsEtc.StopBtnEn); // Hide the most of buttons + UiBridge.Bridge.OnError(this, string.Empty); /// Clear an error message (if any) + Bridge.Bench2UI(ButtonsEtc.StopBtnEn); /// Hide the most of buttons if (State.LastEvents.Contains(Event.ModelessFormIsOpen)) { - if (WaitBeginFormClosed()) goto stop; + if (UIFlowControl.Stop == WaitBeginFormClosed()) goto stop; } else if (State.LastEvents.Contains(Event.ModelessFormClosed)) { diff --git a/TestBenchFramework/BenchControl/Sequences/SequenceBase.cs b/TestBenchFramework/BenchControl/Sequences/SequenceBase.cs index 49877772d..e16626612 100644 --- a/TestBenchFramework/BenchControl/Sequences/SequenceBase.cs +++ b/TestBenchFramework/BenchControl/Sequences/SequenceBase.cs @@ -633,12 +633,12 @@ namespace TBF.BenchControl.Sequences /// This function is typically called at the end of the first test of the procedure. /// /// false = OK, true = stop pressed - protected bool WaitBeginFormClosed() + protected UIFlowControl WaitBeginFormClosed() { GenericDevices.IDataEntry dataEntryCmpnt = TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IDataEntry; - bool forcedClose = false; /// When STOP button pressed + bool stopPressed = false; /// true when STOP button pressed if (dataEntryCmpnt is IHasCycleBeginForm) { @@ -657,7 +657,7 @@ namespace TBF.BenchControl.Sequences e = StateMachine.WaitRunDevsRunOps(); if (e.Contains(Event.UiCmdStop)) { - forcedClose = true; + stopPressed = true; break; } } @@ -674,10 +674,10 @@ namespace TBF.BenchControl.Sequences .EnterState(); e = StateMachine.WaitRunDevsRunOps(); - if (e.Contains(Event.UiCmdStop)) { forcedClose = true; } + if (e.Contains(Event.UiCmdStop)) { stopPressed = true; } } - return forcedClose; + return stopPressed ? UIFlowControl.Stop : UIFlowControl.Continue; } diff --git a/TestBenchFramework/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs b/TestBenchFramework/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs index a68f72db5..e7e6ac241 100644 --- a/TestBenchFramework/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs @@ -240,7 +240,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment //------------------------------------------------ /// Make sure the CycleBeginForm is closed so that water meter data (s/n) can be copied into results - if (WaitBeginFormClosed()) goto stopTest; + if (UIFlowControl.Stop == WaitBeginFormClosed()) goto stopTest; /// /// Populate TestResult data entity with data diff --git a/TestBenchFramework/BenchControl/TestMethods/CombinedMeters/CombinedMetersSeq.cs b/TestBenchFramework/BenchControl/TestMethods/CombinedMeters/CombinedMetersSeq.cs index 75852aa59..2b10f327a 100644 --- a/TestBenchFramework/BenchControl/TestMethods/CombinedMeters/CombinedMetersSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/CombinedMeters/CombinedMetersSeq.cs @@ -362,7 +362,7 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters //------------------------------------------------ /// Make sure the CycleBeginForm is closed so that water meter data (s/n) can be copied into results - if (WaitBeginFormClosed()) goto stopTest; + if (UIFlowControl.Stop == WaitBeginFormClosed()) goto stopTest; /// Optionally supress pulses from the large water meter if (testParams.SupressTrills) diff --git a/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs b/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs index c4138b773..aca86821d 100644 --- a/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs @@ -541,7 +541,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection /// Make sure the CycleBeginForm is closed so that water meter data (s/n) can be copied into results - if (WaitBeginFormClosed()) goto stopTest; + if (UIFlowControl.Stop == WaitBeginFormClosed()) goto stopTest; /// Optionally supress pulses from the large water meter if (testParams.SupressTrills) diff --git a/TestBenchFramework/BenchControl/TestMethods/FixedStartCombinedMeters/FixedStartCombinedMetersSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FixedStartCombinedMeters/FixedStartCombinedMetersSeq.cs index b8d43ef74..8c4da5af9 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FixedStartCombinedMeters/FixedStartCombinedMetersSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FixedStartCombinedMeters/FixedStartCombinedMetersSeq.cs @@ -504,7 +504,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartCombinedMeters //------------------------------------------------ /// Make sure the CycleBeginForm is closed so that water meter data (s/n) can be copied into results - if (WaitBeginFormClosed()) goto stopTest; + if (UIFlowControl.Stop == WaitBeginFormClosed()) goto stopTest; /// /// Populate TestResult data entity with data diff --git a/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs index 4bd5d0057..4048d03ac 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs @@ -493,7 +493,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection //------------------------------------------------ /// Make sure the CycleBeginForm is closed so that water meter data (s/n) can be copied into results - if (WaitBeginFormClosed()) goto stopTest; + if (UIFlowControl.Stop == WaitBeginFormClosed()) goto stopTest; /// /// Populate TestResult data entity with data diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs index 4a3ad208c..6d2709fc1 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs @@ -209,7 +209,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart //------------------------------------------------ /// Make sure the CycleBeginForm is closed so that water meter data (s/n) can be copied into results - if (WaitBeginFormClosed()) goto stopTest; + if (UIFlowControl.Stop == WaitBeginFormClosed()) goto stopTest; /// /// Populate TestResult data entity with data diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/FlyingStartCollectionMethodSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/FlyingStartCollectionMethodSeq.cs index 639287a43..51e34cce9 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/FlyingStartCollectionMethodSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/FlyingStartCollectionMethodSeq.cs @@ -376,7 +376,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod //------------------------------------------------ /// Make sure the CycleBeginForm is closed so that water meter data (s/n) can be copied into results - if (WaitBeginFormClosed()) goto stopTest; + if (UIFlowControl.Stop == WaitBeginFormClosed()) goto stopTest; /// /// Populate TestResult data entity with data diff --git a/TestBenchFramework/BenchControl/TestMethods/LeakTest/LeakTestSeq.cs b/TestBenchFramework/BenchControl/TestMethods/LeakTest/LeakTestSeq.cs index 733a245a2..8f677c866 100644 --- a/TestBenchFramework/BenchControl/TestMethods/LeakTest/LeakTestSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/LeakTest/LeakTestSeq.cs @@ -253,7 +253,7 @@ namespace TBF.BenchControl.TestMethods.LeakTest //------------------------------------------------ /// Make sure the CycleBeginForm is closed so that water meter data (s/n) can be copied into results - if (WaitBeginFormClosed()) goto stopTest; + if (UIFlowControl.Stop == WaitBeginFormClosed()) goto stopTest; /// /// Populate TestResult data entity with data diff --git a/TestBenchFramework/BenchControl/TestMethods/PMaxTest/PMaxTestSeq.cs b/TestBenchFramework/BenchControl/TestMethods/PMaxTest/PMaxTestSeq.cs index 50bb5d05e..db5382ea5 100644 --- a/TestBenchFramework/BenchControl/TestMethods/PMaxTest/PMaxTestSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/PMaxTest/PMaxTestSeq.cs @@ -172,7 +172,7 @@ namespace TBF.BenchControl.TestMethods.PMaxTest //------------------------------------------------ /// Make sure the CycleBeginForm is closed so that water meter data (s/n) can be copied into results - if (WaitBeginFormClosed()) goto stopTest; + if (UIFlowControl.Stop == WaitBeginFormClosed()) goto stopTest; /// /// Populate TestResult data entity with data diff --git a/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/ReferenceFlowmeterCalibrationSeq.cs b/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/ReferenceFlowmeterCalibrationSeq.cs index 8f4dfcb9f..f2f93ad59 100644 --- a/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/ReferenceFlowmeterCalibrationSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/ReferenceFlowmeterCalibrationSeq.cs @@ -326,7 +326,7 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration //------------------------------------------------ /// Make sure the CycleBeginForm is closed so that water meter data (s/n) can be copied into results - if (WaitBeginFormClosed()) goto stopTest; + if (UIFlowControl.Stop == WaitBeginFormClosed()) goto stopTest; /// /// Populate TestResult data entity with data