iPerlCommunicationForm.cs changes (sync. .with 2.26 branch)

This commit is contained in:
Milan Hanajik
2021-07-28 12:28:34 +02:00
parent a975b5d0f4
commit a8f42cbb63
4 changed files with 38 additions and 40 deletions
+9 -9
View File
@@ -2238,6 +2238,15 @@ namespace TBF.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Disabled by user.
/// </summary>
internal static string Head_was_disabled_by_the_user {
get {
return ResourceManager.GetString("Head_was_disabled_by_the_user", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Header. /// Looks up a localized string similar to Header.
/// </summary> /// </summary>
@@ -3390,15 +3399,6 @@ namespace TBF.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Disabled by user.
/// </summary>
internal static string Opto_head_was_disabled_by_the_user {
get {
return ResourceManager.GetString("Opto_head_was_disabled_by_the_user", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Other. /// Looks up a localized string similar to Other.
/// </summary> /// </summary>
+1 -1
View File
@@ -1723,7 +1723,7 @@
<data name="RFID_communication_failed" xml:space="preserve"> <data name="RFID_communication_failed" xml:space="preserve">
<value>RFID communication failed</value> <value>RFID communication failed</value>
</data> </data>
<data name="Opto_head_was_disabled_by_the_user" xml:space="preserve"> <data name="Head_was_disabled_by_the_user" xml:space="preserve">
<value>Disabled by user</value> <value>Disabled by user</value>
</data> </data>
<data name="failed_0_1_exclamation" xml:space="preserve"> <data name="failed_0_1_exclamation" xml:space="preserve">
@@ -290,7 +290,7 @@ namespace TBF.Rig.TestMethods.S640Communication
checkBoxes[i].Checked = false; checkBoxes[i].Checked = false;
checkBoxes[i].Enabled = false; checkBoxes[i].Enabled = false;
pictures[i].BackColor = DisabledColor; pictures[i].BackColor = DisabledColor;
messages[i].Text = Strings.Opto_head_was_disabled_by_the_user; messages[i].Text = Strings.Head_was_disabled_by_the_user;
} }
else else
{ {
@@ -387,7 +387,7 @@ namespace TBF.Rig.TestMethods.S640Communication
{ {
/// Opto head was disabled by the user /// Opto head was disabled by the user
pictures[i].BackColor = DisabledColor; pictures[i].BackColor = DisabledColor;
messages[i].Text = Strings.Opto_head_was_disabled_by_the_user; messages[i].Text = Strings.Head_was_disabled_by_the_user;
} }
else else
{ {
@@ -1,5 +1,5 @@
/// ///
/// Copyright (c) 2015-2020 Sensus Slovensko a.s. /// Copyright (c) 2015-2021 Sensus Slovensko a.s.
/// ///
//#define VERIFY_ACTIVE_MODE //#define VERIFY_ACTIVE_MODE
//#define VERIFY_Q2_CORR_RESET //#define VERIFY_Q2_CORR_RESET
@@ -494,7 +494,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
} }
WaterMetersCount = iperlHeads.Count; WaterMetersCount = iperlHeads.Count;
ShuffleTextBoxes(WaterMetersCount, Common.Data.LineSize); ShuffleTextBoxes(WaterMetersCount, ProcessData.LineSize);
/// ///
/// Prepare worker threads, 'rfidPortNrs', 'lastGroup', etc.. /// Prepare worker threads, 'rfidPortNrs', 'lastGroup', etc..
@@ -611,19 +611,10 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
textBoxesCount = wmsCount; textBoxesCount = wmsCount;
} }
if (checkBoxesEditMode) int count = checkBoxesEditMode ? textBoxesCount : Math.Min(textBoxesCount, iperlHeads.Count);
for (int j = 0; j < count; j++)
{ {
for (int j = 0; j < textBoxesCount; j++) labels[j].Text = string.Format("WM{0}", j + 1); labels[j].Text = (j + 1).ToString();
samplePictureBox1.Visible = false;
samplePictureBox2.Visible = false;
samplePictureBox3.Visible = false;
sampleLabel1.Visible = false;
sampleLabel2.Visible = false;
sampleLabel1.Visible = false;
}
else
{
for (int j = 0; j < Math.Min(textBoxesCount, iperlHeads.Count); j++) labels[j].Text = iperlHeads[j].Name;
} }
ResizeDlgToFitEnabledControls(); ResizeDlgToFitEnabledControls();
@@ -648,7 +639,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
void Localize() void Localize()
{ {
Text = Strings.Water_Meter_States; Text = checkBoxesEditMode ? Strings.Optical_heads : Strings.Water_Meter_States;
saveButton.Text = Strings.Save; saveButton.Text = Strings.Save;
sampleLabel1.Text = Strings.Direction_and_pulses_are_OK; sampleLabel1.Text = Strings.Direction_and_pulses_are_OK;
@@ -665,6 +656,17 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
{ {
Localize(); Localize();
if (checkBoxesEditMode)
{
/// Check box edit mode => Hide explanation of activity colours
sampleLabel1.Visible = false;
sampleLabel2.Visible = false;
sampleLabel3.Visible = false;
samplePictureBox1.Visible = false;
samplePictureBox2.Visible = false;
samplePictureBox3.Visible = false;
}
/// ///
/// Set checkbox states accroding to iPerlHeads[i].Disabled states /// Set checkbox states accroding to iPerlHeads[i].Disabled states
/// ///
@@ -677,7 +679,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// iPerl position i+1 is disabled /// iPerl position i+1 is disabled
checkBoxes[i].Enabled = checkBoxes[i].Checked = ckbState[i] = false; checkBoxes[i].Enabled = checkBoxes[i].Checked = ckbState[i] = false;
counters[i].BackColor = DisabledColor; counters[i].BackColor = DisabledColor;
messages[i].Text = Strings.Opto_head_was_disabled_by_the_user; messages[i].Text = Strings.Head_was_disabled_by_the_user;
} }
else else
{ {
@@ -904,7 +906,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// ///
if (error == CommErr.HeadDisabledByUser || !ckbState[wmNr0]) if (error == CommErr.HeadDisabledByUser || !ckbState[wmNr0])
{ {
OnCommCompleted(null, new CommCompletedEventArgs(threadID, wmNr0, ihead, wm, Strings.Opto_head_was_disabled_by_the_user, CommErr.HeadDisabledByUser)); OnCommCompleted(null, new CommCompletedEventArgs(threadID, wmNr0, ihead, wm, Strings.Head_was_disabled_by_the_user, CommErr.HeadDisabledByUser));
} }
else if (error == CommErr.None) else if (error == CommErr.None)
{ {
@@ -1892,10 +1894,10 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
{ {
if (ihead.CommFailed) return CommErr.CommFailed; if (ihead.CommFailed) return CommErr.CommFailed;
if (TBF.Rig.Sequences.ProcessData.IsQ2PreCorrectionCalculated) if (ProcessData.IsQ2PreCorrectionCalculated)
{ {
return WriteQ2Corrections(threadId, ihead, wm, ref resultStr, TBF.Rig.Sequences.ProcessData.CalculatedQ2PreCorrectionLR, return WriteQ2Corrections(threadId, ihead, wm, ref resultStr, ProcessData.CalculatedQ2PreCorrectionLR,
TBF.Rig.Sequences.ProcessData.CalculatedQ2PreCorrectionRL); ProcessData.CalculatedQ2PreCorrectionRL);
} }
else else
{ {
@@ -1979,10 +1981,10 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
if (wm.Pruefindex == 1) if (wm.Pruefindex == 1)
{ {
if (TBF.Rig.Sequences.ProcessData.IsQ2PreCorrectionCalculated) if (ProcessData.IsQ2PreCorrectionCalculated)
{ {
return WriteQ2Corrections(threadId, ihead, wm, ref resultStr, TBF.Rig.Sequences.ProcessData.CalculatedQ2PreCorrectionLR, return WriteQ2Corrections(threadId, ihead, wm, ref resultStr, ProcessData.CalculatedQ2PreCorrectionLR,
TBF.Rig.Sequences.ProcessData.CalculatedQ2PreCorrectionRL); ProcessData.CalculatedQ2PreCorrectionRL);
} }
else else
{ {
@@ -2185,9 +2187,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// ///
if ((q2CorrType == Q2CorrType.Update) || (q2CorrType == Q2CorrType.ConditionalUpdate)) if ((q2CorrType == Q2CorrType.Update) || (q2CorrType == Q2CorrType.ConditionalUpdate))
{ {
///
/// Update or ConditionalUpdate: 1. Calculate updates, not corrections, 2. Use error limits from this test /// Update or ConditionalUpdate: 1. Calculate updates, not corrections, 2. Use error limits from this test
///
double errLimitLo = test.ErrLimLo + test.Uncertainty; double errLimitLo = test.ErrLimLo + test.Uncertainty;
double errLimitHi = test.ErrLimHi - test.Uncertainty; double errLimitHi = test.ErrLimHi - test.Uncertainty;
@@ -2269,9 +2269,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
} }
else else
{ {
///
/// Regular Q2 corrections: 1. Use error limits from 'q2adjResult' /// Regular Q2 corrections: 1. Use error limits from 'q2adjResult'
///
double errLimitLo = q2adjTestData.ErrLimLo + q2adjTestData.ErrLimMargin; double errLimitLo = q2adjTestData.ErrLimLo + q2adjTestData.ErrLimMargin;
double errLimitHi = q2adjTestData.ErrLimHi - q2adjTestData.ErrLimMargin; double errLimitHi = q2adjTestData.ErrLimHi - q2adjTestData.ErrLimMargin;
@@ -2768,7 +2766,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
tstRslt.EndTime = endTime; tstRslt.EndTime = endTime;
tstRslt.FlowSetTime = 0; tstRslt.FlowSetTime = 0;
tstRslt.MassOfEvapWater = 0; tstRslt.MassOfEvapWater = 0;
tstRslt.TestTime += testTime; /// [s] total communication time of all tests tstRslt.TestTime += testTime; /// [s] total communication time of all tests
for (int i = 0; i < iperlHeads.Count; i++) for (int i = 0; i < iperlHeads.Count; i++)
{ {