Error message due to incorrect configuration is cleared after selecting another procedure/test.

Return value from WaitBeginFormClosed(..) changed from bool to enum UIFlowControl.
This commit is contained in:
Milan Hanajik
2015-06-25 04:48:28 +02:00
parent 01118ae924
commit 0cea24246c
13 changed files with 27 additions and 18 deletions
@@ -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,
}
/// <summary>
/// StateMachine events (issued by operations, IOperation derived classes)
/// </summary>
@@ -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))
{
@@ -633,12 +633,12 @@ namespace TBF.BenchControl.Sequences
/// This function is typically called at the end of the first test of the procedure.
/// </summary>
/// <returns>false = OK, true = stop pressed</returns>
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;
}
@@ -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
@@ -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)
@@ -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)
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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