diff --git a/TBF/BenchControl/DataEntry/StandardCamera/TestStartEndForm.cs b/TBF/BenchControl/DataEntry/StandardCamera/TestStartEndForm.cs index 59ce34d32..4f3559fab 100644 --- a/TBF/BenchControl/DataEntry/StandardCamera/TestStartEndForm.cs +++ b/TBF/BenchControl/DataEntry/StandardCamera/TestStartEndForm.cs @@ -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; } } } diff --git a/TBF/UI/Bench/Paths/PathsDlg.cs b/TBF/UI/Bench/Paths/PathsDlg.cs index e9242806c..cb75d8aa6 100644 --- a/TBF/UI/Bench/Paths/PathsDlg.cs +++ b/TBF/UI/Bench/Paths/PathsDlg.cs @@ -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(); + MessageBox.Show("Error occured when loading components"); + } /// Find all master valves Valves = BenchControl.GenericDevices.ValveBase.MasterValves(TbfComponents);