Compare commits

..
Author SHA1 Message Date
Milan Hanajik b97af49738 Reconfigured for PUCHONG_200 2019-09-05 09:28:19 +02:00
299 changed files with 4378 additions and 4452 deletions
+2 -2
View File
@@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;IZRAEL_50</DefineConstants>
<DefineConstants>TRACE;DEBUG;PUCHONG_200</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
@@ -28,7 +28,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;IZRAEL_50</DefineConstants>
<DefineConstants>TRACE;PUCHONG_200</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
+2 -5
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
/// Copyright (c) 2013-2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
@@ -11,11 +11,8 @@ namespace Config.Entities
public virtual int Id { get; protected set; }
public virtual string UserName { get; set; } /// = name, alias, abbreviation
public virtual string FullName { get; set; } /// = description
public virtual string Tag { get; set; }
public virtual int Number { get; set; }
public virtual int Number { get; set; }
public virtual string Password { get; set; }
public virtual string Password2 { get; set; }
public virtual string Password3 { get; set; }
public virtual DateTime LastPwChange { get; set; }
public virtual IList<Group> Groups { get; set; } //User can be a member of a list of groups
+1 -4
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2016-2019 Sensus Slovensko a.s.
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using FluentNHibernate.Mapping;
@@ -12,9 +12,6 @@ namespace Config.Mappings
Id(x => x.Id);
Map(x => x.UserName).Column("Name");
Map(x => x.Number);
#if TURA_IPERL || TURA_IPERL_NEW || TURA_SPECIAL
Map(x => x.Tag);
#endif
Map(x => x.Password);
Map(x => x.FullName).Column("Description");
Map(x => x.LastPwChange);
+10 -9
View File
@@ -7,6 +7,7 @@ using System.Threading;
using System.Windows.Forms;
using TBF.BenchControl;
using TBF.BenchControl.Generic;
using TBF.BenchControl.GenericDevices;
using System.Xml.Serialization;
@@ -26,11 +27,11 @@ namespace DeviceTest
IComponentCfg component2Cfg;
IComponentCfg component3Cfg;
static IList<IDevice> tbfDevices;
static IList<IComponent> tbfComponents;
static IComponent tbfComponent1forOp;
static IComponent tbfComponent2forOp;
static IComponent tbfComponent3forOp;
static IList<TBF.BenchControl.Generic.IDevice> tbfDevices;
static IList<TBF.BenchControl.Generic.IComponent> tbfComponents;
static TBF.BenchControl.Generic.IComponent tbfComponent1forOp;
static TBF.BenchControl.Generic.IComponent tbfComponent2forOp;
static TBF.BenchControl.Generic.IComponent tbfComponent3forOp;
static Thread workerThread;
static bool workerThreadRunning;
@@ -425,7 +426,7 @@ namespace DeviceTest
cfgControl.Config = parentCfg;
cfgControl.Config.ItemNr = 0;
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
TBF.ComponentParametersDlg cfgForm = new TBF.ComponentParametersDlg();
cfgForm.TbfComponents = new List<Config.Entities.Component>();
cfgForm.ComponentCfgCtrl = cfgControl;
@@ -454,7 +455,7 @@ namespace DeviceTest
cfgControl.Config = component1Cfg;
cfgControl.Config.ItemNr = 1;
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
TBF.ComponentParametersDlg cfgForm = new TBF.ComponentParametersDlg();
///
IList<Config.Entities.Component> compEntities = new List<Config.Entities.Component>();
if (parentFactory != null && parentCfg != null) compEntities.Add(parentCfg.CreateDbEntity());
@@ -488,7 +489,7 @@ namespace DeviceTest
cfgControl.Config = component2Cfg;
cfgControl.Config.ItemNr = 1;
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
TBF.ComponentParametersDlg cfgForm = new TBF.ComponentParametersDlg();
///
IList<Config.Entities.Component> compEntities = new List<Config.Entities.Component>();
if (parentFactory != null && parentCfg != null) compEntities.Add(parentCfg.CreateDbEntity());
@@ -523,7 +524,7 @@ namespace DeviceTest
cfgControl.Config = component3Cfg;
cfgControl.Config.ItemNr = 1;
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
TBF.ComponentParametersDlg cfgForm = new TBF.ComponentParametersDlg();
///
IList<Config.Entities.Component> compEntities = new List<Config.Entities.Component>();
if (parentFactory != null && parentCfg != null) compEntities.Add(parentCfg.CreateDbEntity());
+1 -1
View File
@@ -26,7 +26,7 @@ namespace Results.Forms
if (refRecords == null)
{
tabControl1.SelectTab(1);
tabControl1.TabPages.RemoveAt(2);
tabControl1.TabPages[2].Hide();
}
else
{
+12 -45
View File
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms.DataVisualization.Charting;
using Config.Entities;
using Results.Entities;
@@ -13,25 +14,17 @@ namespace Results.Output
{
public static Chart GetChart(WaterMeter wm, bool isPrinter)
{
return GetChart(wm, isPrinter, Config.Unit.lph);
return GetChart(wm, isPrinter, Config.Unit.lph, false);
}
public static Chart GetChart(WaterMeter wm, bool isPrinter, Config.Unit flowUnit)
public static Chart GetChart(WaterMeter wm, bool isPrinter, Config.Unit flowUnit, bool isQ4)
{
double maxFlow_m3h = 0;
IList<PointF> unsortedPoints = new List<PointF>();
foreach (var mtr in wm.MeterTestRslts)
{
if (mtr.IsPilotRslt() && mtr.TestRslt.TestData.Evaluate && (mtr.TestRslt.TestTime > 0) && (mtr.TestRslt.PulsesMaster > 0))
if (mtr.IsPilotRslt() && mtr.TestRslt.TestData.Evaluate && (mtr.TestTime > 0) && (mtr.TestRslt.PulsesMaster > 0))
{
double flow_m3h = (mtr.TestTime != 0)
? (3.6 * mtr.TestRslt.VolumeCTV / mtr.TestTime * mtr.PulsesMaster / mtr.TestRslt.PulsesMaster)
: (3.6 * mtr.TestRslt.VolumeCTV / mtr.TestRslt.TestTime);
if (flow_m3h > maxFlow_m3h) maxFlow_m3h = flow_m3h;
double flow = Config.Units.ConvertTo(flowUnit, flow_m3h); /// Convert to specified units
double flow = Config.Units.ConvertTo(flowUnit, mtr.TestRslt.VolumeCTV / mtr.TestTime * 3.6 * mtr.PulsesMaster / mtr.TestRslt.PulsesMaster);
if (flow > 0)
{
unsortedPoints.Add(new PointF((float)flow, (float)mtr.Error));
@@ -40,8 +33,6 @@ namespace Results.Output
}
IEnumerable<PointF> sortedPoints = unsortedPoints.OrderBy(x => x.X);
bool isQ4 = (maxFlow_m3h > 1.1 * wm.WaterMeterData.Q3_Qn);
Chart chart = new Chart
{
Name = "chart",
@@ -56,7 +47,7 @@ namespace Results.Output
chArea.AxisX.Title = Strings.Flow;
chArea.AxisX.IsLogarithmic = true;
chArea.AxisX.LogarithmBase = 10;
chArea.AxisX.IsLabelAutoFit = true;
chArea.AxisX.IsLabelAutoFit = false;
List<double> xs = new List<double>() { 0.0001, 0.0002, 0.0005,
0.001, 0.002, 0.005,
@@ -68,43 +59,19 @@ namespace Results.Output
1000, 2000, 5000,
10000, 20000, 50000,
100000, 200000, 500000,
1000000, 2000000, 5000000,
10000000 };
1000000, 2000000, 5000000 };
double spacer = 0.8;
double from = Config.Units.ConvertTo(flowUnit, wm.WaterMeterData.Q1_Qmin);
double to = Config.Units.ConvertTo(flowUnit, isQ4 ? wm.WaterMeterData.Q4_Qmax : wm.WaterMeterData.Q3_Qn);
bool inRange = false;
for (int i = 0; i < xs.Count - 3; i += 3)
for (int i = 1; i < xs.Count - 1; i++)
{
if (xs[i] <= from && from < xs[i + 3])
if ((xs[i + 1] > from) && (xs[i - 1] < to))
{
chArea.AxisX.Minimum = xs[i];
inRange = true;
}
if (inRange)
{
for (int j = i; j < i + 3; j++)
{
CustomLabel cl = new CustomLabel();
cl.Text = string.Format("{0} {1}", xs[j], flowUnit.ToDescription());
cl.FromPosition = Math.Log10(xs[j] * spacer);
cl.ToPosition = Math.Log10(xs[j] / spacer);
chArea.AxisX.CustomLabels.Add(cl);
}
}
if (xs[i] < to && to <= xs[i + 3])
{
chArea.AxisX.Maximum = xs[i + 3];
CustomLabel cl = new CustomLabel();
cl.Text = string.Format("{0} {1}", xs[i + 3], flowUnit.ToDescription());
cl.FromPosition = Math.Log10(xs[i + 3] * spacer);
cl.ToPosition = Math.Log10(xs[i + 3] / spacer);
cl.Text = string.Format("{0} {1}", xs[i], flowUnit.ToDescription());
cl.FromPosition = Math.Log10(xs[i] * spacer);
cl.ToPosition = Math.Log10(xs[i] / spacer);
chArea.AxisX.CustomLabels.Add(cl);
break;
}
}
+2 -2
View File
@@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;IZRAEL_50</DefineConstants>
<DefineConstants>TRACE;DEBUG;PUCHONG_200</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
@@ -27,7 +27,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;IZRAEL_50</DefineConstants>
<DefineConstants>TRACE;PUCHONG_200</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
@@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using ResultsBrowser.Resources;
using TBF.BenchControl;
namespace ResultsBrowser.Forms
{
+1 -1
View File
@@ -91,7 +91,7 @@ namespace ResultsBrowser.Forms
cfgControl.Config = printerCfg;
cfgControl.Config.ItemNr = 0;
TBF.BenchControl.ComponentParametersDlg cfgForm = new TBF.BenchControl.ComponentParametersDlg();
TBF.ComponentParametersDlg cfgForm = new TBF.ComponentParametersDlg();
cfgForm.TbfComponents = new List<Component>();
cfgForm.ComponentCfgCtrl = cfgControl;
+2 -2
View File
@@ -21,7 +21,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;IZRAEL_50</DefineConstants>
<DefineConstants>TRACE;DEBUG;PUCHONG_200</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
@@ -31,7 +31,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;IZRAEL_50</DefineConstants>
<DefineConstants>TRACE;PUCHONG_200</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
+176
View File
@@ -0,0 +1,176 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
namespace TBF
{
/// <summary>
/// Data types and orientation of the table layout panel attached data.
/// </summary>
public enum Arrangement
{
RowOfIntegers,
RowOfDoubles,
RowOfStrings,
ColumnOfIntegers,
ColumnOfDoubles,
ColumnOfStrings,
}
/// <summary>
/// This class represents TextBox controls and data modified by them
/// that are attached to (=displayed inside) a TableLayoutPanel control.
/// </summary>
public class AttachedTextBoxes
{
///
/// Private fields
///
int count; /// Number of attached TextBoxes / cells
Arrangement arngmnt; /// Type of attachemnt (see above)
bool isRow; /// true if it is a row
TextBox[] textBoxes; /// TextBox controls to be aded to TableLayoutPanel
int[] intData; /// integer data |
double[] doubleData; /// double data |-> one of these three arrays is used
string[] stringData; /// string data |
/// <summary>
/// Constructor, which creates TextBox controls and adds them to the table layout panel.
/// </summary>
public AttachedTextBoxes(TableLayoutPanel tblLtPnl, Arrangement arngmnt, int firstColumn, int firstRow, int size)
{
this.count = size;
this.arngmnt = arngmnt;
isRow = (arngmnt == Arrangement.RowOfIntegers || arngmnt == Arrangement.RowOfDoubles || arngmnt == Arrangement.RowOfStrings);
textBoxes = new TextBox[count];
intData = new int[count];
doubleData = new double[count];
stringData = new string[count];
for (int i = 0; i < count; i++)
{
textBoxes[i] = new TextBox(); /// Crete a new TextBox control
if (isRow)
{
tblLtPnl.Controls.Add(textBoxes[i], firstColumn + i, firstRow);
}
else
{
tblLtPnl.Controls.Add(textBoxes[i], firstColumn, firstRow + i);
}
}
}
/// <summary>
/// Attached data array size
/// </summary>
public int Count { get { return count; } }
/// <summary>
/// Indexer returning a TextBox
/// </summary>
/// <param name="index">Index</param>
/// <returns>TextBox object reference</returns>
public TextBox this[int index]
{
get
{
if (index < 0 || index >= count)
{
return null;
}
else
{
return textBoxes[index];
}
}
}
/// <summary>
/// Retrieves data from the controls or detects a format error.
/// Wrong format in a cell interrupts data retrieving, so when the first control
/// contains data with wrong format, no data are retrieved at all.
/// </summary>
/// <returns>true if all data have correct format</returns>
public bool ValidateData()
{
switch (arngmnt)
{
case Arrangement.RowOfIntegers:
case Arrangement.ColumnOfIntegers:
for (int i = 0; i < count; i++)
{
if (!Int32.TryParse(textBoxes[i].Text, out intData[i])) return false;
}
return true;
case Arrangement.RowOfDoubles:
case Arrangement.ColumnOfDoubles:
for (int i = 0; i < count; i++)
{
if (!Double.TryParse(textBoxes[i].Text, out doubleData[i])) return false;
}
return true;
case Arrangement.RowOfStrings:
case Arrangement.ColumnOfStrings:
default:
return true;
}
}
/// <summary>
/// The following three methods provide initialization of controls with original data.
/// </summary>
public void SetData(int index, int value)
{
if (index < 0 || index >= count) return;
intData[index] = value;
textBoxes[index].Text = value.ToString();
}
public void SetData(int index, double value)
{
if (index < 0 || index >= count) return;
doubleData[index] = value;
textBoxes[index].Text = value.ToString();
}
public void SetData(int index, string value)
{
if (index < 0 || index >= count) return;
stringData[index] = value;
textBoxes[index].Text = value;
}
/// <summary>
/// The following three methods provide retrieving data from controls.
/// ValidateData() must be called first. The return value must be true.
/// </summary>
public int GetIntData(int index)
{
if (index < 0 || index >= count) return 0;
return intData[index];
}
public double GetDoubleData(int index)
{
if (index < 0 || index >= count) return 0;
return doubleData[index];
}
public string GetStringData(int index)
{
if (index < 0 || index >= count) return null;
return textBoxes[index].Text;
}
}
}
+75
View File
@@ -0,0 +1,75 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
using System.Drawing;
using System.Windows.Forms;
namespace TBF
{
public class BarGraph
{
int originX; /// Left coordinate of the bar
int originY; /// Top coordinate of the bar
int barWidth; /// Bar width, the bar is actualy 1 pixel wider
int barHeight; /// Bar height the bat is actualy 1 pixel higher
Color barColor; /// Bar color
Color backColor; /// Background color (above the bar)
/// Bar border is always black, 1 pixel wide
int barValue; /// The actual bar size (the bar is drawn from bottom)
System.Windows.Forms.Control control;
Rectangle rect;
/// Use this setter to update the bar size
public float FValue
{
get { return (float)barValue/(float)barHeight; }
set
{
Value = (int)(value * (float)barHeight);
control.Invalidate();
}
}
/// Use this setter to update the bar size
public int Value
{
get { return barValue; }
set
{
if (value < 0) barValue = 0;
else if (value >= barHeight) barValue = barHeight;
else barValue = value;
control.Invalidate();
}
}
/// <summary>
/// Constructor
/// </summary>
public BarGraph(System.Windows.Forms.Control control, int originX, int originY, int barWidth, int barHeight, Color barColor, Color backColor)
{
this.control = control;
this.originX = originX;
this.originY = originY;
this.barWidth = barWidth;
this.barHeight = barHeight;
this.barColor = barColor;
this.backColor = backColor;
rect = new Rectangle(originX, originY, barWidth + 1, barHeight + 1);
barValue = 0;
}
/// <summary>
/// Call this function in Form1_Paint(..), pass the arguments without any modifications
/// </summary>
public void Paint(Graphics g)
{
g.FillRectangle(new SolidBrush(backColor), originX + 1, originY + 1, barWidth, barHeight - barValue);
g.FillRectangle(new SolidBrush(barColor), originX + 1, originY + barHeight + 1 - barValue, barWidth, barValue);
g.DrawRectangle(new Pen(Color.Black, 2.0F), originX, originY, barWidth + 1, barHeight + 1);
}
}
}
@@ -1,38 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using Users;
using log4net;
namespace TBF.BenchControl.BackupAndSecurity.Default
{
/// <summary>
/// Holds backup and security options.
/// </summary>
public class Component : ComponentBase, GenericDevices.IBackupAndSecurity
{
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
public override string ToString() { return string.Format("BackupAndSecurity.Default({0})", Cfg.ToString(1)); }
readonly ComponentCfg myCfg;
public int MinPasswdLength { get { return myCfg.MinPasswdLength; } }
public int PasswdExpirationPeriodDays { get { return myCfg.PasswdExpirationPeriodDays; } }
public Component()
{
}
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
myCfg = cfg as ComponentCfg;
GlobalData.MinPasswdLength = myCfg.MinPasswdLength;
GlobalData.PasswdExpirationPeriodDays = myCfg.PasswdExpirationPeriodDays;
log.Debug(this.ToString());
}
}
}
@@ -1,125 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using Config.Entities;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.BackupAndSecurity.Default
{
/// <summary>
/// Holds backup and security options - serializable configuration.
/// </summary>
public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ComponentCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new Configs.ParamsProvider.ComponentCfgCtrl(this, null); }
///
/// Serialized parameters
///
public int MinPasswdLength;
public int PasswdExpirationPeriodDays; /// 0 = validity is not limited
/// Private parameterless constructor invoked by all other (public) constructors
ComponentCfg() {}
public ComponentCfg(IComponentFactory factory)
: this()
{
Factory = factory;
Name = "BackupAndSecurity";
ParentName = string.Empty;
InitializeAll();
}
public string ComponentName { get { return Name; } }
public void InitializeAll()
{
MinPasswdLength = 6;
PasswdExpirationPeriodDays = 0;
}
string[] paramNames = new string[]
{
"Minimum password length (characters)",
"Password expiration period (days)",
};
public string ParamName(int i) { return paramNames[i]; }
public int ParamsCount() { return paramNames.Length; }
public IList<string> ParamValues(int i)
{
return null;
}
public string ToString(int i)
{
if (i == -1)
{
return string.Format("{0}: Min. password length = {1} characters, Password expiration period = {2} days", Name, MinPasswdLength, PasswdExpirationPeriodDays);
}
switch (i)
{
case 0: return MinPasswdLength.ToString();
case 1: return PasswdExpirationPeriodDays.ToString();;
default: return string.Empty;
}
}
public CfgUpdateFlags UpdateParam(int i, string strValue)
{
switch (i)
{
case 0: MinPasswdLength = int.Parse(strValue); return CfgUpdateFlags.RestartRqrd;
case 1: PasswdExpirationPeriodDays = int.Parse(strValue); return CfgUpdateFlags.RestartRqrd;
default: return CfgUpdateFlags.None;
}
}
public bool ValidateParam(int i, string strValue, out string message)
{
message = string.Empty;
int idummy;
switch (i)
{
case 0:
case 1:
/// Positive integers and zero are allowed
if (int.TryParse(strValue, out idummy) && (idummy >= 0)) return true;
break;
default:
message = "Invalid index";
return false;
}
message = ParamName(i) + " is invalid";
return false;
}
void CopyContentTo(ComponentCfg prms)
{
prms.MinPasswdLength = this.MinPasswdLength;
prms.PasswdExpirationPeriodDays = this.PasswdExpirationPeriodDays;
}
public Config.Entities.IParamsProvider Clone()
{
ComponentCfg pars = new ComponentCfg();
CopyContentTo(pars);
return pars;
}
public bool UpdateEmbeddedDbEntity()
{
return true; /// =OK, do nothing
}
}
}
@@ -1,26 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System.Collections.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.BackupAndSecurity.Default
{
public class ComponentFactory : IComponentFactory
{
public string ClassName { get { return this.GetType().Namespace.Substring(17); } }
public void ResetStaticProperties() { Component.ResetStaticProperties(); }
public IComponent DummyComponent() { return new Component(); }
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Component(cfg); }
public IComponentCfg DefaultConfig() { return new ComponentCfg(this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(ComponentCfg.Serializer, component, this);
}
}
}
@@ -134,7 +134,7 @@ namespace TBF.BenchControl.DataEntry.Standard6
private void batchRemarkButton_Click(object sender, EventArgs e)
{
TBF.UI.Shared.RemarkDlg dlg = new TBF.UI.Shared.RemarkDlg() { Remark = ((BatchRemark == null) ? string.Empty : BatchRemark) };
TBF.Forms.RemarkDlg dlg = new TBF.Forms.RemarkDlg() { Remark = ((BatchRemark == null) ? string.Empty : BatchRemark) };
if (dlg.ShowDialog() == DialogResult.OK)
{
BatchRemark = dlg.Remark;
+4 -4
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2016-2017 Sensus Slovensko a.s.
/// Copyright (c) 2016-2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
@@ -40,19 +40,19 @@ namespace TBF.BenchControl.Dummy.Balance
public float BuoyancyPress { get { return 1.013f; } }
public float BuoyancyHumi { get { return 50.0f; } }
public IOperation TaringOp(ref Boxes.DoubleBox tara)
public IOperation TaringOp(ref TBF.Boxes.DoubleBox tara)
{
tara.Val = 0;
return this;
}
public IOperation ReadMassOp(ref Boxes.DoubleBox mass)
public IOperation ReadMassOp(ref TBF.Boxes.DoubleBox mass)
{
mass.Val = 0;
return this;
}
public IOperation ReadStableMassOp(ref Boxes.DoubleBox mass, int readingsCount, double maxSpread, Config.Entities.MassMethod method)
public IOperation ReadStableMassOp(ref TBF.Boxes.DoubleBox mass, int readingsCount, double maxSpread, Config.Entities.MassMethod method)
{
mass.Val = 0;
return this;
@@ -2,11 +2,11 @@
/// Copyright (c) 2017 Sensus Metering Systems
///
using System;
using System.Globalization;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Dummy.FlowMeter
{
public partial class FlowMeterCfgCtrl : UserControl, IComponentCfgCtrl
+3 -5
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
/// Copyright (c) 2013-2017 Sensus Metering Systems
///
using System;
using System.Text;
@@ -43,9 +43,7 @@ namespace TBF.BenchControl.Elde
public StatusP StatusP { get { return controlCom.StatusP; } }
public int EtPulses(int wmNr1) { return controlCom.EtPulses(wmNr1); }
public int EtPulsesK { get { return controlCom.EtPulsesK; } }
public int EtPulses2 { get { return controlCom.EtPulses2; } } /// DEWA_300: pulses from I12
public int EtPulses3 { get { return controlCom.EtPulses3; } } /// DEWA_300: pulses from I13
public UInt16 WMeterPulses(int wmNr1) { return controlCom.WMeterPulses(wmNr1); }
public UInt16 WMeterPulses(int wmNr1) { return controlCom.WMeterPulses(wmNr1); }
public int WMeterReference(int wmNr0) { return controlCom.WMeterReference(wmNr0); }
public uint RegulValveDAC(int rvNr0) { return controlCom.RegulValveDAC(rvNr0); }
public float Pressure(int prsNr0) { return controlCom.Pressure(prsNr0); }
@@ -503,7 +501,7 @@ namespace TBF.BenchControl.Elde
///
void ShowEmergencyStopForm()
{
(new TBF.UI.Shared.EmergencyStopForm()).Show();
(new TBF.Forms.EmergencyStopForm()).Show();
}
+1 -3
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
@@ -28,8 +28,6 @@ namespace TBF.BenchControl.Elde
}
public int EtPulsesK { get { return 1; } }
public int EtPulses2 { get { return 0; } }
public int EtPulses3 { get { return 0; } }
double[] errFactor = new double[Config.Data.WMsCount + 1]; /// Internal
double[] wMeterPulsesF = new double[Config.Data.WMsCount + 1]; /// Internal
-7
View File
@@ -50,13 +50,6 @@ namespace TBF.BenchControl.Elde
public int EtPulsesK { get { return (int)ctrlBrdComponent.etPulsesK; } }
#endif
#if DEWA_300
public int EtPulses2 { get { return (int)ctrlBrdComponent.EtPulses2; } }
public int EtPulses3 { get { return (int)ctrlBrdComponent.EtPulses3; } }
#else
public int EtPulses2 { get { return 0; } }
public int EtPulses3 { get { return 0; } }
#endif
public UInt16 WMeterPulses(int wmNr1) { return (UInt16)ctrlBrdComponent.wMeterPuls[wmNr1]; }
public int WMeterReference(int wmNr0) { return (int)ctrlBrdComponent.wMeterReference[wmNr0]; }
@@ -2,6 +2,8 @@
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
///
using System;
using System.Globalization;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Configs;
using TBF.BenchControl.Generic;
@@ -28,66 +28,22 @@ namespace TBF.BenchControl.Elde.FlowMeterDewa
public double NominalFlow { get { return nominalFlow; } }
public double LtrPerPulse { get { return ltrPerPulse; } }
double[] refFreq; /// 0..sum, 1..I11, 2..I12, 3..I13
int[] refPulses;
double[] refFreq;
public double LtrPerPulseCorrected(double flow, int rangeIx)
{
log.DebugFormat("LtrPerPulseCorrected({0}, {1}) started", flow, rangeIx);
if (flow < 0.1 * NominalFlow) return LtrPerPulse; /// No correction for small flow
refFreq[0] = controlBoard.ReferenceFreqs(0);
refFreq[1] = controlBoard.ReferenceFreqs(1);
refFreq[2] = controlBoard.ReferenceFreqs(2);
refFreq[3] = controlBoard.ReferenceFreqs(3);
log.DebugFormat("refFreq[] = ({0}, {1}, {2}, {3})", refFreq[0], refFreq[1], refFreq[2], refFreq[3]);
refFreq[1] = refFreq[0] - refFreq[2] - refFreq[3];
refPulses[0] = controlBoard.EtPulses(0);
refPulses[2] = controlBoard.EtPulses2;
refPulses[3] = controlBoard.EtPulses3;
refPulses[1] = refPulses[0] - refPulses[2] - refPulses[3];
log.DebugFormat("refPulses[] = ({0}, {1}, {2}, {3})", refPulses[0], refPulses[1], refPulses[2], refPulses[3]);
double flow1, flow2, flow3;
double contribution1, contribution2, contribution3;
if (refFreq[0] != 0)
{
double ltrPerPulseCorrected = 0;
if (flowMeter1 != null)
{
double ratio = (double)refPulses[flowMeter1.Idx1] / (double)refPulses[0];
flow1 = flow * ratio;
contribution1 = flowMeter1.LtrPerPulseCorrected(flow1, rangeIx) * ratio;
ltrPerPulseCorrected += contribution1;
log.DebugFormat("flowmeter1 = {0}, flow1 = {1}, contribution1 = {2}", flowMeter1.Name, flow1, contribution1);
}
if (flowMeter2 != null)
{
double ratio = (double)refPulses[flowMeter2.Idx1] / (double)refPulses[0];
flow2 = flow * ratio;
contribution2 = flowMeter2.LtrPerPulseCorrected(flow2, rangeIx) * ratio;
ltrPerPulseCorrected += contribution2;
log.DebugFormat("flowmeter2 = {0}, flow2 = {1}, contribution2 = {2}", flowMeter2.Name, flow2, contribution2);
}
if (flowMeter3 != null)
{
double ratio = (double)refPulses[flowMeter3.Idx1] / (double)refPulses[0];
flow3 = flow * ratio;
contribution3 = flowMeter3.LtrPerPulseCorrected(flow3, rangeIx) * ratio;
ltrPerPulseCorrected += contribution3;
log.DebugFormat("flowmeter3 = {0}, flow3 = {1}, contribution3 = {2}", flowMeter3.Name, flow3, contribution3);
}
log.DebugFormat("LtrPerPulseCorrected() returns {0}", ltrPerPulseCorrected);
return ltrPerPulseCorrected;
}
else
{
log.DebugFormat("LtrPerPulseCorrected() returns 1");
return 1;
}
double ltrPerPulseCorrected = 0;
if (flowMeter1 != null) ltrPerPulseCorrected += refFreq[1] * flowMeter1.LtrPerPulseCorrected(flow * refFreq[1] / refFreq[0], rangeIx);
if (flowMeter2 != null) ltrPerPulseCorrected += refFreq[2] * flowMeter2.LtrPerPulseCorrected(flow * refFreq[2] / refFreq[0], rangeIx);
if (flowMeter3 != null) ltrPerPulseCorrected += refFreq[3] * flowMeter3.LtrPerPulseCorrected(flow * refFreq[3] / refFreq[0], rangeIx);
return ltrPerPulseCorrected / refFreq[0];
}
@@ -100,9 +56,7 @@ namespace TBF.BenchControl.Elde.FlowMeterDewa
public FlowMeter()
{
refFreq = new double[4];
refPulses = new int[4];
}
}
public FlowMeter(Generic.IComponentCfg cfg, IList<Generic.IComponent> components)
: base(cfg)
@@ -126,7 +80,6 @@ namespace TBF.BenchControl.Elde.FlowMeterDewa
ltrPerPulse = nominalFlow / (flowMetersCount * 7200.0); /// Nominal freq. is flowMetersCount * 2000 Hz (2000, 4000 or 6000 Hz)
refFreq = new double[4];
refPulses = new int[4];
log.Debug(this.ToString());
}
@@ -2,6 +2,8 @@
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Globalization;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Configs;
using TBF.BenchControl.Generic;
@@ -2,6 +2,7 @@
/// Copyright (c) 2017 Sensus Slovensko a.s.
///
using System;
using System.Globalization;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
@@ -4,7 +4,6 @@
using System;
using System.Collections.Generic;
using log4net;
using TBF.BenchControl;
using TBF.Boxes;
namespace TBF.BenchControl.Elde.FlowMeterTwins
@@ -16,8 +15,8 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
readonly FlowMeterCfg flowMeterCfg;
readonly ControlBoardDev controlBoard;
public readonly Elde.FlowMeter.FlowMeter FlowMeter1;
public readonly Elde.FlowMeter.FlowMeter FlowMeter2;
public readonly TBF.BenchControl.Elde.FlowMeter.FlowMeter FlowMeter1;
public readonly TBF.BenchControl.Elde.FlowMeter.FlowMeter FlowMeter2;
public int Idx1 { get { return 0; } }
public double NominalFlow { get { return flowMeterCfg.NominalFlow; } }
@@ -45,10 +44,10 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
controlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
FlowMeter1 = TbfComponents.FindComponent(flowMeterCfg.FlowMeter1, components) as Elde.FlowMeter.FlowMeter;
FlowMeter1 = (TBF.BenchControl.Elde.FlowMeter.FlowMeter)TbfComponents.FindComponent(flowMeterCfg.FlowMeter1, components);
if (FlowMeter1 == null) throw new Exception("Cannot find FlowMeter1 component");
FlowMeter2 = TbfComponents.FindComponent(flowMeterCfg.FlowMeter2, components) as Elde.FlowMeter.FlowMeter;
FlowMeter2 = (TBF.BenchControl.Elde.FlowMeter.FlowMeter)TbfComponents.FindComponent(flowMeterCfg.FlowMeter2, components);
if (FlowMeter2 == null) throw new Exception("Cannot find FlowMeter2 component");
controlBoard.EtCalib[Idx1] = (float)flowMeterCfg.NominalFlow; /// Idx1==0 for FlowMeterTwins
@@ -2,6 +2,7 @@
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
///
using System;
using System.Globalization;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
+2 -4
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
using Dirichlet.Numerics;
@@ -11,9 +11,7 @@ namespace TBF.BenchControl.Elde
StatusP StatusP { get; }
int EtPulses(int wmNr1);
int EtPulsesK { get; }
int EtPulses2 { get; }
int EtPulses3 { get; }
UInt16 WMeterPulses(int wmNr1);
UInt16 WMeterPulses(int wmNr1);
int WMeterReference(int wmNr0);
uint RegulValveDAC(int rvNr0);
float Pressure(int prsNr0);
@@ -2,6 +2,7 @@
/// Copyright (c) 2015-2018 Sensus Slovensko a.s.
///
using System;
using System.Globalization;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
+7 -11
View File
@@ -385,24 +385,20 @@ namespace TBF.BenchControl.Elde.RegulValve
}
else if (opState == OpState.SettingFlow)
{
/// Regulation valve is setting flow to the required value
if ((currentReqFlowLo <= flow) && (flow <= currentReqFlowHi))
///
/// Repeated untill the required flow is reached
///
if ((currentReqFlowLo <= flow) && (flow <= currentReqFlowHi))
{
/// Flow is within range
if (flowWithinBoundsTime++ >= regulValve.FlowStableSec)
if (flowWithinBoundsTime++ >= regulValve.FlowStableSec)
{
/// Flow is within range for sufficiently long time
if (regulValve.RegulValveCfg.StoredPositionReuse)
if (regulValve.RegulValveCfg.StoredPositionReuse)
{
float storedPosition;
if (regulValve.Dict.TryGetValue(reqFlowAve, out storedPosition))
{
/// update the stored valve position
StoreTargetPosition(reqFlowAve, (rvPosition + storedPosition) / 2.0f);
StoreTargetPosition(reqFlowAve, (rvPosition + storedPosition) / 2.0f);
log.InfoFormat("Run(): rv#={0} reqFlow={1} pos={2}% stored={3} <--- Updating a stored position",
regulValveNr, reqFlowAve, rvPosition.ToString("F1"), storedPosition);
}
@@ -2,6 +2,7 @@
/// Copyright (c) 2015 Sensus Slovensko a.s.
///
using System;
using System.Globalization;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
@@ -1,17 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using Config.Entities;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.GenericDevices
{
/// <summary>
/// Backup and security options
/// </summary>
public interface IBackupAndSecurity : IComponent
{
int MinPasswdLength { get; }
int PasswdExpirationPeriodDays { get; }
}
}
@@ -9,7 +9,7 @@ namespace TBF.BenchControl.Network.Camera
/// </summary>
public class JpegFrame : RtpFrame
{
static readonly ILog log = LogManager.GetLogger(typeof(TBF.UI.MainWnd));
static readonly ILog log = LogManager.GetLogger(typeof(MainWnd));
#region Statics
@@ -2,6 +2,7 @@
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
@@ -2,6 +2,7 @@
/// Copyright (c) 2018 Sensus Slovensko a.s.
///
using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
+1 -4
View File
@@ -488,10 +488,7 @@ namespace TBF.BenchControl.Sequences
Debug.WriteLine(string.Format("Procedure {0}", NHibernateUtil.IsInitialized(StateMachine.Procedure) ? "initialized" : "NOT initialized"));
Debug.WriteLine(string.Format("Procedure.MoreParams {0}", NHibernateUtil.IsInitialized(StateMachine.Procedure.MoreParams) ? "initialized" : "NOT initialized"));
Debug.WriteLine(string.Format("Procedure.Tests {0}", NHibernateUtil.IsInitialized(StateMachine.Procedure.Tests) ? "initialized" : "NOT initialized"));
if (StateMachine.Procedure.Tests.Count > 0)
{
Debug.WriteLine(string.Format("Procedure.Tests[0].MoreParams {0}", NHibernateUtil.IsInitialized(StateMachine.Procedure.Tests[0].MoreParams) ? "initialized" : "NOT initialized"));
}
Debug.WriteLine(string.Format("Procedure.Tests[0].MoreParams {0}", NHibernateUtil.IsInitialized(StateMachine.Procedure.Tests[0].MoreParams) ? "initialized" : "NOT initialized"));
UiBridge.Bridge.OnError(this, string.Empty); /// Clear an error message (if any)
+1 -2
View File
@@ -7,8 +7,7 @@ namespace TBF.BenchControl.Sequences
{
public class ProcessData
{
public static IBackupAndSecurity BackupAndSecurity;
public static IBenchInfo BenchInfo;
public static IBenchInfo BenchInfo;
public static IErrorFlags ErrorFlagsComp;
public static Output.DB.SensusOracle.Database OracleDB;
public static IList<Output.SensusTestInfo> RawTestInfos; /// Incomplete raw test infos from Oracle DB
+1 -2
View File
@@ -228,8 +228,7 @@ namespace TBF.BenchControl
foreach (var cmpnt in components)
{
if (cmpnt is Elde.ControlBoardDev) ControlBoard = cmpnt as Elde.ControlBoardDev;
if (cmpnt is IBackupAndSecurity) ProcessData.BackupAndSecurity = cmpnt as IBackupAndSecurity;
if (cmpnt is IBenchInfo) ProcessData.BenchInfo = cmpnt as IBenchInfo;
if (cmpnt is IBenchInfo) ProcessData.BenchInfo = cmpnt as IBenchInfo;
if (cmpnt is IErrorFlags) ProcessData.ErrorFlagsComp = cmpnt as IErrorFlags;
if ((cmpnt is Output.DB.SensusOracle.Database) && (ProcessData.OracleDB == null))
{
+1 -2
View File
@@ -15,8 +15,7 @@ namespace TBF.BenchControl
{
Factories = new List<IComponentFactory>();
Factories.Add(new BackupAndSecurity.Default.ComponentFactory());
Factories.Add(new BenchInfo.Munich.ComponentFactory());
Factories.Add(new BenchInfo.Munich.ComponentFactory());
Factories.Add(new BenchInfo.Extended.ComponentFactory());
Factories.Add(new BenchInfo.iPerl.ComponentFactory());
Factories.Add(new Elde.ControlBoardFactory());
@@ -7,11 +7,10 @@ using System.Windows.Forms;
using log4net;
using TBF.BenchControl.GenericDevices;
using TBF.Resources;
using TBF.UI.Shared;
namespace TBF.BenchControl.TestMethods.Endurance
{
public partial class CycleDlg : Form, IParentOfListViewEx
public partial class CycleDlg : Form, TBF.UiControls.IParentOfListViewEx
{
static readonly ILog log = LogManager.GetLogger(typeof(CycleDlg));
@@ -31,7 +30,7 @@ namespace TBF.BenchControl.TestMethods.Endurance
public IList<IValve> Valves;
ITabWithListViewEx seqStepsCtrl;
TBF.UiControls.ITabWithListViewEx seqStepsCtrl;
public CycleDlg()
@@ -48,10 +47,10 @@ namespace TBF.BenchControl.TestMethods.Endurance
/// SharedDlgButtons configuration
sharedButtons.RequiredGroupMembership = new Users.Grp.GID[] { Users.Grp.GID.Metrologists };
sharedButtons.OptionalButtons = SharedButtons.Buttons.Add |
SharedButtons.Buttons.Remove |
SharedButtons.Buttons.Up |
SharedButtons.Buttons.Down;
sharedButtons.OptionalButtons = TBF.UiControls.SharedButtons.Buttons.Add |
TBF.UiControls.SharedButtons.Buttons.Remove |
TBF.UiControls.SharedButtons.Buttons.Up |
TBF.UiControls.SharedButtons.Buttons.Down;
sharedButtons.Unlocked += Unlocked;
sharedButtons.OKClicked += okButton_Click;
sharedButtons.CancelClicked += cancelButton_Click;
@@ -60,7 +59,7 @@ namespace TBF.BenchControl.TestMethods.Endurance
sharedButtons.UpClicked += upButton_Click;
sharedButtons.DownClicked += downButton_Click;
seqStepsCtrl = new CycleStepsCtrl() as ITabWithListViewEx;
seqStepsCtrl = new CycleStepsCtrl();
/// Prepare a list of valves for the endurance test
TbfComponents = BenchControl.TbfComponents.LoadComponentsFromDB(Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config));
@@ -99,7 +98,7 @@ namespace TBF.BenchControl.TestMethods.Endurance
{
Localize();
LocalSettings ls = Program.LocalSettings;
TBF.LocalSettings ls = Program.LocalSettings;
Width = (ls.EnduranceDlgWidth > 0) ? ls.EnduranceDlgWidth : 1050;
Height = (ls.EnduranceDlgHeight > 0) ? ls.EnduranceDlgHeight : 360;
Left = (ls.EnduranceDlgLeft != 0) ? ls.EnduranceDlgLeft : 150;
@@ -178,8 +177,8 @@ namespace TBF.BenchControl.TestMethods.Endurance
seqStepsCtrl.OkBtnClicked();
}
slctdTab = tabControl.SelectedIndex;
sharedButtons.EnableButtons(SharedButtons.Buttons.Add);
sharedButtons.DisableButtons(SharedButtons.Buttons.Remove);
sharedButtons.EnableButtons(TBF.UiControls.SharedButtons.Buttons.Add);
sharedButtons.DisableButtons(TBF.UiControls.SharedButtons.Buttons.Remove);
RefreshAllTabs();
}
@@ -203,32 +202,32 @@ namespace TBF.BenchControl.TestMethods.Endurance
if (seqStepsCtrl != null) seqStepsCtrl.MoveDownSelected();
}
public void UpdateButtonStates(SharedButtons.SelectedItemPos selectedItemPos)
public void UpdateButtonStates(TBF.UiControls.SharedButtons.SelectedItemPos selectedItemPos)
{
if (selectedItemPos == SharedButtons.SelectedItemPos.None)
if (selectedItemPos == TBF.UiControls.SharedButtons.SelectedItemPos.None)
{
sharedButtons.DisableButtons(SharedButtons.Buttons.Up |
SharedButtons.Buttons.Down);
sharedButtons.DisableButtons(TBF.UiControls.SharedButtons.Buttons.Up |
TBF.UiControls.SharedButtons.Buttons.Down);
}
else if (selectedItemPos == SharedButtons.SelectedItemPos.First)
else if (selectedItemPos == TBF.UiControls.SharedButtons.SelectedItemPos.First)
{
sharedButtons.EnableButtons(SharedButtons.Buttons.Down);
sharedButtons.DisableButtons(SharedButtons.Buttons.Up);
sharedButtons.EnableButtons(TBF.UiControls.SharedButtons.Buttons.Down);
sharedButtons.DisableButtons(TBF.UiControls.SharedButtons.Buttons.Up);
}
else if (selectedItemPos == SharedButtons.SelectedItemPos.Last)
else if (selectedItemPos == TBF.UiControls.SharedButtons.SelectedItemPos.Last)
{
sharedButtons.EnableButtons(SharedButtons.Buttons.Up);
sharedButtons.DisableButtons(SharedButtons.Buttons.Down);
sharedButtons.EnableButtons(TBF.UiControls.SharedButtons.Buttons.Up);
sharedButtons.DisableButtons(TBF.UiControls.SharedButtons.Buttons.Down);
}
else if (selectedItemPos == SharedButtons.SelectedItemPos.FirstAndLast)
else if (selectedItemPos == TBF.UiControls.SharedButtons.SelectedItemPos.FirstAndLast)
{
sharedButtons.DisableButtons(SharedButtons.Buttons.Up |
SharedButtons.Buttons.Down);
sharedButtons.DisableButtons(TBF.UiControls.SharedButtons.Buttons.Up |
TBF.UiControls.SharedButtons.Buttons.Down);
}
else
{
sharedButtons.EnableButtons(SharedButtons.Buttons.Up |
SharedButtons.Buttons.Down);
sharedButtons.EnableButtons(TBF.UiControls.SharedButtons.Buttons.Up |
TBF.UiControls.SharedButtons.Buttons.Down);
}
}
@@ -241,23 +240,23 @@ namespace TBF.BenchControl.TestMethods.Endurance
Results.Forms.ListViewEx listViewEx = sender as Results.Forms.ListViewEx;
if (listViewEx.SelectedItems.Count != 1)
{
UpdateButtonStates(SharedButtons.SelectedItemPos.None);
UpdateButtonStates(TBF.UiControls.SharedButtons.SelectedItemPos.None);
}
else if (listViewEx.Items.Count == 1)
{
UpdateButtonStates(SharedButtons.SelectedItemPos.FirstAndLast);
UpdateButtonStates(TBF.UiControls.SharedButtons.SelectedItemPos.FirstAndLast);
}
else if (listViewEx.SelectedIndices[0] == 0)
{
UpdateButtonStates(SharedButtons.SelectedItemPos.First);
UpdateButtonStates(TBF.UiControls.SharedButtons.SelectedItemPos.First);
}
else if (listViewEx.SelectedIndices[0] == (listViewEx.Items.Count - 1))
{
UpdateButtonStates(SharedButtons.SelectedItemPos.Last);
UpdateButtonStates(TBF.UiControls.SharedButtons.SelectedItemPos.Last);
}
else
{
UpdateButtonStates(SharedButtons.SelectedItemPos.Middle);
UpdateButtonStates(TBF.UiControls.SharedButtons.SelectedItemPos.Middle);
}
}
}
+2 -2
View File
@@ -34,7 +34,7 @@ namespace TBF.BenchControl.TestMethods.Endurance
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CycleDlg));
this.mainSplitContainer = new System.Windows.Forms.SplitContainer();
this.tabControl = new System.Windows.Forms.TabControl();
this.sharedButtons = new TBF.UI.Shared.SharedButtons();
this.sharedButtons = new TBF.UiControls.SharedButtons();
((System.ComponentModel.ISupportInitialize)(this.mainSplitContainer)).BeginInit();
this.mainSplitContainer.Panel1.SuspendLayout();
this.mainSplitContainer.Panel2.SuspendLayout();
@@ -86,6 +86,6 @@ namespace TBF.BenchControl.TestMethods.Endurance
private System.Windows.Forms.SplitContainer mainSplitContainer;
private System.Windows.Forms.TabControl tabControl;
private TBF.UI.Shared.SharedButtons sharedButtons;
private UiControls.SharedButtons sharedButtons;
}
}
@@ -7,11 +7,10 @@ using System.Windows.Forms;
using log4net;
using TBF.BenchControl.GenericDevices;
using TBF.Resources;
using TBF.UI.Shared;
namespace TBF.BenchControl.TestMethods.Endurance
{
public partial class CycleStepsCtrl : BaseWithListViewEx<CycleStep>, ITabWithListViewEx
public partial class CycleStepsCtrl : TBF.UiControls.BaseWithListViewEx<CycleStep>, TBF.UiControls.ITabWithListViewEx
{
static readonly ILog log = LogManager.GetLogger(typeof(CycleStepsCtrl));
@@ -55,13 +54,13 @@ namespace TBF.BenchControl.TestMethods.Endurance
///
/// ListViewEx columns
///
Columns.Add(Strings.Duration_ms, 100 * parent.Dpi / UI.Constants.Dpi100pct);
//Columns.Add(Strings.Message, 100 * parent.Dpi / UI.Constants.Dpi100pct);
Columns.Add(Strings.Duration_ms, 100 * parent.Dpi / PathsDlg.Dpi100pct);
//Columns.Add(Strings.Message, 100 * parent.Dpi / PathsDlg.Dpi100pct);
///
vCount = 0;
foreach (var vlv in parent.Valves)
{
Columns.Add(vlv.Cfg.Name, 50 * parent.Dpi / UI.Constants.Dpi100pct);
Columns.Add(vlv.Cfg.Name, 50 * parent.Dpi / PathsDlg.Dpi100pct);
vCount++;
}
@@ -257,7 +256,7 @@ namespace TBF.BenchControl.TestMethods.Endurance
bool lastItemRemoved = base.RemoveSelected();
if (lastItemRemoved && parent != null)
{
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.None);
parent.UpdateButtonStates(TBF.UiControls.SharedButtons.SelectedItemPos.None);
}
}
@@ -174,46 +174,13 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
/// <param name="threadID">0..3</param>
/// <param name="iperlHead">Water meter (iPerlHead) object</param>
/// <returns>Value returned by readRequestPort(...)</returns>
public static unsafe int ReadRequestPort(int threadID, IperlHead iperlHead, MessageID messageID, int offset, int length, out byte[] buffer, int timeout)
public static unsafe int ReadRequestPort(int threadID, IperlHead iperlHead, MessageID messageID, int offset, int lenght, out byte[] buffer, int timeout)
{
if (iperlHead.DebugLevel != DebugMode.Normal)
{
///
/// Simulation
///
if ((messageID == MessageID.Configuration) && (offset == 0) && (length == ConfigStruct.Length))
{
buffer = new byte[ConfigStruct.Length] { 3, 3, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0, 1,2,3,4,5, 160, 0,0,0,0, 0,0, 0,0, 0,0 };
}
else if ((messageID == MessageID.Calibration) && (offset == 0) && (length == CalibrationStruct.Length))
{
buffer = new byte[CalibrationStruct.Length] { 3, 0, 150,10, 0, 0, 0,0, 0,0,0,0,0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0,0,0, 1,2,3,4,5, 0, 0 };
}
else if ((messageID == MessageID.Calibration) && (offset == 0) && (length == CalibrationStructV4.Length))
{
buffer = new byte[CalibrationStructV4.Length] { 3, 0, 150,10, 0, 0, 0,0, 0,0,0,0,0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0,0,0, 1,2,3,4,5, 0, 0, 150,10 };
}
else if ((messageID == MessageID.Calibration) && (offset == 2) && (length == 2))
{
buffer = new byte[2] { 150,10 };
}
else if ((messageID == MessageID.Calibration) && (offset == 34) && (length == 2))
{
buffer = new byte[2] { 150,10 };
}
else if ((messageID == MessageID.MetrologyMemory) && (offset == Q2CorrFactorsAddr) && (length == 2))
{
buffer = new byte[2] { 0, 0 };
}
else
{
buffer = new byte[length];
}
buffer = new byte[lenght];
if (iperlHead.DebugLevel != DebugMode.Normal) return iperlHead.Name.Equals("iPerl13") ? 2 : 0; /// Simulates an error on position 13
return iperlHead.Name.Equals("iPerl13") ? 2 : 0; /// Simulates an error on position 13
}
buffer = new byte[length];
byte[] buf = new byte[200];
///
fixed (byte* pBuf = buf)
@@ -223,32 +190,32 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
switch (threadID)
{
default:
case 0: retv = readRequestPort1(messageID, offset, length, pBuf, timeout); break;
case 1: retv = readRequestPort2(messageID, offset, length, pBuf, timeout); break;
case 2: retv = readRequestPort3(messageID, offset, length, pBuf, timeout); break;
case 3: retv = readRequestPort4(messageID, offset, length, pBuf, timeout); break;
case 0: retv = readRequestPort1(messageID, offset, lenght, pBuf, timeout); break;
case 1: retv = readRequestPort2(messageID, offset, lenght, pBuf, timeout); break;
case 2: retv = readRequestPort3(messageID, offset, lenght, pBuf, timeout); break;
case 3: retv = readRequestPort4(messageID, offset, lenght, pBuf, timeout); break;
}
for (int i = 0; i < length; i++) buffer[i] = buf[i];
for (int i = 0; i < lenght; i++) buffer[i] = buf[i];
///
/// Logging
///
string name = string.Format("{0}({1})", iperlHead.Name, iperlHead.SerialNr);
if ((messageID == MessageID.Configuration) && (offset == 0) && (length == ConfigStruct.Length))
if ((messageID == MessageID.Configuration) && (offset == 0) && (lenght == ConfigStruct.Length))
rfidDataLogger.InfoFormat("{0}: ReadRequestPort({1},...) returned {2} {3}", name, messageID, retv, (retv != 0) ? "!" : ConfigStruct.FromByteArray(buffer).ToString());
else if ((messageID == MessageID.Calibration) && (offset == 0) && (length == CalibrationStruct.Length))
else if ((messageID == MessageID.Calibration) && (offset == 0) && (lenght == CalibrationStruct.Length))
rfidDataLogger.InfoFormat("{0}: ReadRequestPort({1},...) returned {2} {3}", name, messageID, retv, (retv != 0) ? "!" : CalibrationStruct.FromByteArray(buffer).ToString());
else if ((messageID == MessageID.Calibration) && (offset == 0) && (length == CalibrationStructV4.Length))
else if ((messageID == MessageID.Calibration) && (offset == 0) && (lenght == CalibrationStructV4.Length))
rfidDataLogger.InfoFormat("{0}: ReadRequestPort({1},...) returned {2} {3}", name, messageID, retv, (retv != 0) ? "!" : CalibrationStructV4.FromByteArray(buffer).ToString());
else if ((messageID == MessageID.Calibration) && (offset == 2) && (length == 2))
else if ((messageID == MessageID.Calibration) && (offset == 2) && (lenght == 2))
rfidDataLogger.InfoFormat("{0}: ReadRequestPort({1},2,2,...) returned {2} {3}", name, messageID, retv, (retv != 0) ? "!" : string.Format("Cal={0}", buf[0] + 256 * buf[1]));
else if ((messageID == MessageID.Calibration) && (offset == 34) && (length == 2))
else if ((messageID == MessageID.Calibration) && (offset == 34) && (lenght == 2))
rfidDataLogger.InfoFormat("{0}: ReadRequestPort({1},34,2,...) returned {2} {3}", name, messageID, retv, (retv != 0) ? "!" : string.Format("CalLNA={0}", buf[0] + 256 * buf[1]));
else if ((messageID == MessageID.MetrologyMemory) && (offset == Q2CorrFactorsAddr) && (length == 2))
else if ((messageID == MessageID.MetrologyMemory) && (offset == Q2CorrFactorsAddr) && (lenght == 2))
rfidDataLogger.InfoFormat("{0}: ReadRequestPort({1},6264,2,...) returned {2} {3}", name, messageID, retv, (retv != 0) ? "!" : string.Format("LR={0} RL={1}", (int)buf[0], (int)buf[1]));
else
rfidDataLogger.InfoFormat("{0}: ReadRequestPort({1}, {2}, {3}, ...) returned {4} {5}", name, messageID, offset, length, retv, (retv != 0) ? "!" : "");
rfidDataLogger.InfoFormat("{0}: ReadRequestPort({1}, {2}, {3}, ...) returned {4} {5}", name, messageID, offset, lenght, retv, (retv != 0) ? "!" : "");
return retv;
}
@@ -260,7 +227,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
/// <param name="threadID">0..3</param>
/// <param name="iperlHead">Water meter (iPerlHead) object</param>
/// <returns>Value returned by writeRequestPort(...)</returns>
public static unsafe int WriteRequestPort(int threadID, IperlHead iperlHead, MessageID messageID, int offset, int length, byte[] buffer, int timeout)
public static unsafe int WriteRequestPort(int threadID, IperlHead iperlHead, MessageID messageID, int offset, int lenght, byte[] buffer, int timeout)
{
if (iperlHead.DebugLevel != DebugMode.Normal) return 0;
@@ -271,10 +238,10 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
switch (threadID)
{
default:
case 0: retv = writeRequestPort1(messageID, offset, length, pBuf, timeout); break;
case 1: retv = writeRequestPort2(messageID, offset, length, pBuf, timeout); break;
case 2: retv = writeRequestPort3(messageID, offset, length, pBuf, timeout); break;
case 3: retv = writeRequestPort4(messageID, offset, length, pBuf, timeout); break;
case 0: retv = writeRequestPort1(messageID, offset, lenght, pBuf, timeout); break;
case 1: retv = writeRequestPort2(messageID, offset, lenght, pBuf, timeout); break;
case 2: retv = writeRequestPort3(messageID, offset, lenght, pBuf, timeout); break;
case 3: retv = writeRequestPort4(messageID, offset, lenght, pBuf, timeout); break;
}
Thread.Sleep(250);
@@ -283,9 +250,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
/// Logging
///
string name = string.Format("{0}({1})", iperlHead.Name, iperlHead.SerialNr);
if (length == 1)
rfidDataLogger.InfoFormat("{0}: WriteRequestPort({2}, {3}, {4}, {5}) returned {1} {6}", name, retv, messageID, offset, length, pBuf[0].ToString("X2"), (retv != 0) ? "!" : "");
else if (length == 2)
if (lenght == 1)
rfidDataLogger.InfoFormat("{0}: WriteRequestPort({2}, {3}, {4}, {5}) returned {1} {6}", name, retv, messageID, offset, lenght, pBuf[0].ToString("X2"), (retv != 0) ? "!" : "");
else if (lenght == 2)
{
if (messageID == MessageID.Calibration && offset == 2)
{
@@ -298,10 +265,10 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
rfidDataLogger.InfoFormat("{0}: WriteRequestPort(CalLNA={1}) returned {2} {3}", name, calibFactor, retv, (retv != 0) ? "!" : "");
}
else
rfidDataLogger.InfoFormat("{0}: WriteRequestPort({2}, {3}, {4}, {5} {6}) returned {1} {7}", name, retv, messageID, offset, length, pBuf[0].ToString("X2"), pBuf[1].ToString("X2"), (retv != 0) ? "!" : "");
rfidDataLogger.InfoFormat("{0}: WriteRequestPort({2}, {3}, {4}, {5} {6}) returned {1} {7}", name, retv, messageID, offset, lenght, pBuf[0].ToString("X2"), pBuf[1].ToString("X2"), (retv != 0) ? "!" : "");
}
else
rfidDataLogger.InfoFormat("{0}: WriteRequestPort({2}, {3}, {4}, {5} {6} ...) returned {1} {7}", name, retv, messageID, offset, length, pBuf[0].ToString("X2"), pBuf[1].ToString("X2"), (retv != 0) ? "!" : "");
rfidDataLogger.InfoFormat("{0}: WriteRequestPort({2}, {3}, {4}, {5} {6} ...) returned {1} {7}", name, retv, messageID, offset, lenght, pBuf[0].ToString("X2"), pBuf[1].ToString("X2"), (retv != 0) ? "!" : "");
return retv;
}
@@ -7,7 +7,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
{
public class CalibrationStruct
{
public const int Length = 35;
public static readonly int Length = 35;
public Byte Version;
public MeterType MeterType;
@@ -7,7 +7,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
{
public class CalibrationStructV4
{
public const int Length = 37;
public static readonly int Length = 37;
public Byte Version;
public MeterType MeterType;
@@ -1,7 +1,7 @@
///
/// Copyright (c) 2013-2015 Sensus Slovensko a.s.
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
namespace TBF.UI.Settings
namespace TBF
{
partial class BenchesDlg
{
@@ -5,7 +5,7 @@ using System;
using System.Windows.Forms;
using TBF.Resources;
namespace TBF.UI.Settings
namespace TBF
{
/// <summary>
/// Dialog to edit local settings that specify database parameters (S1.2)
@@ -64,8 +64,9 @@ namespace TBF.UI.Settings
private void addButton_Click(object sender, EventArgs e)
{
Config.DatabaseSettings bench = new Config.DatabaseSettings();
DatabaseSettingsDlg dlg = new DatabaseSettingsDlg(bench, Config.Data.CurrentBench.ProceduresDBSettings.ConnectionString,
Config.Data.CurrentBench.WaterMetersDBSettings.ConnectionString);
Forms.DatabaseSettingsDlg dlg = new Forms.DatabaseSettingsDlg(bench,
Config.Data.CurrentBench.ProceduresDBSettings.ConnectionString,
Config.Data.CurrentBench.WaterMetersDBSettings.ConnectionString);
DialogResult dr = dlg.ShowDialog();
CurrentDBChanged |= dlg.CurrentDBChanged;
if (dr == DialogResult.OK)
@@ -104,8 +105,9 @@ namespace TBF.UI.Settings
Config.DatabaseSettings ori = localSettings.TestBenches[testBenchesListBox.SelectedIndex];
Config.DatabaseSettings bench = (Config.DatabaseSettings)ori.Clone();
DatabaseSettingsDlg dlg = new DatabaseSettingsDlg(bench, Config.Data.CurrentBench.ProceduresDBSettings.ConnectionString,
Config.Data.CurrentBench.WaterMetersDBSettings.ConnectionString);
Forms.DatabaseSettingsDlg dlg = new Forms.DatabaseSettingsDlg(bench,
Config.Data.CurrentBench.ProceduresDBSettings.ConnectionString,
Config.Data.CurrentBench.WaterMetersDBSettings.ConnectionString);
DialogResult dr = dlg.ShowDialog();
CurrentDBChanged |= dlg.CurrentDBChanged;
if (dr == DialogResult.OK)
@@ -133,9 +135,9 @@ namespace TBF.UI.Settings
{
if (testBenchesListBox.SelectedIndex >= 0)
{
DatabaseSettingsDlg dlg = new DatabaseSettingsDlg(localSettings.TestBenches[testBenchesListBox.SelectedIndex],
Config.Data.CurrentBench.ProceduresDBSettings.ConnectionString,
Config.Data.CurrentBench.WaterMetersDBSettings.ConnectionString);
Forms.DatabaseSettingsDlg dlg = new Forms.DatabaseSettingsDlg(localSettings.TestBenches[testBenchesListBox.SelectedIndex],
Config.Data.CurrentBench.ProceduresDBSettings.ConnectionString,
Config.Data.CurrentBench.WaterMetersDBSettings.ConnectionString);
DialogResult dr = dlg.ShowDialog();
CurrentDBChanged |= dlg.CurrentDBChanged;
if (dr == DialogResult.OK)
@@ -1,7 +1,7 @@
///
/// Copyright (c) 2013-2015 Sensus Slovensko a.s.
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
namespace TBF.BenchControl
namespace TBF
{
partial class ComponentParametersDlg
{
@@ -32,7 +32,7 @@ namespace TBF.BenchControl
private void InitializeComponent()
{
this.splitContainer = new System.Windows.Forms.SplitContainer();
this.sharedButtons = new TBF.UI.Shared.SharedButtons();
this.sharedButtons = new TBF.UiControls.SharedButtons();
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
this.splitContainer.Panel2.SuspendLayout();
this.splitContainer.SuspendLayout();
@@ -84,6 +84,6 @@ namespace TBF.BenchControl
#endregion
private System.Windows.Forms.SplitContainer splitContainer;
private TBF.UI.Shared.SharedButtons sharedButtons;
private UiControls.SharedButtons sharedButtons;
}
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2015 Sensus Slovensko a.s.
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
@@ -7,10 +7,10 @@ using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl;
using TBF.BenchControl.Generic;
using TBF.UiControls;
using TBF.Resources;
using TBF.UI.Shared;
namespace TBF.BenchControl
namespace TBF
{
public partial class ComponentParametersDlg : Form
{
@@ -1,7 +1,7 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
namespace TBF.UI.Bench.Components
namespace TBF
{
partial class ComponentsManagerDlg
{
@@ -33,8 +33,8 @@ namespace TBF.UI.Bench.Components
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ComponentsManagerDlg));
this.splitContainer = new System.Windows.Forms.SplitContainer();
this.listViewEx = new global::Results.Forms.ListViewEx();
this.sharedButtons = new TBF.UI.Shared.SharedButtons();
this.listViewEx = new Results.Forms.ListViewEx();
this.sharedButtons = new TBF.UiControls.SharedButtons();
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
this.splitContainer.Panel1.SuspendLayout();
this.splitContainer.Panel2.SuspendLayout();
@@ -68,7 +68,7 @@ namespace TBF.UI.Bench.Components
this.listViewEx.Name = "listViewEx";
this.listViewEx.UseCompatibleStateImageBehavior = false;
this.listViewEx.View = System.Windows.Forms.View.Details;
this.listViewEx.SubItemRightClicked += new global::Results.Forms.SubItemEventHandler(this.listViewEx_SubItemRightClicked);
this.listViewEx.SubItemRightClicked += new Results.Forms.SubItemEventHandler(this.listViewEx_SubItemRightClicked);
this.listViewEx.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.listViewEx_ColumnClick);
this.listViewEx.SelectedIndexChanged += new System.EventHandler(this.componentsListView_SelectedIndexChanged);
this.listViewEx.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.listViewEx_MouseDoubleClick);
@@ -96,8 +96,8 @@ namespace TBF.UI.Bench.Components
#endregion
private global::Results.Forms.ListViewEx listViewEx;
private Results.Forms.ListViewEx listViewEx;
private System.Windows.Forms.SplitContainer splitContainer;
private TBF.UI.Shared.SharedButtons sharedButtons;
private UiControls.SharedButtons sharedButtons;
}
}
@@ -13,9 +13,9 @@ using Results.Forms;
using TBF.BenchControl;
using TBF.BenchControl.Generic;
using TBF.Resources;
using TBF.UI.Shared;
using TBF.UiControls;
namespace TBF.UI.Bench.Components
namespace TBF
{
public partial class ComponentsManagerDlg : Form, IParentOfListViewEx
{
@@ -97,7 +97,7 @@ namespace TBF.UI.Bench.Components
LoadFormPosition();
Text = Strings.Test_Bench_Components_Configuration;
LocalSettings ls = Program.LocalSettings;
TBF.LocalSettings ls = Program.LocalSettings;
listViewEx.Columns.Add(Strings.Nr, (ls.ComponentsColumnCount > 0) ? ls.ComponentsColumnWidths[0] : 40);
listViewEx.Columns.Add(Strings.Name, (ls.ComponentsColumnCount > 1) ? ls.ComponentsColumnWidths[1] : 80);
listViewEx.Columns.Add(Strings.Type, (ls.ComponentsColumnCount > 2) ? ls.ComponentsColumnWidths[2] : 120);
@@ -115,10 +115,10 @@ namespace TBF.UI.Bench.Components
for (LogLevel level = 0; level < LogLevel.Count; level++) logCB.Items.Add(level.ToDescription());
splitContainer.Panel1.Controls.Add(logCB);
listViewEx.SubItemClicked += new SubItemEventHandler(listViewEx_SubItemClicked);
listViewEx.SubItemEndEditing += new SubItemEndEditingEventHandler(listViewEx_SubItemEndEditing);
listViewEx.SubItemClicked += new Results.Forms.SubItemEventHandler(listViewEx_SubItemClicked);
listViewEx.SubItemEndEditing += new Results.Forms.SubItemEndEditingEventHandler(listViewEx_SubItemEndEditing);
sharedButtons.DisableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Edit);
sharedButtons.DisableButtons(UiControls.SharedButtons.Buttons.Remove | UiControls.SharedButtons.Buttons.Edit);
session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config);
cmpntEntities = session.QueryOver<Component>()
@@ -128,7 +128,7 @@ namespace TBF.UI.Bench.Components
RedrawAll();
}
void listViewEx_SubItemClicked(object sender, SubItemEventArgs e)
void listViewEx_SubItemClicked(object sender, Results.Forms.SubItemEventArgs e)
{
if (unlocked && e.SubItem == (int)Column.DebugMode)
{
@@ -192,7 +192,7 @@ namespace TBF.UI.Bench.Components
}
}
void listViewEx_SubItemEndEditing(object sender, SubItemEndEditingEventArgs e)
void listViewEx_SubItemEndEditing(object sender, Results.Forms.SubItemEndEditingEventArgs e)
{
Component cmpnt = (Component)e.Item.Tag;
@@ -302,7 +302,7 @@ namespace TBF.UI.Bench.Components
private void LoadFormPosition()
{
LocalSettings ls = Program.LocalSettings;
TBF.LocalSettings ls = Program.LocalSettings;
Width = (ls.ComponentsDlgWidth > 0) ? ls.ComponentsDlgWidth : 850;
Height = (ls.ComponentsDlgHeight > 0) ? ls.ComponentsDlgHeight : 500;
Left = (ls.ComponentsDlgLeft != 0) ? ls.ComponentsDlgLeft : 200;
@@ -639,11 +639,11 @@ namespace TBF.UI.Bench.Components
{
if (listViewEx.SelectedIndices.Count == 1)
{
sharedButtons.EnableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Edit);
sharedButtons.EnableButtons(UiControls.SharedButtons.Buttons.Remove | UiControls.SharedButtons.Buttons.Edit);
}
else
{
sharedButtons.DisableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Edit);
sharedButtons.DisableButtons(UiControls.SharedButtons.Buttons.Remove | UiControls.SharedButtons.Buttons.Edit);
}
}
+86
View File
@@ -0,0 +1,86 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace TBF
{
/// <summary>
/// This static class maintains a set of text box styles at one place, it is then sufficient
/// to use the static method CustomStyle.Apply(id, textBox(es)) to apply this style to text box(es).
/// </summary>
public static class CustomStyle
{
const int setsCount = 20; /// Number of styles / attribute sets
static DockStyle[] dockStyles; /// Docking style
static System.Drawing.Color[] backColors; /// Background color
static BorderStyle[] borderStyles; /// Border style
static bool[] readOnly; /// Read only
static System.Drawing.Font[] fonts; /// Font
static CustomStyle()
{
dockStyles = new DockStyle[setsCount];
backColors = new System.Drawing.Color[setsCount];
borderStyles = new BorderStyle[setsCount];
readOnly = new bool[setsCount];
fonts = new System.Drawing.Font[setsCount];
}
/// <summary>
/// Set attributes of the set selected by 'set' parameter
/// </summary>
/// <param name="id">Attribute set ID</param>
/// <param name="dockStyle">Docking style</param>
/// <param name="backColor">Background color</param>
/// <param name="readOnly">true for read only (aka label)</param>
/// <param name="borderStyle">Border style</param>
public static void Set(int id, DockStyle dockStyle, System.Drawing.Color backColor, BorderStyle borderStyle, bool readOnly, System.Drawing.Font font)
{
if (id < 0 || id >= setsCount) return;
CustomStyle.dockStyles[id] = dockStyle;
CustomStyle.backColors[id] = backColor;
CustomStyle.borderStyles[id] = borderStyle;
CustomStyle.readOnly[id] = readOnly;
CustomStyle.fonts[id] = font;
}
/// <summary>
/// Apply one of the attribute sets to a TextBox instance
/// </summary>
public static void Apply(int id, TextBox textBox)
{
if (id < 0 || id >= setsCount) return;
textBox.Dock = dockStyles[id];
textBox.BackColor = backColors[id];
textBox.BorderStyle = borderStyles[id];
textBox.ReadOnly = readOnly[id];
textBox.Font = fonts[id];
}
/// <summary>
/// Apply one of the attribute sets to a AttachedTextBoxes text boxes
/// </summary>
public static void Apply(int id, AttachedTextBoxes textBoxes)
{
if (id < 0 || id >= setsCount) return;
for (int i = 0; i < textBoxes.Count; i++)
{
textBoxes[i].Dock = dockStyles[id];
textBoxes[i].BackColor = backColors[id];
textBoxes[i].BorderStyle = borderStyles[id];
textBoxes[i].ReadOnly = readOnly[id];
textBoxes[i].Font = fonts[id];
}
}
}
}
+34
View File
@@ -0,0 +1,34 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
using System.Windows.Forms;
using TBF.Forms;
using TBF.Resources;
namespace TBF.ErrorHandler {
public static class ErrorHandler
{
public static DialogResult HandleError(Exception e, string Message, string Origin)
{
//catch (FluentNHibernate.Cfg.FluentConfigurationException fe)
// {
// string message;
// if (fe.InnerException != null)
// {
// message = fe.InnerException.Message;
// }
// else
// {
// message = fe.Message;
// }
// MessageBox.Show( message, "RetVal", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
ErrorDlg dlg = new ErrorDlg(Strings.Unhandled_error_occured_in_ + Origin + Environment.NewLine + Message + Environment.NewLine + e.ToString() + Environment.NewLine + e.InnerException.ToString());
dlg.ShowDialog();
return dlg.returnvalue;
}
}
}
@@ -1,7 +1,7 @@
///
/// Copyright (c) 2013-2015 Sensus Slovensko a.s.
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
namespace TBF.UI.Help
namespace TBF.Forms
{
partial class AboutDlg
{
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2015 Sensus Slovensko a.s.
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
@@ -11,7 +11,7 @@ using System.Security.Cryptography;
using System.Windows.Forms;
using TBF.Resources;
namespace TBF.UI.Help
namespace TBF.Forms
{
/// <summary>
/// About dialog
@@ -1,4 +1,4 @@
namespace TBF.UI.Shared
namespace TBF.Forms
{
partial class ClosingTbfForm
{
@@ -5,7 +5,7 @@ using System;
using System.Windows.Forms;
using TBF.Resources;
namespace TBF.UI.Shared
namespace TBF.Forms
{
public partial class ClosingTbfForm : Form
{
@@ -1,7 +1,7 @@
///
/// Copyright (c) 2013-2015 Sensus Slovensko a.s.
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
namespace TBF.UI.Settings
namespace TBF.Forms
{
partial class DatabaseSettingsDlg
{
@@ -1,14 +1,14 @@
///
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
/// Copyright (c) 2013-2019 Sensus Metering Systems
///
using System;
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
using log4net;
using Results;
using TBF.Resources;
namespace TBF.UI.Settings
namespace TBF.Forms
{
/// <summary>
/// Dialog to process test bench name and database settings (BenchSettings)
@@ -224,9 +224,9 @@ namespace TBF.UI.Settings
log.ErrorFormat("Going to create an empty results database '{0}'", databaseName);
ExecuteMySqlCmd(string.Format("DROP DATABASE `{0}`;", databaseName), userName);
ExecuteMySqlCmd(string.Format("CREATE DATABASE `{0}`;", databaseName), userName);
DB.DbType = bench.WaterMetersDBSettings.DbType;
DB.ConnectionString = connectionString;
DB.CreateEmptyDB();
Results.DB.DbType = bench.WaterMetersDBSettings.DbType;
Results.DB.ConnectionString = connectionString;
Results.DB.CreateEmptyDB();
log.ErrorFormat("An empty results database '{0}' was created", databaseName);
MessageBox.Show(Strings.DB_was_successfully_created, Strings.Notification);
@@ -312,12 +312,12 @@ namespace TBF.UI.Settings
}
}
Shared.ModelessActivityForm form;
TBF.Forms.ModelessActivityForm form;
System.Threading.Thread formThread;
///
void DBImportMessageStart(string message)
{
form = new Shared.ModelessActivityForm()
form = new TBF.Forms.ModelessActivityForm()
{
Message = message,
FontFamily = "Arial",
@@ -393,7 +393,7 @@ namespace TBF.UI.Settings
/// <param name="databaseToBeUsed">Database name</param>
void ExecuteMySqlCmd(string command, string userName, string databaseToBeUsed)
{
System.Diagnostics.Process proc = new System.Diagnostics.Process();
Process proc = new Process();
proc.StartInfo.FileName = @"C:\xampp\mysql\bin\mysql.exe";
if (string.IsNullOrEmpty(databaseToBeUsed))
@@ -412,7 +412,7 @@ namespace TBF.UI.Settings
proc.Start();
proc.StandardInput.WriteLine(command);
System.Diagnostics.Debug.WriteLine(command);
Debug.WriteLine(command);
log.Warn(command);
proc.StandardInput.WriteLine("exit");
proc.WaitForExit();
@@ -1,12 +1,12 @@
///
/// Copyright (c) 2013-2015 Senus Slovensko a.s.
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
using System.Drawing;
using System.Windows.Forms;
using TBF.Resources;
namespace TBF.UI.Shared
namespace TBF.Forms
{
public partial class EmergencyStopForm : Form
{
@@ -1,7 +1,7 @@
///
/// Copyright (c) 2013-2015 Senus Slovensko a.s.
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
namespace TBF.UI.Shared
namespace TBF.Forms
{
partial class EmergencyStopForm
{
@@ -1,7 +1,7 @@
///
/// Copyright (c) 2013-2015 Senus Slovensko a.s.
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
namespace TBF.UI.Shared
namespace TBF.Forms
{
partial class ErrorDlg
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2015 Senus Slovensko a.s.
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
@@ -10,9 +10,10 @@ using System.Linq;
using System.Text;
using System.Windows.Forms;
using TBF;
using TBF.ErrorHandler;
using TBF.Resources;
namespace TBF.UI.Shared
namespace TBF.Forms
{
public partial class ErrorDlg : Form
{
@@ -8,7 +8,7 @@ using GemCard;
using System.Drawing;
namespace TBF.UI.Shared
namespace TBF.Forms
{
/// <summary>
/// Provides login dialog that includes test bench selection.
@@ -178,7 +178,7 @@ namespace TBF.UI.Shared
alias = userNameTextBox.Text;
password = passwordTextBox.Text;
benchName = testBenchComboBox.SelectedItem.ToString();
if (legalizatorComboBox.Visible && legalizatorComboBox.Enabled)
if (legalizatorComboBox.Enabled)
{
legalizator = legalizatorComboBox.Text;
Program.LocalSettings.UpdateHistory(legalizator, ref Program.LocalSettings.LastLegalizators);
@@ -1,7 +1,7 @@
///
/// Copyright (c) 2013-2016 Senus Slovensko a.s.
/// Copyright (c) 2013-2016 Sensus Metering Systems
///
namespace TBF.UI.Shared
namespace TBF.Forms
{
partial class LoginDlgWithBenchSelection
{
@@ -49,7 +49,6 @@ namespace TBF.UI.Shared
resources.ApplyResources(this.aliasLabel, "aliasLabel");
this.aliasLabel.ImageKey = global::TBF.Resources.Strings.Closing_the_tank;
this.aliasLabel.Name = "aliasLabel";
this.aliasLabel.Click += new System.EventHandler(this.aliasLabel_Click);
//
// passwordLabel
//
@@ -330,9 +330,6 @@
<data name="legalizatorComboBox.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Right</value>
</data>
<data name="legalizatorComboBox.Enabled" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<data name="legalizatorComboBox.Location" type="System.Drawing.Point, System.Drawing">
<value>148, 95</value>
</data>
@@ -3,7 +3,7 @@ using System.Drawing;
using System.Windows.Forms;
using TBF.UiBridge;
namespace TBF.UI.Shared
namespace TBF.Forms
{
public partial class ModelessActivityForm : Form
{
@@ -40,30 +40,11 @@ namespace TBF.UI.Shared
InitializeComponent();
ControlBox = false;
CloseFormHandler += HandleCloseFormCommand;
}
private void ModelessActivityForm_FormClosing(object sender, FormClosingEventArgs e)
{
CloseFormHandler -= HandleCloseFormCommand;
}
void HandleCloseFormCommand(object sender, EventArgs args)
{
if (InvokeRequired)
CloseFormHandler += delegate(object sender, EventArgs args)
{
Invoke(new EventHandler<EventArgs>(OnCloseForm), sender, args);
}
else
{
OnCloseForm(sender, args);
}
}
void OnCloseForm(object sender, EventArgs args)
{
DialogResult = DialogResult.Cancel;
Close();
if (InvokeRequired) { Invoke(new EventHandler<EventArgs>(OnCloseForm), sender, args); }
else OnCloseForm(sender, args);
};
}
private void ModelessForm_Load(object sender, EventArgs e)
@@ -98,5 +79,11 @@ namespace TBF.UI.Shared
{
activityStatusLabel.Text = args.Activity;
}
void OnCloseForm(object sender, EventArgs args)
{
DialogResult = DialogResult.Cancel;
Close();
}
}
}
@@ -1,4 +1,4 @@
namespace TBF.UI.Shared
namespace TBF.Forms
{
partial class ModelessActivityForm
{
@@ -60,7 +60,6 @@
this.MinimizeBox = false;
this.Name = "ModelessActivityForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ModelessActivityForm_FormClosing);
this.Load += new System.EventHandler(this.ModelessForm_Load);
this.ResumeLayout(false);
this.PerformLayout();
@@ -1,7 +1,7 @@
///
/// Copyright (c) 2013-2015 Senus Slovensko a.s.
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
namespace TBF.UI.Shared
namespace TBF.Forms
{
partial class NoBenchOrDatabaseDlg
{
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2015 Senus Slovensko a.s.
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
@@ -11,7 +11,7 @@ using System.Text;
using System.Windows.Forms;
using TBF.Resources;
namespace TBF.UI.Shared
namespace TBF.Forms
{
public partial class NoBenchOrDatabaseDlg : Form
{
@@ -1,4 +1,4 @@
namespace TBF.UI.Results
namespace TBF.Forms
{
partial class PreviousResultCtrl
{
@@ -1,11 +1,11 @@
///
/// Copyright (c) 2016-2017 Sensus Slovensko a.s.
/// Copyright (c) 2016-2017 Sensus Metering Systems
///
using System;
using System.Windows.Forms;
using TBF.Resources;
namespace TBF.UI.Results
namespace TBF.Forms
{
public partial class PreviousResultCtrl : UserControl
{
@@ -1,6 +1,6 @@
using System;
namespace TBF.UI.Results
namespace TBF.Forms
{
public class PreviousResultIdEventArgs : EventArgs
{
@@ -1,4 +1,4 @@
namespace TBF.UI.Results
namespace TBF.Forms
{
partial class PreviousResultsDlg
{
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2016-2017 Sensus Slovensko a.s.
/// Copyright (c) 2016-2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
@@ -7,10 +7,11 @@ using System.Windows.Forms;
using Results.Entities;
using NHibernate;
using log4net;
using Results;
using TBF.Resources;
using TBF.BenchControl.Output.DB.SensusOracle;
using Oracle.DataAccess.Client;
namespace TBF.UI.Results
namespace TBF.Forms
{
public enum PreviousResultsMode
{
@@ -60,7 +61,7 @@ namespace TBF.UI.Results
{
Localize();
session = DB.CreateSession();
session = Results.DB.CreateSession();
lastDisplayedBatchNr = currentBatchNr - 1;
DrawBatches(lastDisplayedBatchNr - LinesCount + 1, lastDisplayedBatchNr);
@@ -212,7 +213,7 @@ namespace TBF.UI.Results
}
foreach (var wm in b.WaterMeters)
{
new global::Results.Output.Printers.Munich.MunichPrintDocument(docVersion, wm, Config.Entities.PageOrientation.Portrait).Print();
new Results.Output.Printers.Munich.MunichPrintDocument(docVersion, wm, Config.Entities.PageOrientation.Portrait).Print();
}
#endif
}
@@ -244,33 +245,33 @@ namespace TBF.UI.Results
}
/// Prepare result items
IList<WMeterRsltItemSpec> items = null;
IList<Results.WMeterRsltItemSpec> items = null;
foreach (var wm in b.WaterMeters)
{
if (wm != null)
{
if (wm.WaterMeterData.Compound)
{
items = WMeterRsltItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Screen_CombinedWM);
items = Results.WMeterRsltItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Screen_CombinedWM);
}
else if (wm.WaterMeterData.HeatMeter)
{
items = WMeterRsltItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Screen_HeatM);
items = Results.WMeterRsltItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Screen_HeatM);
}
else
{
items = WMeterRsltItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Screen_SingleWM);
items = Results.WMeterRsltItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Screen_SingleWM);
}
break;
}
}
if (items == null) items = new List<WMeterRsltItemSpec>();
if (items == null) items = new List<Results.WMeterRsltItemSpec>();
/// Show dialog with results
global::Results.Forms.BatchResultsDlg dlg = new global::Results.Forms.BatchResultsDlg
Results.Forms.BatchResultsDlg dlg = new Results.Forms.BatchResultsDlg
{
Text = string.Format(Strings.Results_of_batch_0, b.BatchNr),
Results = BatchResults.FromBatch(b),
Results = Results.BatchResults.FromBatch(b),
Items = items,
PopupResultsLeft = Program.LocalSettings.PopupResultsLeft,
PopupResultsTop = Program.LocalSettings.PopupResultsTop,
@@ -1,7 +1,7 @@
///
/// Copyright (c) 2013-2015 Senus Slovensko a.s.
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
namespace TBF.UI.Shared
namespace TBF.Forms
{
partial class PrintOrderForm
{
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2015 Senus Slovensko a.s.
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
@@ -11,7 +11,7 @@ using System.Text;
using System.Windows.Forms;
using TBF.Resources;
namespace TBF.UI.Shared
namespace TBF.Forms
{
public partial class PrintOrderForm : Form
{
@@ -1,4 +1,4 @@
namespace TBF.UI.Shared
namespace TBF.Forms
{
partial class RemarkDlg
{
@@ -2,7 +2,7 @@
using System.Windows.Forms;
using TBF.Resources;
namespace TBF.UI.Shared
namespace TBF.Forms
{
public partial class RemarkDlg : Form
{
@@ -1,7 +1,7 @@
///
/// Copyright (c) 2013-2015 Sensus Slovensko a.s.
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
namespace TBF.UI.Results
namespace TBF.Forms
{
partial class ResultsArrangementDlg
{
@@ -47,7 +47,7 @@ namespace TBF.UI.Results
this.okButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.unlockButton = new System.Windows.Forms.Button();
this.resultsConfigCtrl = new global::Results.Forms.ResultsConfigCtrl();
this.resultsConfigCtrl = new Results.Forms.ResultsConfigCtrl();
this.testsArangementGroupBox.SuspendLayout();
this.metersArangementGroupBox.SuspendLayout();
this.SuspendLayout();
@@ -271,7 +271,7 @@ namespace TBF.UI.Results
private System.Windows.Forms.Button unlockButton;
private System.Windows.Forms.TextBox nrMetersTextBox;
private System.Windows.Forms.Label nrMetersLabel;
private global::Results.Forms.ResultsConfigCtrl resultsConfigCtrl;
private Results.Forms.ResultsConfigCtrl resultsConfigCtrl;
private System.Windows.Forms.TextBox minHeightTextBox;
private System.Windows.Forms.Label minHeightLabel;
private System.Windows.Forms.TextBox minWidthTextBox;

Some files were not shown because too many files have changed in this diff Show More