iPerlCommunication simultaneously with purging fixed II., Invoke( ) in MainSeq.
This commit is contained in:
parent
558f000198
commit
264830a36b
@ -255,6 +255,7 @@ namespace TBF.BenchControl.Sequences
|
||||
simultWithPurgingCount = 0;
|
||||
simultWithPurgingCfg = null;
|
||||
simultWithPurgingParams = new List<Generic.ITestParams>();
|
||||
///
|
||||
foreach (var test in StateMachine.Tests)
|
||||
{
|
||||
Generic.IComponent testMethodComp = TbfComponents.FindComponent(test.Method);
|
||||
@ -276,19 +277,17 @@ namespace TBF.BenchControl.Sequences
|
||||
break;
|
||||
}
|
||||
|
||||
Generic.ITestParams tp = testMethodComp.Cfg.GetTestParams().Clone() as Generic.ITestParams;
|
||||
simultWithPurgingParams.Add(tp);
|
||||
|
||||
simultWithPurgingParams.Add(testMethodComp.Cfg.GetTestParams().Clone() as Generic.ITestParams);
|
||||
simultWithPurgingCount++;
|
||||
}
|
||||
|
||||
///
|
||||
if (simultWithPurgingCount > 0)
|
||||
{
|
||||
/// Make sure the entry form is closed
|
||||
if (UIFlowControl.Stop == WaitBeginFormClosed()) goto stop;
|
||||
|
||||
OpenIPerlCommForm(this, simultWithPurgingCfg, simultWithPurgingParams);
|
||||
}
|
||||
Program.MainWnd.Invoke(new iPerlCommFormDlgt(OpenIPerlCommForm), new object[] { this, simultWithPurgingCfg, simultWithPurgingParams });
|
||||
}
|
||||
|
||||
///
|
||||
/// Purging @ cycle start
|
||||
|
||||
@ -318,6 +318,8 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
}
|
||||
else DoOnAllCompleted(sender, args);
|
||||
};
|
||||
|
||||
StartForceCloseHandler();
|
||||
}
|
||||
|
||||
|
||||
@ -385,10 +387,6 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
iPerlCommunicationForm.multiTestParams.Add(testParams);
|
||||
|
||||
activityLabel.Text = testParams.Activity;
|
||||
|
||||
/// Start worker threads
|
||||
int wtId = 0;
|
||||
foreach (var wt in workerThreads) wt.Start(new Boxes.IntBox(wtId++));
|
||||
}
|
||||
|
||||
|
||||
@ -404,10 +402,6 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
iPerlCommunicationForm.multiTestParams = multiTestParams;
|
||||
|
||||
if (multiTestParams.Count > 0) activityLabel.Text = multiTestParams[0].Activity;
|
||||
|
||||
/// Start worker threads
|
||||
int wtId = 0;
|
||||
foreach (var wt in workerThreads) wt.Start(new Boxes.IntBox(wtId++));
|
||||
}
|
||||
|
||||
|
||||
@ -468,20 +462,29 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Set QuidoRS outputs and start the whole communication process
|
||||
/// by incrementing 'currentGroup'.
|
||||
///
|
||||
if (quido != null)
|
||||
{
|
||||
quido.SetOutputs((ushort)(16 - currentGroup - 1));
|
||||
Thread.Sleep(200);
|
||||
}
|
||||
currentGroup++;
|
||||
TBF.LocalSettings ls = Program.LocalSettings;
|
||||
Left = (ls.iPerlCommunicationsFormLeft != 0) ? ls.iPerlCommunicationsFormLeft : 150;
|
||||
Top = (ls.iPerlCommunicationsFormTop != 0) ? ls.iPerlCommunicationsFormTop : 150;
|
||||
|
||||
TBF.LocalSettings ls = Program.LocalSettings;
|
||||
Left = (ls.iPerlCommunicationsFormLeft != 0) ? ls.iPerlCommunicationsFormLeft : 150;
|
||||
Top = (ls.iPerlCommunicationsFormTop != 0) ? ls.iPerlCommunicationsFormTop : 150;
|
||||
///
|
||||
/// Start worker threads, etc.
|
||||
///
|
||||
if (workerThreads != null)
|
||||
{
|
||||
int wtId = 0;
|
||||
foreach (var wt in workerThreads) wt.Start(new Boxes.IntBox(wtId++));
|
||||
|
||||
///
|
||||
/// Set QuidoRS outputs and start the whole communication process
|
||||
/// by incrementing 'currentGroup'.
|
||||
///
|
||||
if (quido != null)
|
||||
{
|
||||
quido.SetOutputs((ushort)(16 - currentGroup - 1));
|
||||
Thread.Sleep(200);
|
||||
}
|
||||
currentGroup++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -550,7 +553,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
for (int group = 1; group <= lastGroup; group++)
|
||||
{
|
||||
/// Synchronize with QuidoRS and other threads
|
||||
while (((currentGroup != group) || (activityStep != currentActivityStep)) && !stopWorkerThreads)
|
||||
while (((group != currentGroup) || (activityStep != currentActivityStep)) && !stopWorkerThreads)
|
||||
{
|
||||
Thread.Sleep(50);
|
||||
}
|
||||
@ -585,8 +588,15 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
resultStr = "Invalid activity";
|
||||
}
|
||||
|
||||
if (error == CommErr.None) OnCommCompleted(null, new CommCompletedEventArgs(threadId, wmNr, resultStr));
|
||||
else if (wm.Disabled || error == CommErr.Disabled) OnCommCompleted(null, new CommCompletedEventArgs(threadId, wmNr, "Watermeter is disabled"));
|
||||
|
||||
if (error == CommErr.None)
|
||||
{
|
||||
OnCommCompleted(null, new CommCompletedEventArgs(threadId, wmNr, resultStr));
|
||||
}
|
||||
else if (wm.Disabled || error == CommErr.Disabled)
|
||||
{
|
||||
OnCommCompleted(null, new CommCompletedEventArgs(threadId, wmNr, "Watermeter is disabled"));
|
||||
}
|
||||
else
|
||||
{
|
||||
OnCommCompleted(null, new CommCompletedEventArgs(threadId, wmNr, string.Format("{0} failed ({1}) !!!", activity, error)));
|
||||
@ -1023,7 +1033,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
|
||||
void DoOnCommCompleted(object sender, CommCompletedEventArgs data)
|
||||
{
|
||||
if (data.WMNr >= 0) messages[data.WMNr].Text = data.CommMessage;
|
||||
if (data.WMNr >= 0) messages[data.WMNr].Text = data.CommMessage;
|
||||
|
||||
lock (this)
|
||||
{
|
||||
@ -1034,23 +1044,24 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
if (currentGroup < lastGroup)
|
||||
{
|
||||
/// Go to the next step / next group
|
||||
currentGroup++;
|
||||
if (quido != null)
|
||||
{
|
||||
quido.SetOutputs((ushort)(16 - currentGroup));
|
||||
quido.SetOutputs((ushort)(16 - currentGroup - 1));
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
}
|
||||
currentGroup++;
|
||||
}
|
||||
else if (currentActivityStep + 1 < multiTestParams.Count)
|
||||
{
|
||||
currentGroup = 0;
|
||||
currentActivityStep++;
|
||||
activityLabel.Text = multiTestParams[currentActivityStep].Activity;
|
||||
currentGroup = 1;
|
||||
if (quido != null)
|
||||
{
|
||||
quido.SetOutputs((ushort)(16 - currentGroup));
|
||||
quido.SetOutputs((ushort)(16 - currentGroup - 1));
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
currentGroup++;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user