Bug fixes: (1) in MainWnd when proc. added to empty DB, (2) in TestParamsCtrl when a test added and moved up, (3) other minor, (4) ItemNr of editted procedure displayed almost always, ver. 2.18.890

This commit is contained in:
Milan Hanajik
2018-05-02 15:52:53 +02:00
parent f332fd7141
commit 878c89591e
9 changed files with 49 additions and 34 deletions
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.18.887.0")] [assembly: AssemblyVersion("2.18.888.0")]
[assembly: AssemblyFileVersion("2.18.887.0")] [assembly: AssemblyFileVersion("2.18.888.0")]
@@ -12,7 +12,7 @@ namespace TBF.BenchControl.TestMethods.GrabImage
public class Component : ComponentBase, GenericDevices.ITestMethod public class Component : ComponentBase, GenericDevices.ITestMethod
{ {
private static readonly ILog log = LogManager.GetLogger(typeof(Component)); private static readonly ILog log = LogManager.GetLogger(typeof(Component));
public override string ToString() { return string.Format("TestMethods.LiveStream({0})", Cfg.ToString(1)); } public override string ToString() { return string.Format("TestMethods.GrabImage({0})", Cfg.ToString(1)); }
public bool CanTest(MetersKind meters) { return true; } public bool CanTest(MetersKind meters) { return true; }
public bool DoTransitions() { return false; } public bool DoTransitions() { return false; }
@@ -12,7 +12,7 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest
public class TestMethod : ComponentBase, GenericDevices.ITestMethod public class TestMethod : ComponentBase, GenericDevices.ITestMethod
{ {
private static readonly ILog log = LogManager.GetLogger(typeof(TestMethod)); private static readonly ILog log = LogManager.GetLogger(typeof(TestMethod));
public override string ToString() { return string.Format("TestMethods.CombinedWithDetection({0})", Cfg.ToString(1)); } public override string ToString() { return string.Format("TestMethods.SensitivityTest({0})", Cfg.ToString(1)); }
readonly TestMethodCfg testMethodCfg; readonly TestMethodCfg testMethodCfg;
@@ -15,8 +15,8 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
{ {
private static readonly ILog log = LogManager.GetLogger(typeof(TestMethod)); private static readonly ILog log = LogManager.GetLogger(typeof(TestMethod));
protected static readonly ILog rfidDataLogger = LogManager.GetLogger("RfidData"); protected static readonly ILog rfidDataLogger = LogManager.GetLogger("RfidData");
public override string ToString() { return string.Format("TestMethods.Adjustment({0})", Cfg.ToString(1)); } public override string ToString() { return string.Format("TestMethods.iPerlCommunication({0})", Cfg.ToString(1)); }
public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; } public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; }
public bool DoTransitions() { return false; } public bool DoTransitions() { return false; }
+7 -4
View File
@@ -1,5 +1,5 @@
/// ///
/// Copyright (c) 2013-2017 Sensus Metering Systems /// Copyright (c) 2013-2018 Sensus Metering Systems
/// ///
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -17,6 +17,8 @@ namespace TBF
{ {
static readonly ILog log = LogManager.GetLogger(typeof(MainWnd)); static readonly ILog log = LogManager.GetLogger(typeof(MainWnd));
const string ProcSeparator = " "; /// string separating procedure number and procedure name
public UiControls.BenchControlPanel BenchControlPanel; public UiControls.BenchControlPanel BenchControlPanel;
public string ProcedureName; public string ProcedureName;
public Procedure CurrentProcedure; public Procedure CurrentProcedure;
@@ -445,7 +447,8 @@ namespace TBF
/// </summary> /// </summary>
public void ReloadProcedures() public void ReloadProcedures()
{ {
ReloadProcedures(procedureComboBox.Text.Substring(procedureComboBox.Text.IndexOf(" ") + 2)); int separPos = procedureComboBox.Text.IndexOf(ProcSeparator);
ReloadProcedures((separPos >= 0) ? procedureComboBox.Text.Substring(separPos + ProcSeparator.Length) : string.Empty);
} }
public void ReloadProcedures(string procedureNameToSelect) public void ReloadProcedures(string procedureNameToSelect)
@@ -497,9 +500,9 @@ namespace TBF
private void procedureComboBox_SelectedIndexChanged(object sender, EventArgs e) private void procedureComboBox_SelectedIndexChanged(object sender, EventArgs e)
{ {
int ix = procedureComboBox.Text.IndexOf(" "); int ix = procedureComboBox.Text.IndexOf(ProcSeparator);
int procNr = int.Parse(procedureComboBox.Text.Substring(0, ix)); int procNr = int.Parse(procedureComboBox.Text.Substring(0, ix));
string procName = procedureComboBox.Text.Substring(ix + 2); string procName = procedureComboBox.Text.Substring(ix + ProcSeparator.Length);
UpdateProcedure(procNr, procName); UpdateProcedure(procNr, procName);
} }
+2 -2
View File
@@ -395,7 +395,7 @@ namespace TBF
void RefreshGeneralTab() void RefreshGeneralTab()
{ {
procNameTextBox.Text = LoadedProcedure.Name; procNameTextBox.Text = LoadedProcedure.Name;
Text = string.Format("{0} '{1}'", Strings.Procedure, LoadedProcedure.Name); Text = string.Format("{0} {1} {2}", Strings.Procedure, LoadedProcedure.ItemNr + 1, LoadedProcedure.Name);
descriptionTextBox.Text = LoadedProcedure.Description; descriptionTextBox.Text = LoadedProcedure.Description;
createdByTextBox.Text = LoadedProcedure.CreationUser; createdByTextBox.Text = LoadedProcedure.CreationUser;
@@ -455,7 +455,7 @@ namespace TBF
void UpdateFromGeneralTab() void UpdateFromGeneralTab()
{ {
LoadedProcedure.Name = procNameTextBox.Text; LoadedProcedure.Name = procNameTextBox.Text;
Text = string.Format("{0} '{1}'", Strings.Procedure, LoadedProcedure.Name); Text = string.Format("{0} {1} {2}", Strings.Procedure, LoadedProcedure.ItemNr + 1, LoadedProcedure.Name);
LoadedProcedure.Description = descriptionTextBox.Text; LoadedProcedure.Description = descriptionTextBox.Text;
LoadedProcedure.Watermeters = watermetersTextBox.Text; LoadedProcedure.Watermeters = watermetersTextBox.Text;
+2 -2
View File
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("2.18.887.0")] [assembly: AssemblyVersion("2.18.890.0")]
[assembly: AssemblyFileVersion("2.18.887.0")] [assembly: AssemblyFileVersion("2.18.890.0")]
+1 -1
View File
@@ -243,7 +243,7 @@ namespace TBF.UiControls
transaction.Commit(); transaction.Commit();
SelectedItems[0].Tag = modifiedProcedure; SelectedItems[0].Tag = modifiedProcedure;
MessageBox.Show(string.Format(Strings.Procedure_0_modified, modifiedProcedure.Name), MessageBox.Show(string.Format(Strings.Procedure_0_modified, string.Format(" {0} '{1}' ", modifiedProcedure.ItemNr + 1, modifiedProcedure.Name)),
Strings.Confirmation, Strings.Confirmation,
MessageBoxButtons.OK, MessageBoxButtons.OK,
MessageBoxIcon.Information); MessageBoxIcon.Information);
+31 -19
View File
@@ -63,25 +63,9 @@ namespace TBF.UiControls
public void Initialize() public void Initialize()
{ {
IParamsProvider sampleToCreateHeader = null; IParamsProvider sampleToCreateHeader;
/// For each test (with an appropriate method in case of ITestMethod-s) testParamsProviders = GetTestParamsProviders(parent.LoadedProcedure.Tests, out sampleToCreateHeader);
foreach (var test in parent.LoadedProcedure.Tests)
{
if ((cmpnt.Cfg.GetTestParams() != null) &&
(!(cmpnt is BenchControl.GenericDevices.ITestMethod) || (test.Method == cmpnt.Cfg.Name)))
{
/// Load ComponentTest entity or create it if it does not exist
IParamsProvider testParams = cmpnt.Cfg.CreateTestParams(test);
if (sampleToCreateHeader == null) sampleToCreateHeader = testParams;
testParamsProviders.Add(testParams);
}
else
{
/// In case of ITestMethod: Insert null for a test without an appropriate method.
testParamsProviders.Add(null);
}
}
/// Create the header /// Create the header
if (sampleToCreateHeader != null) if (sampleToCreateHeader != null)
@@ -106,6 +90,32 @@ namespace TBF.UiControls
RedrawAll(); RedrawAll();
} }
IList<IParamsProvider> GetTestParamsProviders(IList<Test> tests, out IParamsProvider sampleToCreateHeader)
{
IList<IParamsProvider> result = new List<IParamsProvider>();
sampleToCreateHeader = null;
/// For each test (with an appropriate method in case of ITestMethod-s)
foreach (var test in tests)
{
if ((cmpnt.Cfg.GetTestParams() != null) &&
(!(cmpnt is BenchControl.GenericDevices.ITestMethod) || (test.Method == cmpnt.Cfg.Name)))
{
/// Load ComponentTest entity or create it if it does not exist
IParamsProvider testParams = cmpnt.Cfg.CreateTestParams(test);
if (sampleToCreateHeader == null) sampleToCreateHeader = testParams;
result.Add(testParams);
}
else
{
/// In case of ITestMethod: Insert null for a test without an appropriate method.
result.Add(null);
}
}
return result;
}
private void listViewEx_SubItemClicked(object sender, Results.Forms.SubItemEventArgs e) private void listViewEx_SubItemClicked(object sender, Results.Forms.SubItemEventArgs e)
{ {
int itemNr = showTestsColumn ? (e.SubItem - 1) : e.SubItem; int itemNr = showTestsColumn ? (e.SubItem - 1) : e.SubItem;
@@ -160,7 +170,9 @@ namespace TBF.UiControls
public void RedrawAll() public void RedrawAll()
{ {
listViewEx.Items.Clear(); IParamsProvider dummy;
testParamsProviders = GetTestParamsProviders(parent.LoadedProcedure.Tests, out dummy);
listViewEx.Items.Clear();
for (int i = 0; i < testParamsProviders.Count && i < parent.LoadedProcedure.Tests.Count; i++) for (int i = 0; i < testParamsProviders.Count && i < parent.LoadedProcedure.Tests.Count; i++)
{ {
DrawOne(testParamsProviders[i], parent.LoadedProcedure.Tests[i].Name); DrawOne(testParamsProviders[i], parent.LoadedProcedure.Tests[i].Name);