Events.EndSession added, after S640Communication at the end 'End session' is invoked automatically.
This commit is contained in:
parent
4d018a8ba8
commit
af13e2f2b4
@ -76,6 +76,7 @@ namespace TBF.Rig
|
||||
Busy, /// Useful when waiting in state until at least one is busy (all are done)
|
||||
Done, /// Useful when waiting in state until the first is done, the rest miht still be busy
|
||||
MakeSecondPass, /// Test completed OK but 2nd pass (evaluation) is required
|
||||
EndSession, /// Test completed OK (similarly to Event.Done), 'End session' button click is automatically invoked
|
||||
///
|
||||
ModelessFormIsOpen,
|
||||
ModelessFormClosed,
|
||||
|
||||
@ -1011,6 +1011,12 @@ namespace TBF.Rig.Sequences
|
||||
log.InfoFormat("Test {0}: Transition({1}, {2}) returned {3}", testInst.Name, (transitionAfter == null ? "null" : transitionAfter.Name), endContext, rsltTransAfter);
|
||||
}
|
||||
}
|
||||
|
||||
if (currentTestIx == StateMachine.TestInstances.Length - simultWithEvacuationCount - 1 &&
|
||||
e.Contains(Event.EndSession))
|
||||
{
|
||||
goto save_results;
|
||||
}
|
||||
}
|
||||
|
||||
if (rsltTransBefore == Event.Error || rsltTransBetween == Event.Error|| e.Contains(Event.Error))
|
||||
@ -1218,6 +1224,7 @@ namespace TBF.Rig.Sequences
|
||||
}
|
||||
///------------------------------------------------------------------------------------------------------------
|
||||
|
||||
/// Cycle or test completed
|
||||
goto select_cycle_or_test;
|
||||
|
||||
|
||||
|
||||
@ -70,6 +70,9 @@ namespace TBF.Rig.TestMethods.S640Communication
|
||||
public bool Completed { get { return formCompleted; } }
|
||||
bool formCompleted;
|
||||
|
||||
public bool IsSealedOk { get { return isSealedOk; } }
|
||||
bool isSealedOk;
|
||||
|
||||
bool forcedClose; /// Set in the forced close handler
|
||||
|
||||
|
||||
@ -265,6 +268,8 @@ namespace TBF.Rig.TestMethods.S640Communication
|
||||
areValuesDisplayed = false;
|
||||
areNewSNsAndRadioAddressesAssigned = false;
|
||||
formCompleted = false;
|
||||
isSealedOk = false;
|
||||
|
||||
StartForceCloseHandler();
|
||||
}
|
||||
|
||||
@ -781,7 +786,7 @@ namespace TBF.Rig.TestMethods.S640Communication
|
||||
UpdateFirstTestResult(tests);
|
||||
UiBridge.Bridge.OnTestProgress(null, new TBF.UiBridge.TestProgressEventArgs(tests[currentActivityIx], Progress.Completed));
|
||||
step = Step.Idle;
|
||||
NormalClose();
|
||||
SealedOkClose();
|
||||
}
|
||||
else if (File.Exists(Path.Combine(fileExchangePath, ErrorFileName)))
|
||||
{
|
||||
@ -845,6 +850,7 @@ namespace TBF.Rig.TestMethods.S640Communication
|
||||
{
|
||||
UpdateFirstTestResult(tests);
|
||||
UiBridge.Bridge.OnTestProgress(null, new TBF.UiBridge.TestProgressEventArgs(tests[currentActivityIx], Progress.Completed));
|
||||
step = Step.Idle;
|
||||
NormalClose();
|
||||
}
|
||||
else if (step == Step.EnterSNs)
|
||||
@ -862,13 +868,15 @@ namespace TBF.Rig.TestMethods.S640Communication
|
||||
{
|
||||
UpdateFirstTestResult(tests);
|
||||
UiBridge.Bridge.OnTestProgress(null, new TBF.UiBridge.TestProgressEventArgs(tests[currentActivityIx], Progress.Completed));
|
||||
NormalClose();
|
||||
step = Step.Idle;
|
||||
SealedOkClose();
|
||||
}
|
||||
else
|
||||
else if (step != Step.Idle)
|
||||
{
|
||||
log.Error("User is closing this form, communication failed");
|
||||
UpdateFirstTestResult(tests, true);
|
||||
UiBridge.Bridge.OnTestProgress(null, new TBF.UiBridge.TestProgressEventArgs(tests[currentActivityIx], Progress.Aborted));
|
||||
step = Step.Idle;
|
||||
NormalClose();
|
||||
}
|
||||
}
|
||||
@ -1197,6 +1205,24 @@ namespace TBF.Rig.TestMethods.S640Communication
|
||||
Close();
|
||||
}
|
||||
|
||||
private void SealedOkClose()
|
||||
{
|
||||
if (Program.LocalSettings.S640CommFormLeft != Location.X ||
|
||||
Program.LocalSettings.S640CommFormTop != Location.Y)
|
||||
{
|
||||
/// Update local settings
|
||||
Program.LocalSettings.S640CommFormLeft = Location.X;
|
||||
Program.LocalSettings.S640CommFormTop = Location.Y;
|
||||
Program.LocalSettings.Save();
|
||||
}
|
||||
|
||||
isSealedOk = true;
|
||||
formCompleted = true;
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
||||
#region Forced close handling
|
||||
|
||||
public void StartForceCloseHandler()
|
||||
|
||||
@ -18,7 +18,7 @@ namespace TBF.Rig.TestMethods.S640Communication
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(S640CommSeq));
|
||||
|
||||
|
||||
System.Windows.Forms.Form modelessDlg;
|
||||
S640CommForm modelessDlg;
|
||||
///
|
||||
delegate void S640CommFormDlgt(S640CommSeq myRef, S640Activity activity, I640Cfg config, ProcParams procParams, Test test);
|
||||
///
|
||||
@ -64,6 +64,7 @@ namespace TBF.Rig.TestMethods.S640Communication
|
||||
|
||||
bool stopPressed = false; /// true when STOP button pressed
|
||||
bool completed = false;
|
||||
bool isSealedOK = false;
|
||||
|
||||
State.Create("iPerlCommunicationSeq : Wait until the entry form is closed")
|
||||
.AddOperation(checkUiOp)
|
||||
@ -71,8 +72,8 @@ namespace TBF.Rig.TestMethods.S640Communication
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
stopPressed = TestAndLogUiCmdStop(test,e);
|
||||
completed = (modelessDlg is GenericDevices.IHasCompleted)
|
||||
&& (modelessDlg as GenericDevices.IHasCompleted).Completed;
|
||||
completed = modelessDlg.Completed;
|
||||
isSealedOK = modelessDlg.IsSealedOk;
|
||||
}
|
||||
while (!stopPressed && !completed);
|
||||
|
||||
@ -89,7 +90,9 @@ namespace TBF.Rig.TestMethods.S640Communication
|
||||
/// Test 'Quit'
|
||||
modelessDlg = null; /// Modeless dialog is closed now
|
||||
|
||||
return new List<Event> { Event.Done };
|
||||
bool endSession = (activity == S640Activity.End) && (config is S640EndCfg) && (config as S640EndCfg).EndSessionWhenCompleted && isSealedOK;
|
||||
|
||||
return endSession ? new List<Event> { Event.EndSession } : new List<Event> { Event.Done };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,6 +34,7 @@ namespace TBF.Rig.TestMethods.S640Communication
|
||||
public SerialNumbers AssignedNumbers { get; set; } /// 4
|
||||
public bool SkipBadMeters { get; set; } /// 5
|
||||
public bool SimultWithEvacuation { get; set; } /// 6
|
||||
public bool EndSessionWhenCompleted { get; set; } /// 7
|
||||
|
||||
/// <summary> Procedure parameters </summary>
|
||||
[XmlIgnore]
|
||||
@ -67,6 +68,7 @@ namespace TBF.Rig.TestMethods.S640Communication
|
||||
AssignedNumbers = SerialNumbers.None;
|
||||
SkipBadMeters = false;
|
||||
SimultWithEvacuation = true;
|
||||
EndSessionWhenCompleted = false;
|
||||
}
|
||||
|
||||
string[] paramNames = new string[]
|
||||
@ -78,6 +80,7 @@ namespace TBF.Rig.TestMethods.S640Communication
|
||||
"Assigned S/N-s mode",
|
||||
"Skip bad meters when entering s/n",
|
||||
"Simultaneous with evacuation",
|
||||
"End session when completed OK",
|
||||
};
|
||||
public string ParamName(int i) { return paramNames[i]; }
|
||||
public int ParamsCount() { return paramNames.Length; }
|
||||
@ -94,6 +97,7 @@ namespace TBF.Rig.TestMethods.S640Communication
|
||||
SerialNumbers.FromProductionTracing.ToString() };
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
return new List<string> { Strings.yes, Strings.no };
|
||||
default:
|
||||
return null;
|
||||
@ -111,6 +115,7 @@ namespace TBF.Rig.TestMethods.S640Communication
|
||||
case 4: return AssignedNumbers.ToString();
|
||||
case 5: return SkipBadMeters ? Strings.yes : Strings.no;
|
||||
case 6: return SimultWithEvacuation ? Strings.yes : Strings.no;
|
||||
case 7: return EndSessionWhenCompleted ? Strings.yes : Strings.no;
|
||||
default:
|
||||
return string.Format("{0}: FileExchangePath = '{1}' FileExchangeTimeout = {2}s", Name, FileExchangePath, FileExchangeTimeout);
|
||||
}
|
||||
@ -151,6 +156,9 @@ namespace TBF.Rig.TestMethods.S640Communication
|
||||
case 6:
|
||||
SimultWithEvacuation = (strValue == Strings.yes);
|
||||
return CfgUpdateFlags.RestartRqrd;
|
||||
case 7:
|
||||
EndSessionWhenCompleted = (strValue == Strings.yes);
|
||||
return CfgUpdateFlags.RestartRqrd;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -175,6 +183,7 @@ namespace TBF.Rig.TestMethods.S640Communication
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
if (ParamValues(i).Contains(strValue)) return true;
|
||||
break;
|
||||
default:
|
||||
@ -195,6 +204,7 @@ namespace TBF.Rig.TestMethods.S640Communication
|
||||
prms.AssignedNumbers = this.AssignedNumbers;
|
||||
prms.SkipBadMeters = this.SkipBadMeters;
|
||||
prms.SimultWithEvacuation = this.SimultWithEvacuation;
|
||||
prms.EndSessionWhenCompleted = this.EndSessionWhenCompleted;
|
||||
}
|
||||
|
||||
public IParamsProvider Clone()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user