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

This commit is contained in:
Milan Hanajik 2020-10-23 10:47:48 +02:00
parent f1d46782d3
commit 483e2b4eb7
2 changed files with 40 additions and 8 deletions

View File

@ -297,7 +297,8 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
switch (mode)
{
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;
}
@ -309,8 +310,9 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
break;
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;
endTextBoxes[i].Enabled = false;
}
@ -324,8 +326,9 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
break;
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;
endTextBoxes[i].Enabled = false;
}
@ -561,8 +564,29 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
if (enabledTextBoxes[i] == currentFocusOwner)
{
/// Change focus to the next enabled text box
enabledTextBoxes[(i + 1) % enabledTextBoxes.Count].Focus();
return;
var currentTextBox = enabledTextBoxes[(i + 1) % enabledTextBoxes.Count];
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;
}
}
}

View File

@ -63,7 +63,15 @@ namespace TBF.UI.Bench.Paths
sharedButtons.DownClicked += downButton_Click;
/// 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
Valves = BenchControl.GenericDevices.ValveBase.MasterValves(TbfComponents);