(1) MainSeq allows showCycleEndFormOp==null now, (2) iPerlCommunicationForm edit mode fixes, ver. 3.1.1709

This commit is contained in:
Milan Hanajik
2021-07-20 10:10:25 +02:00
parent 84b48c4ecc
commit af551b07bf
3 changed files with 38 additions and 20 deletions
+17 -11
View File
@@ -1205,17 +1205,23 @@ namespace TBF.Rig.Sequences
GenericDevices.IDataEntry dataEntryCmpnt = TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IDataEntry;
if (dataEntryCmpnt is IHasCycleEndForm)
{
/// Open the modeless form for the end of the cycle
State.Create("MainSeq : Enter end data")
.AddOperation((dataEntryCmpnt as GenericDevices.IHasCycleEndForm).ShowCycleEndFormOp(TBF.Rig.Sequences.ProcessData.BatchRslts.Batch.WaterMeters))
.AddOperation(checkUiOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.UiCmdStop)) goto stop;
}
while (!e.Contains(Event.ModelessFormClosed));
IOperation showCycleEndFormOp =
(dataEntryCmpnt as GenericDevices.IHasCycleEndForm).ShowCycleEndFormOp(TBF.Rig.Sequences.ProcessData.BatchRslts.Batch.WaterMeters);
if (showCycleEndFormOp != null)
{
/// Open the modeless form for the end of the cycle
State.Create("MainSeq : Enter end data")
.AddOperation(showCycleEndFormOp)
.AddOperation(checkUiOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.UiCmdStop)) goto stop;
}
while (!e.Contains(Event.ModelessFormClosed));
}
}
///
@@ -588,16 +588,22 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
int nrLines = (wmsCount + lineSize - 1) / lineSize;
int gap = (textBoxesCount - wmsCount) / nrLines;
for (int i = 0; i < ckbIndex.Length; i++)
{
ckbIndex[i] = -1; /// Initialize with invalid indices
}
int dest = 0;
for (int l = 0; l < nrLines; l++)
{
for (int i = 0; i < lineSize; i++)
{
labels[dest] = labels[l * lineSize + l * gap + i];
counters[dest] = counters[l * lineSize + l * gap + i];
messages[dest] = messages[l * lineSize + l * gap + i];
checkBoxes[dest] = checkBoxes[l * lineSize + l * gap + i];
ckbIndex[l * lineSize + l * gap + i] = dest;
int origin = l * lineSize + l * gap + i;
labels[dest] = labels[origin];
counters[dest] = counters[origin];
messages[dest] = messages[origin];
checkBoxes[dest] = checkBoxes[origin];
ckbIndex[origin] = dest;
dest++;
}
}
@@ -2845,7 +2851,10 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
long result = 0;
for (int i = 0; i < 48; i++)
{
if (ckbState[ckbIndex[i]]) result += (1L << i);
if (ckbIndex[i] >= 0 && ckbState[ckbIndex[i]])
{
result += (1L << i);
}
}
return result;
}
@@ -2870,7 +2879,10 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
};
for (int i = 0; i < 48; i++)
{
chkBoxes[i].Checked = ckbState[ckbIndex[i]] = ((state & (1L << i)) != 0);
if (ckbIndex[i] >= 0)
{
chkBoxes[i].Checked = ckbState[ckbIndex[i]] = ((state & (1L << i)) != 0);
}
}
}