DataEntry.Camera (1) loads next image after 'Enter' key, (2) dealing with test parts fixed.

This commit is contained in:
Milan Hanajik
2020-11-06 14:33:31 +01:00
parent f1d46782d3
commit 483e2b4eb7
2 changed files with 40 additions and 8 deletions
@@ -297,7 +297,8 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
switch (mode) switch (mode)
{ {
case Tst.Start: case Tst.Start:
if (disabled != null && wmPos <= disabled.Length && disabled[wmPos - 1]) if ((disabled != null && wmPos <= disabled.Length && disabled[wmPos - 1]) ||
(regReaders != null && wmPos <= regReaders.Length && regReaders[wmPos - 1] == null))
{ {
startTextBoxes[i].Enabled = false; startTextBoxes[i].Enabled = false;
} }
@@ -309,8 +310,9 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
break; break;
case Tst.End: case Tst.End:
if (disabled != null && wmPos <= disabled.Length && disabled[wmPos - 1]) if ((disabled != null && wmPos <= disabled.Length && disabled[wmPos - 1]) ||
{ (regReaders != null && wmPos <= regReaders.Length && regReaders[wmPos - 1] == null))
{
startTextBoxes[i].Enabled = false; startTextBoxes[i].Enabled = false;
endTextBoxes[i].Enabled = false; endTextBoxes[i].Enabled = false;
} }
@@ -324,8 +326,9 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
break; break;
case Tst.Both: case Tst.Both:
if (disabled != null && wmPos <= disabled.Length && disabled[wmPos - 1]) if ((disabled != null && wmPos <= disabled.Length && disabled[wmPos - 1]) ||
{ (regReaders != null && wmPos <= regReaders.Length && regReaders[wmPos - 1] == null))
{
startTextBoxes[i].Enabled = false; startTextBoxes[i].Enabled = false;
endTextBoxes[i].Enabled = false; endTextBoxes[i].Enabled = false;
} }
@@ -561,8 +564,29 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
if (enabledTextBoxes[i] == currentFocusOwner) if (enabledTextBoxes[i] == currentFocusOwner)
{ {
/// Change focus to the next enabled text box /// Change focus to the next enabled text box
enabledTextBoxes[(i + 1) % enabledTextBoxes.Count].Focus(); var currentTextBox = enabledTextBoxes[(i + 1) % enabledTextBoxes.Count];
return; currentTextBox.Focus();
/// Load the respective image
for (int j = 0; j < startTextBoxes.Length; j++)
{
if (startTextBoxes[j] == currentTextBox)
{
LoadImage(Tst.Start, j);
return;
}
}
for (int j = 0; j < endTextBoxes.Length; j++)
{
if (endTextBoxes[j] == currentTextBox)
{
LoadImage(Tst.End, j);
return;
}
}
/// No image found
return;
} }
} }
} }
+9 -1
View File
@@ -63,7 +63,15 @@ namespace TBF.UI.Bench.Paths
sharedButtons.DownClicked += downButton_Click; sharedButtons.DownClicked += downButton_Click;
/// Load the list of components from the database /// Load the list of components from the database
TbfComponents = BenchControl.TbfComponents.LoadComponentsFromDB(Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config)); try
{
TbfComponents = BenchControl.TbfComponents.LoadComponentsFromDB(Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config));
}
catch
{
TbfComponents = new List<BenchControl.Generic.IComponent>();
MessageBox.Show("Error occured when loading components");
}
/// Find all master valves /// Find all master valves
Valves = BenchControl.GenericDevices.ValveBase.MasterValves(TbfComponents); Valves = BenchControl.GenericDevices.ValveBase.MasterValves(TbfComponents);