ComponentParametersDlg moved from TBF.BenchControl to TBF.UI.Bench.Components.

This commit is contained in:
Milan Hanajik 2021-08-29 12:21:33 +02:00
parent adfb9ae8d5
commit 64a5f7ceb8
49 changed files with 182 additions and 120 deletions

View File

@ -7,6 +7,7 @@ using System.Threading;
using System.Windows.Forms;
using TBF.BenchControl;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
using System.Xml.Serialization;
@ -383,7 +384,7 @@ namespace DeviceTest
/// <returns>true when factory changed</returns>
bool FactoryFromClassName(string className, ref IComponentFactory factory)
{
foreach (var fac in TbfComponents.Factories)
foreach (var fac in TbfComponents.Factories)
{
if (className == fac.ClassName)
{
@ -426,7 +427,7 @@ namespace DeviceTest
cfgControl.Config.ItemNr = 0;
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
cfgForm.TbfComponents = new List<Config.Entities.Component>();
cfgForm.CmpntEntities = new List<Config.Entities.Component>();
cfgForm.ComponentCfgCtrl = cfgControl;
cfgForm.UnlockAfterStart = true;
@ -458,7 +459,7 @@ namespace DeviceTest
///
IList<Config.Entities.Component> compEntities = new List<Config.Entities.Component>();
if (parentFactory != null && parentCfg != null) compEntities.Add(parentCfg.CreateDbEntity());
cfgForm.TbfComponents = compEntities;
cfgForm.CmpntEntities = compEntities;
cfgForm.ComponentCfgCtrl = cfgControl;
cfgForm.UnlockAfterStart = true;
@ -493,7 +494,7 @@ namespace DeviceTest
IList<Config.Entities.Component> compEntities = new List<Config.Entities.Component>();
if (parentFactory != null && parentCfg != null) compEntities.Add(parentCfg.CreateDbEntity());
if (component1Factory != null && component1Cfg != null) compEntities.Add(component1Cfg.CreateDbEntity());
cfgForm.TbfComponents = compEntities;
cfgForm.CmpntEntities = compEntities;
cfgForm.ComponentCfgCtrl = cfgControl;
cfgForm.UnlockAfterStart = true;
@ -529,7 +530,7 @@ namespace DeviceTest
if (parentFactory != null && parentCfg != null) compEntities.Add(parentCfg.CreateDbEntity());
if (component1Factory != null && component1Cfg != null) compEntities.Add(component1Cfg.CreateDbEntity());
if (component2Factory != null && component2Cfg != null) compEntities.Add(component2Cfg.CreateDbEntity());
cfgForm.TbfComponents = compEntities;
cfgForm.CmpntEntities = compEntities;
cfgForm.ComponentCfgCtrl = cfgControl;
cfgForm.UnlockAfterStart = true;

View File

@ -91,8 +91,8 @@ namespace ResultsBrowser.Forms
cfgControl.Config = printerCfg;
cfgControl.Config.ItemNr = 0;
TBF.BenchControl.ComponentParametersDlg cfgForm = new TBF.BenchControl.ComponentParametersDlg();
cfgForm.TbfComponents = new List<Component>();
TBF.UI.Bench.Components.ComponentParametersDlg cfgForm = new TBF.UI.Bench.Components.ComponentParametersDlg();
cfgForm.CmpntEntities = new List<Component>();
cfgForm.ComponentCfgCtrl = cfgControl;
cfgForm.UnlockAfterStart = true;

View File

@ -6,6 +6,7 @@ using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.Resources;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.DataEntry.S620
{
@ -38,9 +39,9 @@ namespace TBF.BenchControl.DataEntry.S620
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Output.DB.ProductionTracing.Factory)
{

View File

@ -5,7 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Dummy.FlowMeter
{

View File

@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Dummy.RegulValve
{

View File

@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Elde.CoverTest
{
@ -35,9 +36,9 @@ namespace TBF.BenchControl.Elde.CoverTest
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory)
{

View File

@ -6,6 +6,7 @@ using System.Windows.Forms;
using log4net;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Elde.Diverter
{
@ -38,9 +39,9 @@ namespace TBF.BenchControl.Elde.Diverter
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory)
{

View File

@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Elde.FixedStartRegisterReader
{
@ -35,9 +36,9 @@ namespace TBF.BenchControl.Elde.FixedStartRegisterReader
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory)
{

View File

@ -5,6 +5,7 @@ using System;
using Config.Entities;
using TBF.BenchControl.Configs;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Elde.FlowMeter
{
@ -36,9 +37,9 @@ namespace TBF.BenchControl.Elde.FlowMeter
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory)
{

View File

@ -5,6 +5,7 @@ using System;
using Config.Entities;
using TBF.BenchControl.Configs;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Elde.FlowMeterDewa
{
@ -40,9 +41,9 @@ namespace TBF.BenchControl.Elde.FlowMeterDewa
flowmeterComboBox2.Items.Add("---");
flowmeterComboBox3.Items.Add("---");
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory)
{

View File

@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Elde.FlowMeterTriplet
{
@ -35,9 +36,9 @@ namespace TBF.BenchControl.Elde.FlowMeterTriplet
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory)
{

View File

@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Elde.FlowMeterTwins
{
@ -35,9 +36,9 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
parentDlg = ParentForm as ComponentParametersDlg;
if (parentDlg == null) return;
if (parentDlg.TbfComponents != null)
if (parentDlg.CmpntEntities != null)
{
foreach (var cmpnt in parentDlg.TbfComponents)
foreach (var cmpnt in parentDlg.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory)
{

View File

@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Elde.PressureMeter
{
@ -35,9 +36,9 @@ namespace TBF.BenchControl.Elde.PressureMeter
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory)
{

View File

@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Elde.PressureMeterInternal
{
@ -35,9 +36,9 @@ namespace TBF.BenchControl.Elde.PressureMeterInternal
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory)
{

View File

@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Elde.Pump
{
@ -35,9 +36,9 @@ namespace TBF.BenchControl.Elde.Pump
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory)
{

View File

@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Elde.PumpTandem
{
@ -35,9 +36,9 @@ namespace TBF.BenchControl.Elde.PumpTandem
parentDlg = ParentForm as ComponentParametersDlg;
if (parentDlg == null) return;
if (parentDlg.TbfComponents != null)
if (parentDlg.CmpntEntities != null)
{
foreach (var cmpnt in parentDlg.TbfComponents)
foreach (var cmpnt in parentDlg.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.Pump.PumpFactory ||
TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.PumpWithFM.PumpFactory ||

View File

@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Elde.PumpWithFM
{
@ -35,9 +36,9 @@ namespace TBF.BenchControl.Elde.PumpWithFM
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory)
{

View File

@ -6,6 +6,7 @@ using System.Windows.Forms;
using log4net;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Elde.RegulValve
{
@ -38,9 +39,9 @@ namespace TBF.BenchControl.Elde.RegulValve
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory)
{

View File

@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Elde.RegulValveCoax
{
@ -35,9 +36,9 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory)
{

View File

@ -6,6 +6,7 @@ using System.Windows.Forms;
using log4net;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Elde.RegulValveMilwaukee
{
@ -38,9 +39,9 @@ namespace TBF.BenchControl.Elde.RegulValveMilwaukee
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory)
{

View File

@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Elde.RegulValveTandem
{
@ -35,9 +36,9 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.RegulValve.RegulValveFactory)
{

View File

@ -6,6 +6,7 @@ using System.IO;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Elde.TempMeter
{
@ -38,9 +39,9 @@ namespace TBF.BenchControl.Elde.TempMeter
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory)
{

View File

@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Elde.TempMeterInternal
{
@ -35,9 +36,9 @@ namespace TBF.BenchControl.Elde.TempMeterInternal
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory)
{

View File

@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Elde.Valve
{
@ -40,11 +41,11 @@ namespace TBF.BenchControl.Elde.Valve
categoryComboBox.Items.Add(ValveCategory.Output.ToString());
categoryComboBox.Items.Add(ValveCategory.None.ToString());
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
parentNameComboBox.Items.Add("---");
coupledToComboBox.Items.Add("---");
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory)
{

View File

@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Elde.ValveEx
{
@ -39,13 +40,13 @@ namespace TBF.BenchControl.Elde.ValveEx
logicalOpComboBox.Items.Add("AND");
logicalOpComboBox.Items.Add("OR");
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
AddValvePumpItemsToCombo(input1ComboBox, parent.TbfComponents);
AddValvePumpItemsToCombo(input2ComboBox, parent.TbfComponents);
AddValvePumpItemsToCombo(input3ComboBox, parent.TbfComponents);
AddValvePumpItemsToCombo(input4ComboBox, parent.TbfComponents);
AddValvePumpItemsToCombo(input5ComboBox, parent.TbfComponents);
AddValvePumpItemsToCombo(input1ComboBox, parent.CmpntEntities);
AddValvePumpItemsToCombo(input2ComboBox, parent.CmpntEntities);
AddValvePumpItemsToCombo(input3ComboBox, parent.CmpntEntities);
AddValvePumpItemsToCombo(input4ComboBox, parent.CmpntEntities);
AddValvePumpItemsToCombo(input5ComboBox, parent.CmpntEntities);
}
Redraw();

View File

@ -6,6 +6,7 @@ using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.Resources;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Keithley.TempMeter
{
@ -38,9 +39,9 @@ namespace TBF.BenchControl.Keithley.TempMeter
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Keithley.Multimeter_2010_RS232.Factory)
{

View File

@ -7,6 +7,7 @@ using System.Windows.Forms;
using System.IO.Ports;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.MettlerToledo.Multi
{
@ -97,10 +98,10 @@ namespace TBF.BenchControl.MettlerToledo.Multi
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
drainValveComboBox.Items.Add("---");
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.Valve.ValveFactory)
{

View File

@ -6,6 +6,7 @@ using System.Windows.Forms;
using System.IO.Ports;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.MettlerToledo.Standard
{
@ -103,11 +104,11 @@ namespace TBF.BenchControl.MettlerToledo.Standard
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
evaporationComboBox.Items.Add("---");
drainValveComboBox.Items.Add("---");
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.Valve.ValveFactory)
{

View File

@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Modbus.CometAmbient
{
@ -35,9 +36,9 @@ namespace TBF.BenchControl.Modbus.CometAmbient
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Modbus.Common.Factory)
{

View File

@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Modbus.Easytherm
{
@ -35,9 +36,9 @@ namespace TBF.BenchControl.Modbus.Easytherm
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Modbus.Common.Factory)
{

View File

@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Modbus.Novus
{
@ -35,9 +36,9 @@ namespace TBF.BenchControl.Modbus.Novus
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Modbus.Common.Factory)
{

View File

@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Modbus.PressureMeter.Meret
{
@ -35,9 +36,9 @@ namespace TBF.BenchControl.Modbus.PressureMeter.Meret
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Modbus.Common.Factory)
{

View File

@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Modbus.QuidoRS
{
@ -35,9 +36,9 @@ namespace TBF.BenchControl.Modbus.QuidoRS
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Modbus.Common.Factory)
{

View File

@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Modbus.TankSelector
{
@ -39,9 +40,9 @@ namespace TBF.BenchControl.Modbus.TankSelector
warmHeatingComboBox.Items.Add("---");
warmCoolingComboBox.Items.Add("---");
coldCoolingComboBox.Items.Add("---");
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Modbus.QuidoRS.Factory)
{

View File

@ -6,6 +6,7 @@ using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.Resources;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Network.Camera.CLP1611
{
@ -38,9 +39,9 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is TBF.BenchControl.Network.Adapter.Factory)
{

View File

@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Network.Camera.Display
{

View File

@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Network.Camera.Roi
{
@ -36,9 +37,9 @@ namespace TBF.BenchControl.Network.Camera.Roi
if (parent == null) return;
previousRoiComboBox.Items.Add("---");
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is TBF.BenchControl.Network.Camera.CLP1611.Factory)
{

View File

@ -7,6 +7,7 @@ using log4net;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.Resources;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Network.Camera.RoiForFixedStart
{
@ -39,9 +40,9 @@ namespace TBF.BenchControl.Network.Camera.RoiForFixedStart
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is TBF.BenchControl.Network.Camera.CLP1611.Factory)
{

View File

@ -4,6 +4,7 @@
using System;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Output.DB.SaveDiverterCorrections
{
@ -36,7 +37,7 @@ namespace TBF.BenchControl.Output.DB.SaveDiverterCorrections
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
diverter1ComboBox.Items.Add("---");
diverter2ComboBox.Items.Add("---");
@ -45,7 +46,7 @@ namespace TBF.BenchControl.Output.DB.SaveDiverterCorrections
diverter5ComboBox.Items.Add("---");
diverter6ComboBox.Items.Add("---");
///
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is TBF.BenchControl.Elde.Diverter.DiverterFactory)
{

View File

@ -4,6 +4,7 @@
using System;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Output.DB.SaveFlowmeterCorrections
{
@ -36,7 +37,7 @@ namespace TBF.BenchControl.Output.DB.SaveFlowmeterCorrections
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
flowmeter1ComboBox.Items.Add("---");
flowmeter2ComboBox.Items.Add("---");
@ -46,7 +47,7 @@ namespace TBF.BenchControl.Output.DB.SaveFlowmeterCorrections
flowmeter6ComboBox.Items.Add("---");
flowmeter7ComboBox.Items.Add("---");
///
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is TBF.BenchControl.Elde.FlowMeter.FlowMeterFactory)
{

View File

@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.RegisterReaders.KPackE.DataEntryForRadio
{
@ -37,9 +38,9 @@ namespace TBF.BenchControl.RegisterReaders.KPackE.DataEntryForRadio
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Radio.Factory)
{

View File

@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.RegisterReaders.KPackE.RegisterReader
{
@ -35,9 +36,9 @@ namespace TBF.BenchControl.RegisterReaders.KPackE.RegisterReader
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Radio.Factory)
{

View File

@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.RegisterReaders.PulsesFromEldeCB
{
@ -35,9 +36,9 @@ namespace TBF.BenchControl.RegisterReaders.PulsesFromEldeCB
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory)
{

View File

@ -6,6 +6,7 @@ using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.Resources;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Various.TankWithLevelMsrmnt
{
@ -37,13 +38,13 @@ namespace TBF.BenchControl.Various.TankWithLevelMsrmnt
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
drainValveComboBox.Items.Add("---");
drainValve2ComboBox.Items.Add("---");
levelMeasurementComboBox.Items.Add("---");
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
IComponentFactory cmpntFact = TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName);

View File

@ -163,12 +163,6 @@
<DependentUpon>AmbientCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="BenchControl\Ambient\Greco\Factory.cs" />
<Compile Include="BenchControl\ComponentParametersDlg.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="BenchControl\ComponentParametersDlg.designer.cs">
<DependentUpon>ComponentParametersDlg.cs</DependentUpon>
</Compile>
<Compile Include="BenchControl\Configs\ConfigCtrlUtils.cs">
<SubType>UserControl</SubType>
</Compile>
@ -2171,6 +2165,12 @@
<Compile Include="UiBridge\TestCompletedEventArgs.cs" />
<Compile Include="UiBridge\TestProgressEventArgs.cs" />
<Compile Include="UiBridge\TestSelectedEventArgs.cs" />
<Compile Include="UI\Bench\Components\ComponentParametersDlg.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\Bench\Components\ComponentParametersDlg.designer.cs">
<DependentUpon>ComponentParametersDlg.cs</DependentUpon>
</Compile>
<Compile Include="UI\Bench\Components\ComponentsManagerDlg.cs">
<SubType>Form</SubType>
</Compile>
@ -2704,9 +2704,6 @@
<EmbeddedResource Include="BenchControl\Ambient\Greco\AmbientCfgCtrl.resx">
<DependentUpon>AmbientCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="BenchControl\ComponentParametersDlg.resx">
<DependentUpon>ComponentParametersDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="BenchControl\Configs\NameOnly\TestMethodCfgCtrl.resx">
<DependentUpon>TestMethodCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
@ -3382,6 +3379,9 @@
<LastGenOutput>Strings.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="UI\Bench\Components\ComponentParametersDlg.resx">
<DependentUpon>ComponentParametersDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Bench\Components\ComponentsManagerDlg.resx">
<DependentUpon>ComponentsManagerDlg.cs</DependentUpon>
</EmbeddedResource>

View File

@ -1,7 +1,7 @@
///
/// Copyright (c) 2013-2015 Sensus Slovensko a.s.
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
///
namespace TBF.BenchControl
namespace TBF.UI.Bench.Components
{
partial class ComponentParametersDlg
{

View File

@ -1,16 +1,16 @@
///
/// Copyright (c) 2013-2015 Sensus Slovensko a.s.
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl;
using TBF.BenchControl.Generic;
using TBF.Resources;
using TBF.UI.Shared;
using Users.Entities;
namespace TBF.BenchControl
namespace TBF.UI.Bench.Components
{
public partial class ComponentParametersDlg : Form
{
@ -33,16 +33,23 @@ namespace TBF.BenchControl
/// <summary>
/// List of components (=component configuration instances)
/// </summary>
public IList<Config.Entities.Component> TbfComponents;
public IList<Config.Entities.Component> CmpntEntities;
public ComponentParametersDlg()
int cmpntEntityId;
/// <summary>
/// Create a window to edit component configuration
/// </summary>
/// <param name="cmpntEntityId">Config.Entities.Component.Id or 0 when this is a new/copied/immported component</param>
public ComponentParametersDlg(int cmpntEntityId = 0)
{
InitializeComponent();
this.cmpntEntityId = cmpntEntityId;
Flags = CfgUpdateFlags.None;
/// SharedDlgButtons configuration
sharedButtons.RequiredGroupMembership = new Users.Entities.GID[] { global::Users.Entities.GID.Metrologists };
sharedButtons.RequiredGroupMembership = new GID[] { GID.Metrologists };
sharedButtons.MoreButtonTop = ComponentCfgCtrlHeight - 45;
sharedButtons.OptionalButtons = SharedButtons.Buttons.None;
sharedButtons.Unlocked += Unlock;
@ -58,17 +65,17 @@ namespace TBF.BenchControl
if (ComponentCfgCtrl != null)
{
splitContainer.Panel1.Controls.Add((UserControl)ComponentCfgCtrl);
}
if ((ComponentCfgCtrl != null) && ComponentCfgCtrl.ShowMore)
{
sharedButtons.OptionalButtons = SharedButtons.Buttons.More;
}
if (ComponentCfgCtrl.ShowMore)
{
sharedButtons.OptionalButtons = SharedButtons.Buttons.More;
}
if (UnlockAfterStart)
{
sharedButtons.UnlockButtons();
ComponentCfgCtrl.Unlock();
if (UnlockAfterStart)
{
sharedButtons.UnlockButtons();
ComponentCfgCtrl.Unlock();
}
}
}
@ -101,6 +108,19 @@ namespace TBF.BenchControl
{
flags = ComponentCfgCtrl.UpdateCfg();
/// Prevent component name duplicity
if (CmpntEntities != null)
{
foreach (var cmpnt in CmpntEntities)
{
if (ComponentCfgCtrl.Config.Name == cmpnt.Name && cmpntEntityId != cmpnt.Id)
{
MessageBox.Show("Component with the same name already exists");
return;
}
}
}
if ((flags & CfgUpdateFlags.RestartRqrd) == CfgUpdateFlags.RestartRqrd)
{
MessageBox.Show(Strings.Program_restart_is_required_to_apply_some_settings,

View File

@ -419,7 +419,7 @@ namespace TBF.UI.Bench.Components
cfgControl.Config.ItemNr = (cmpntEntities.Count > 0) ? (cmpntEntities[cmpntEntities.Count - 1].ItemNr + 1) : 1;
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
cfgForm.TbfComponents = cmpntEntities;
cfgForm.CmpntEntities = cmpntEntities;
cfgForm.ComponentCfgCtrl = cfgControl;
cfgForm.UnlockAfterStart = true;
dialogRslt = cfgForm.ShowDialog();
@ -495,7 +495,7 @@ namespace TBF.UI.Bench.Components
if (cfg != null)
{
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
cfgForm.TbfComponents = cmpntEntities;
cfgForm.CmpntEntities = cmpntEntities;
cfgForm.ComponentCfgCtrl = cfg.GetControl();
cfgForm.ComponentCfgCtrl.Config = cfg;
DialogResult dr = cfgForm.ShowDialog();
@ -537,7 +537,7 @@ namespace TBF.UI.Bench.Components
cfgControl.Config.ItemNr = (cmpntEntities.Count > 0) ? (cmpntEntities[cmpntEntities.Count - 1].ItemNr + 1) : 1;
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
cfgForm.TbfComponents = cmpntEntities;
cfgForm.CmpntEntities = cmpntEntities;
cfgForm.ComponentCfgCtrl = cfgControl;
cfgForm.UnlockAfterStart = true;
if (cfgForm.ShowDialog() != DialogResult.OK) return;
@ -582,7 +582,7 @@ namespace TBF.UI.Bench.Components
cfgControl.Config.ItemNr = (cmpntEntities.Count > 0) ? (cmpntEntities[cmpntEntities.Count - 1].ItemNr + 1) : 1;
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
cfgForm.TbfComponents = cmpntEntities;
cfgForm.CmpntEntities = cmpntEntities;
cfgForm.ComponentCfgCtrl = cfgControl;
cfgForm.UnlockAfterStart = true;
if (cfgForm.ShowDialog() != DialogResult.OK) return;