ParamValues() retval IList->ICollection, GetControl() arg. is a list of components, ver. 3.1.1598

This commit is contained in:
Milan Hanajik
2021-03-02 01:10:04 +01:00
parent 8dc45484b0
commit c950cc231c
182 changed files with 606 additions and 628 deletions
@@ -1,7 +1,6 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
/// Copyright (c) 2020-2021 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using Config.Entities;
@@ -15,7 +14,10 @@ namespace TBF.BenchControl.Various.Drawing.Junction
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(Configuration) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new Configs.ParamsProvider.ComponentCfgCtrl(this, null); }
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities)
{
return new Configs.ParamsProvider.ComponentCfgCtrl(this, null);
}
///
/// Serialized parameters
@@ -41,44 +43,86 @@ namespace TBF.BenchControl.Various.Drawing.Junction
public Configuration(string name, IComponentFactory factory)
: this()
{
Shape = Shape.Junction;
Sz = Sz.None;
Name = name;
ParentName = string.Empty;
Factory = factory;
LblX = 25;
LblY = 22;
ParentName = string.Empty;
Shape = Shape.Junction;
InitializeAll();
}
public string ComponentName { get { return Name; } }
public void InitializeAll() { }
string[] paramNames = new string[0] { };
public void InitializeAll()
{
Sz = Sz.M;
LblX = 25;
LblY = 22;
}
string[] paramNames = new string[]
{
"Size",
};
public string ParamName(int i) { return paramNames[i]; }
public int ParamsCount() { return paramNames.Length; }
public IList<string> ParamValues(int i) { return null; }
public ICollection<string> ParamValues(int i)
{
switch (i)
{
case 0:
return new string[] { "None", "S", "M", "L", "XL" };
default:
return null;
}
}
public string ToString(int i)
{
return string.Format("name={0} x={1} y={2} sz={3} orient={4}", Name, X, Y, Sz, Orient);
switch (i)
{
case 0:
return Sz.ToString();
default:
return string.Format("name={0} x={1} y={2} sz={3} orient={4}", Name, X, Y, Sz, Orient);
}
}
public CfgUpdateFlags UpdateParam(int i, string strValue)
public CfgUpdateFlags UpdateParam(int i, string str)
{
return CfgUpdateFlags.None;
switch (i)
{
case 0:
Sz = (str == "S") ? Sz.S : (str == "M") ? Sz.M : (str == "L") ? Sz.L : (str == "XL") ? Sz.XL : Sz.None;
return CfgUpdateFlags.RestartRqrd;
default:
return CfgUpdateFlags.None;
}
}
public bool ValidateParam(int i, string strValue, out string message)
public bool ValidateParam(int i, string str, out string message)
{
message = "Invalid index";
message = string.Empty;
switch (i)
{
case 0:
if (ParamValues(0).Contains(str)) return true;
break;
default:
message = "Invalid index";
return false;
}
message = ParamName(i) + " is invalid";
return false;
}
void CopyContentTo(Configuration prms) { }
void CopyContentTo(Configuration prms)
{
prms.Sz = Sz;
}
public Config.Entities.IParamsProvider Clone()
{
@@ -1,7 +1,6 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using Config.Entities;
@@ -15,7 +14,10 @@ namespace TBF.BenchControl.Various.Drawing.Knee
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(Configuration) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new Configs.ParamsProvider.ComponentCfgCtrl(this, null); }
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities)
{
return new Configs.ParamsProvider.ComponentCfgCtrl(this, null);
}
///
/// Serialized parameters
@@ -60,7 +62,7 @@ namespace TBF.BenchControl.Various.Drawing.Knee
string[] paramNames = new string[0] { };
public string ParamName(int i) { return paramNames[i]; }
public int ParamsCount() { return paramNames.Length; }
public IList<string> ParamValues(int i) { return null; }
public ICollection<string> ParamValues(int i) { return null; }
public string ToString(int i)
{
@@ -1,7 +1,6 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using Config.Entities;
@@ -15,7 +14,10 @@ namespace TBF.BenchControl.Various.Drawing.Pipes
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(Configuration) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new Configs.ParamsProvider.ComponentCfgCtrl(this, null); }
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities)
{
return new Configs.ParamsProvider.ComponentCfgCtrl(this, null);
}
///
/// Serialized parameters
@@ -46,13 +48,11 @@ namespace TBF.BenchControl.Various.Drawing.Pipes
string[] paramNames = new string[] { "Size" };
public string ParamName(int i) { return paramNames[i]; }
public int ParamsCount() { return paramNames.Length; }
public IList<string> ParamValues(int i)
public ICollection<string> ParamValues(int i)
{
if (i == 0)
{
IList<string> values = new List<string>();
for (var size = Sz.S; size <= Sz.XL; size++) values.Add(size.ToString());
return values;
return new string[] { "S", "M", "L", "XL" }; ;
}
return null;
}
@@ -1,7 +1,6 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using Config.Entities;
@@ -15,7 +14,10 @@ namespace TBF.BenchControl.Various.Drawing.Tank
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(Configuration) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new Configs.ParamsProvider.ComponentCfgCtrl(this, null); }
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities)
{
return new Configs.ParamsProvider.ComponentCfgCtrl(this, null);
}
///
/// Serialized parameters
@@ -60,7 +62,7 @@ namespace TBF.BenchControl.Various.Drawing.Tank
string[] paramNames = new string[0] { };
public string ParamName(int i) { return paramNames[i]; }
public int ParamsCount() { return paramNames.Length; }
public IList<string> ParamValues(int i) { return null; }
public ICollection<string> ParamValues(int i) { return null; }
public string ToString(int i)
{
@@ -1,7 +1,6 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using Config.Entities;
@@ -15,7 +14,10 @@ namespace TBF.BenchControl.Various.Drawing.Vacuum
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(Configuration) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new Configs.ParamsProvider.ComponentCfgCtrl(this, null); }
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities)
{
return new Configs.ParamsProvider.ComponentCfgCtrl(this, null);
}
///
/// Serialized parameters
@@ -59,7 +61,7 @@ namespace TBF.BenchControl.Various.Drawing.Vacuum
string[] paramNames = new string[0] { };
public string ParamName(int i) { return paramNames[i]; }
public int ParamsCount() { return paramNames.Length; }
public IList<string> ParamValues(int i) { return null; }
public ICollection<string> ParamValues(int i) { return null; }
public string ToString(int i)
{
@@ -14,7 +14,7 @@ namespace TBF.BenchControl.Various.ErrorFlags
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ErrorsCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new Configs.ParamsProvider.ComponentCfgCtrl(this, null); }
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { return new Configs.ParamsProvider.ComponentCfgCtrl(this, null); }
///
/// Serialized parameters
@@ -61,25 +61,16 @@ namespace TBF.BenchControl.Various.ErrorFlags
};
public string ParamName(int i) { return paramNames[i]; }
public int ParamsCount() { return paramNames.Length; }
public IList<string> ParamValues(int i)
{
return null;
}
public ICollection<string> ParamValues(int i) { return null; }
public string ToString(int i)
{
if (i == -1)
{
return string.Format("{0}", Name);
}
switch (i)
{
case 0: return Q3Names;
case 1: return Q2Names;
case 2: return Q1Names;
default: return string.Empty;
default: return string.Format("{0}", Name);
}
}
@@ -18,7 +18,7 @@ namespace TBF.BenchControl.Various.StatisticsMonitoring
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(StatisticsCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new Configs.ParamsProvider.ComponentCfgCtrl(this, null); }
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { return new Configs.ParamsProvider.ComponentCfgCtrl(this, null); }
///
/// Serialized parameters
@@ -53,11 +53,7 @@ namespace TBF.BenchControl.Various.StatisticsMonitoring
};
public string ParamName(int i) { return paramNames[i]; }
public int ParamsCount() { return paramNames.Length; }
public IList<string> ParamValues(int i)
{
return null;
}
public ICollection<string> ParamValues(int i) { return null; }
public string ToString(int i)
{
@@ -2,7 +2,9 @@
/// Copyright (c) 2018 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using Config.Entities;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Various.TankWithLevelMsrmnt
@@ -12,7 +14,7 @@ namespace TBF.BenchControl.Various.TankWithLevelMsrmnt
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TankCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new TankCfgCtrl(); }
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { return new TankCfgCtrl(); }
///
/// Serialized parameters