Compare commits

...
102 changed files with 5787 additions and 991 deletions
+4 -2
View File
@@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
<DefineConstants>TRACE;DEBUG;DEWA_300</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;MUNICH</DefineConstants>
<DefineConstants>TRACE;DEWA_300</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
@@ -87,6 +87,7 @@
<Compile Include="Entities\Test.cs" />
<Compile Include="Entities\TransitionSequence.cs" />
<Compile Include="Entities\TransitionStep.cs" />
<Compile Include="Entities\Uncertainty.cs" />
<Compile Include="Entities\User.cs" />
<Compile Include="Entities\VirtualBenchSequence.cs" />
<Compile Include="Entities\VirtualBenchStep.cs" />
@@ -108,6 +109,7 @@
<Compile Include="Mappings\TestMap.cs" />
<Compile Include="Mappings\TransitionSequenceMap.cs" />
<Compile Include="Mappings\TransitionStepMap.cs" />
<Compile Include="Mappings\UncertaintyMap.cs" />
<Compile Include="Mappings\UserMap.cs" />
<Compile Include="Mappings\VirtualBenchSequenceMap.cs" />
<Compile Include="Mappings\VirtualBenchStepMap.cs" />
+5 -1
View File
@@ -110,5 +110,9 @@ namespace Config
/// Database related: This object reference is set after a successful user login
///
public static DatabaseSettings CurrentBench;
}
public static double RealDensity = 0; /// true water density [kg/m3]
public static double AtTemperature = 0; /// measured at temperature [°C]
public static double Buoyancy = 0;
}
}
+3 -2
View File
@@ -1,9 +1,8 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
namespace Config.Entities
@@ -19,6 +18,7 @@ namespace Config.Entities
public virtual LogLevel Logging { get; set; }
public virtual string Parameters { get; set; }
public virtual IList<MeasurementCorrection> Corrections { get; set; }
public virtual IList<Uncertainty> Uncertainties { get; set; }
/// ------------- Additional stuff not mapped into the database -------------
@@ -27,6 +27,7 @@ namespace Config.Entities
Name = string.Empty;
ClassName = string.Empty;
Corrections = new List<MeasurementCorrection>();
Uncertainties = new List<Uncertainty>();
}
public static Component CreateFromCfg(string name, string className, string parentName, int itemNr,
+20
View File
@@ -0,0 +1,20 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
namespace Config.Entities
{
public class Uncertainty
{
public virtual int Id { get; protected set; }
public virtual float Measurement { get; set; }
public virtual float MainUncertainty { get; set; }
public virtual float Resolution { get; set; }
public virtual float DriftPerYr { get; set; }
public virtual float Conditions { get; set; }
public virtual float UncertaintyOfCorrection { get; set; }
public Uncertainty() { }
}
}
+20 -17
View File
@@ -11,14 +11,23 @@ namespace Config
{
private static readonly ILog log = LogManager.GetLogger(typeof(Formulas));
///
/// Tables to calculate specific enthalpy
///
private static readonly int[] Ii;
private static readonly int[] Ji;
private static readonly double[] ni;
private static readonly double[] Di;
///
/// Wrappers
///
public static double RealDensity() { return Data.RealDensity; }
public static double AtTemperature() { return Data.AtTemperature; }
public static double Buoyancy() { return Data.Buoyancy; }
/// Private tables with coeficients to calculate specific enthalpy
static readonly int[] Ii;
static readonly int[] Ji;
static readonly double[] ni;
/// Private table with coeficients to calculate temperature of a platinum thermometer
static readonly double[] Di;
/// <summary>
/// Constructor
@@ -153,9 +162,9 @@ namespace Config
/// </summary>
/// <param name="t">Temperature in [°C]</param>
/// <returns>Density in [kg/m3]</returns>
public static double WaterDensityFromTemp(double t, double realDensity, double atTemperature)
public static double WaterDensityFromTemp(double t)
{
return DistilledWaterDensityFromTemp(t) + DensityCorrection(realDensity, atTemperature);
return DistilledWaterDensityFromTemp(t) + DensityCorrection(RealDensity(), AtTemperature());
}
/// <summary>
@@ -163,7 +172,7 @@ namespace Config
/// </summary>
/// <param name="t">Temperature in [°C]</param>
/// <returns>Density in [kg/m3]</returns>
public static double WaterDensityFromTempPress(double temp, double pressure, double realDensity, double atTemperature)
public static double WaterDensityFromTempPress(double temp, double pressure)
{
double x0 = 5.08821E-10;
double x1 = 1.2639418;
@@ -173,7 +182,7 @@ namespace Config
double theta = temp / 100.0;
double B = x0 * (((x3 * theta + x2) * theta + x1) * theta + 1) / (1 + x4 * theta);
return WaterDensityFromTemp(temp, realDensity, atTemperature) * (1 + B * Config.Units.ConvertTo(Config.Unit.Pa, pressure));
return WaterDensityFromTemp(temp) * (1 + B * Config.Units.ConvertTo(Config.Unit.Pa, pressure));
}
@@ -394,11 +403,5 @@ namespace Config
return (-(R0 * A) + Math.Sqrt(R0 * R0 * A * A - 4 * R0 * B * (R0 - R))) / (2 * R0 * B);
}
public static double Buoyancy()
{
return 1.00103;
}
}
}
+5 -2
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
///
using FluentNHibernate.Mapping;
using Config.Entities;
@@ -23,6 +23,9 @@ namespace Config.Mappings
HasMany(x => x.Corrections)
.OrderBy("Measurement")
.Cascade.All();
}
HasMany(x => x.Uncertainties)
.OrderBy("Measurement")
.Cascade.All();
}
}
}
+22
View File
@@ -0,0 +1,22 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using FluentNHibernate.Mapping;
using Config.Entities;
namespace Config.Mappings
{
class UncertaintyMap : ClassMap<Uncertainty>
{
public UncertaintyMap()
{
Id(x => x.Id);
Map(x => x.Measurement);
Map(x => x.MainUncertainty);
Map(x => x.Resolution);
Map(x => x.DriftPerYr);
Map(x => x.Conditions);
Map(x => x.UncertaintyOfCorrection);
}
}
}
+2
View File
@@ -16,6 +16,8 @@ namespace Config.Mappings
Map(x => x.Tag);
#endif
Map(x => x.Password);
Map(x => x.Password2);
Map(x => x.Password3);
Map(x => x.FullName).Column("Description");
Map(x => x.LastPwChange);
HasMany(x => x.Groups)
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.18.1273.0")]
[assembly: AssemblyFileVersion("2.18.1273.0")]
[assembly: AssemblyVersion("2.24.1315.0")]
[assembly: AssemblyFileVersion("2.24.1315.0")]
+11 -1
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015 Sensus Metering Systems
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using FluentNHibernate.Mapping;
using Results.Entities;
@@ -26,6 +26,16 @@ namespace Results.Mappings
.Column("Custom1"); ;
Map(x => x.Custom2);
Map(x => x.Custom3);
Map(x => x.Counter1);
Map(x => x.Counter2);
Map(x => x.Counter3);
Map(x => x.Counter4);
Map(x => x.Counter5);
Map(x => x.Counter6);
Map(x => x.Counter7);
Map(x => x.Counter8);
Map(x => x.Counter9);
Map(x => x.Counter10);
Map(x => x.StartTime);
Map(x => x.EndTime);
Map(x => x.Dirty);
+2 -1
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015 Sensus Metering Systems
/// Copyright (c) 2015-2018 Sensus Slovensko a.s.
///
using FluentNHibernate.Mapping;
using Results.Entities;
@@ -12,6 +12,7 @@ namespace Results.Mappings
{
Id(x => x.Id);
Map(x => x.CompoundMeterId);
Map(x => x.RegReaderType);
Map(x => x.PulsesMeter);
Map(x => x.PulsesMaster);
Map(x => x.PulsesPerLiter);
+7 -2
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015-2018 Sensus Slovensko a.s.
/// Copyright (c) 2015-2019 Sensus Slovensko a.s.
///
using FluentNHibernate.Mapping;
using Results.Entities;
@@ -16,6 +16,7 @@ namespace Results.Mappings
References<Components>(x => x.Components);
Map(x => x.Part);
Map(x => x.RepetitionNr);
Map(x => x.MethodClass);
Map(x => x.TestDone);
Map(x => x.Remark)
@@ -24,9 +25,13 @@ namespace Results.Mappings
Map(x => x.StartTime);
Map(x => x.EndTime);
Map(x => x.FlowSetTime);
Map(x => x.TimeBtwnMassMsrmnts);
Map(x => x.TestTime);
Map(x => x.TestTimeCorrection);
Map(x => x.PulsesMaster);
Map(x => x.ConstMaster);
Map(x => x.ConstMasterRaw);
Map(x => x.ConstMasterCorr);
Map(x => x.ConstMaster);
Map(x => x.MassStartRaw);
Map(x => x.MassStart);
Map(x => x.MassEndRaw);
+2
View File
@@ -42,6 +42,8 @@ namespace Results.Mappings
Map(x => x.MetrologicalClassAux);
Map(x => x.ApprovalInfoAux);
Map(x => x.Medium);
Map(x => x.Text1);
Map(x => x.Text2);
Map(x => x.Text3);
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.18.1290.0")]
[assembly: AssemblyFileVersion("2.18.1290.0")]
[assembly: AssemblyVersion("2.24.1315.0")]
[assembly: AssemblyFileVersion("2.24.1315.0")]
+2 -2
View File
@@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
<DefineConstants>TRACE;DEBUG;DEWA_300</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;MUNICH</DefineConstants>
<DefineConstants>TRACE;DEWA_300</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
+4 -2
View File
@@ -44,8 +44,10 @@ namespace Results
}
public static double RealDensity;
public static double AtTemperature;
/// This is to show RealDensity and AtTemperatire in reports.
public static double RealDensity; /// true water density [kg/m3]
public static double AtTemperature; /// measured at temperature [°C]
public static double Buoyancy;
///
+2 -2
View File
@@ -21,7 +21,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
<DefineConstants>TRACE;DEBUG;DEWA_300</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;MUNICH</DefineConstants>
<DefineConstants>TRACE;DEWA_300</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
@@ -1,47 +0,0 @@
///
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using log4net;
using Config.Entities;
using TBF.BenchControl;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.BenchInfo.Munich
{
/// <summary>
/// Holds information identifying the test bench.
/// </summary>
public class Component : ComponentBase, GenericDevices.IBenchInfo
{
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
public override string ToString() { return string.Format("BenchInfo({0})", Cfg.ToString(1)); }
readonly ComponentCfg benchInfoCfg;
public string TestBenchName { get { return benchInfoCfg.TestBenchName; } }
public int TestBenchId { get { return benchInfoCfg.TestBenchId; } }
public string Address1 { get { return string.Empty; } }
public string Address2 { get { return string.Empty; } }
public string Address3 { get { return string.Empty; } }
public string Address4 { get { return string.Empty; } }
public string Address5 { get { return string.Empty; } }
public RemoteDBUse RemoteDBUse { get { return RemoteDBUse.LocalDBOnly; } }
#if ORACLE_DB
public int MaxTestIndex { get { return 0; } }
#endif
public Component()
{
}
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
benchInfoCfg = cfg as ComponentCfg;
log.Debug(this.ToString());
}
}
}
@@ -1,48 +0,0 @@
///
/// Copyright (c) 2013-2016 Sensus Metering Systems
/// Author: Milan Hanajík
///
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.BenchInfo.Munich
{
/// <summary>
/// Holds information identifying the test bench - serializable configuration.
/// </summary>
public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ComponentCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new ComponentCfgCtrl(); }
///
/// Serialized parameters
///
public string TestBenchName;
public int TestBenchId;
/// Private parameterless constructor invoked by all other (public) constructors
ComponentCfg()
{
Name = "BenchInfo";
ParentName = string.Empty;
TestBenchName = "1";
TestBenchId = 1;
}
public ComponentCfg(IComponentFactory factory)
: this()
{
this.Factory = factory;
}
public string ToString(int i)
{
return string.Format("Name={0}, Bench name={1}, Bench Id={2}", Name, TestBenchName, TestBenchId);
}
}
}
@@ -1,88 +0,0 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
/// Author: Milan Hanajík
///
using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.Resources;
namespace TBF.BenchControl.BenchInfo.Munich
{
public partial class ComponentCfgCtrl : UserControl, IComponentCfgCtrl
{
public bool ShowMore { get { return false; } }
ComponentCfg config;
public IComponentCfg Config
{
get { return config as IComponentCfg; }
set
{
config = value as ComponentCfg;
Redraw();
}
}
public ComponentCfgCtrl()
{
InitializeComponent();
}
private void EntryFormCfgCtrl_Load(object sender, EventArgs e)
{
nameLabel.Text = Strings.Name;
benchNameLabel.Text = Strings.Test_bench_name;
benchIdLabel.Text = Strings.Test_bench_number;
Redraw();
}
public void Closing()
{
}
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
classNameLabel.Text = config.Factory.ClassName;
nameTextBox.Text = config.Name;
benchNameTextBox.Text = config.TestBenchName;
benchIdTextBox.Text = config.TestBenchId.ToString();
}
public void Unlock()
{
nameTextBox.Enabled = true;
benchNameTextBox.Enabled = true;
benchIdTextBox.Enabled = true;
}
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.None;
int dummy;
if (!int.TryParse(benchIdTextBox.Text, out dummy) || dummy < 0)
{
flags = CfgUpdateFlags.Error;
message = string.Format("Invalid {0} parameter", Strings.Test_bench_number);
}
return flags;
}
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
///
config.Name = nameTextBox.Text;
config.TestBenchName = benchNameTextBox.Text;
config.TestBenchId = int.Parse(benchIdTextBox.Text);
return flags;
}
}
}
@@ -1,132 +0,0 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
namespace TBF.BenchControl.BenchInfo.Munich
{
partial class ComponentCfgCtrl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.classNameLabel = new System.Windows.Forms.Label();
this.benchNameLabel = new System.Windows.Forms.Label();
this.benchNameTextBox = new System.Windows.Forms.TextBox();
this.benchIdTextBox = new System.Windows.Forms.TextBox();
this.benchIdLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(140, 55);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
this.nameTextBox.TabIndex = 5;
//
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(25, 58);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 4;
this.nameLabel.Text = "Name";
//
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(137, 31);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(60, 13);
this.classNameLabel.TabIndex = 3;
this.classNameLabel.Text = "ClassName";
//
// benchNameLabel
//
this.benchNameLabel.AutoSize = true;
this.benchNameLabel.Location = new System.Drawing.Point(25, 84);
this.benchNameLabel.Name = "benchNameLabel";
this.benchNameLabel.Size = new System.Drawing.Size(90, 13);
this.benchNameLabel.TabIndex = 6;
this.benchNameLabel.Text = "Test bench name";
//
// benchNameTextBox
//
this.benchNameTextBox.Enabled = false;
this.benchNameTextBox.Location = new System.Drawing.Point(140, 81);
this.benchNameTextBox.Name = "benchNameTextBox";
this.benchNameTextBox.Size = new System.Drawing.Size(67, 20);
this.benchNameTextBox.TabIndex = 7;
//
// benchIdTextBox
//
this.benchIdTextBox.Enabled = false;
this.benchIdTextBox.Location = new System.Drawing.Point(140, 107);
this.benchIdTextBox.Name = "benchIdTextBox";
this.benchIdTextBox.Size = new System.Drawing.Size(67, 20);
this.benchIdTextBox.TabIndex = 9;
//
// benchIdLabel
//
this.benchIdLabel.AutoSize = true;
this.benchIdLabel.Location = new System.Drawing.Point(25, 110);
this.benchIdLabel.Name = "benchIdLabel";
this.benchIdLabel.Size = new System.Drawing.Size(99, 13);
this.benchIdLabel.TabIndex = 8;
this.benchIdLabel.Text = "Test bench number";
//
// ComponentCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.benchIdTextBox);
this.Controls.Add(this.benchIdLabel);
this.Controls.Add(this.benchNameTextBox);
this.Controls.Add(this.benchNameLabel);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
this.Name = "ComponentCfgCtrl";
this.Size = new System.Drawing.Size(300, 200);
this.Load += new System.EventHandler(this.EntryFormCfgCtrl_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox nameTextBox;
private System.Windows.Forms.Label nameLabel;
private System.Windows.Forms.Label classNameLabel;
private System.Windows.Forms.Label benchNameLabel;
private System.Windows.Forms.TextBox benchNameTextBox;
private System.Windows.Forms.TextBox benchIdTextBox;
private System.Windows.Forms.Label benchIdLabel;
}
}
+8 -1
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -20,12 +20,19 @@ namespace TBF.BenchControl
public int ItemNr { get { return cfg.ItemNr; } }
public DebugMode DebugLevel { get { return cfg.DebugLevel; } set { cfg.DebugLevel = value; } }
public LogLevel LogLevel { get { return cfg.LogLevel; } }
public IList<MeasurementCorrection> Corrections
{
get { return cfg.Corrections; }
set { cfg.Corrections = value; }
}
public IList<Uncertainty> Uncertainties
{
get { return cfg.Uncertainties; }
set { cfg.Uncertainties = value; }
}
/// Constructor, components created in this way is used by
/// IComponentFactory.DummyComponent() function. Such dummy component should be used
+12 -2
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -68,6 +68,15 @@ namespace TBF.BenchControl
}
IList<MeasurementCorrection> corrections;
[XmlIgnore]
public IList<Uncertainty> Uncertainties
{
get { return uncertainties; }
set { uncertainties = value; }
}
IList<Uncertainty> uncertainties;
protected ComponentCfgBase()
{
itemNr = 0;
@@ -118,7 +127,8 @@ namespace TBF.BenchControl
config.DebugLevel = cmpntEntity.Mode;
config.LogLevel = cmpntEntity.Logging;
config.Corrections = cmpntEntity.Corrections;
config.Factory = factory;
config.Uncertainties = cmpntEntity.Uncertainties;
config.Factory = factory;
}
return config;
}
@@ -2,18 +2,17 @@
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using Users;
using log4net;
namespace TBF.BenchControl.BackupAndSecurity.Default
namespace TBF.BenchControl.DataContainers.BackupAndSecurityOptions
{
/// <summary>
/// Holds backup and security options.
/// </summary>
public class Component : ComponentBase, GenericDevices.IBackupAndSecurity
public class Component : ComponentBase
{
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
public override string ToString() { return string.Format("BackupAndSecurity.Default({0})", Cfg.ToString(1)); }
public override string ToString() { return string.Format("{0}({1})", this.GetType().Namespace.Substring(32), Cfg.ToString(1)); }
readonly ComponentCfg myCfg;
@@ -29,8 +28,8 @@ namespace TBF.BenchControl.BackupAndSecurity.Default
{
myCfg = cfg as ComponentCfg;
GlobalData.MinPasswdLength = myCfg.MinPasswdLength;
GlobalData.PasswdExpirationPeriodDays = myCfg.PasswdExpirationPeriodDays;
Users.GlobalData.MinPasswdLength = myCfg.MinPasswdLength;
Users.GlobalData.PasswdExpirationPeriodDays = myCfg.PasswdExpirationPeriodDays;
log.Debug(this.ToString());
}
@@ -7,7 +7,7 @@ using System.Xml.Serialization;
using Config.Entities;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.BackupAndSecurity.Default
namespace TBF.BenchControl.DataContainers.BackupAndSecurityOptions
{
/// <summary>
/// Holds backup and security options - serializable configuration.
@@ -4,7 +4,7 @@
using System.Collections.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.BackupAndSecurity.Default
namespace TBF.BenchControl.DataContainers.BackupAndSecurityOptions
{
public class ComponentFactory : IComponentFactory
{
@@ -9,7 +9,7 @@ using Config.Entities;
using TBF.BenchControl;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.BenchInfo.Extended
namespace TBF.BenchControl.DataContainers.BenchInfo.Extended
{
/// <summary>
/// Holds information identifying the test bench.
@@ -7,7 +7,7 @@ using System.Xml.Serialization;
using Config.Entities;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.BenchInfo.Extended
namespace TBF.BenchControl.DataContainers.BenchInfo.Extended
{
/// <summary>
/// Holds information identifying the test bench - serializable configuration.
@@ -4,7 +4,7 @@
using System.Collections.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.BenchInfo.Extended
namespace TBF.BenchControl.DataContainers.BenchInfo.Extended
{
public class ComponentFactory : IComponentFactory
{
@@ -9,7 +9,7 @@ using Config.Entities;
using TBF.BenchControl;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.BenchInfo.iPerl
namespace TBF.BenchControl.DataContainers.BenchInfo.iPerl
{
/// <summary>
/// Holds information identifying the test bench.
@@ -8,7 +8,7 @@ using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.Resources;
namespace TBF.BenchControl.BenchInfo.iPerl
namespace TBF.BenchControl.DataContainers.BenchInfo.iPerl
{
/// <summary>
/// Holds information identifying the test bench - serializable configuration.
@@ -4,7 +4,7 @@
using System.Collections.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.BenchInfo.iPerl
namespace TBF.BenchControl.DataContainers.BenchInfo.iPerl
{
public class ComponentFactory : IComponentFactory
{
@@ -0,0 +1,39 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using log4net;
namespace TBF.BenchControl.DataContainers.Buoyancy
{
/// <summary>
/// Holds measured (true) buoyancy value.
/// </summary>
public class Component : ComponentBase
{
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
public override string ToString() { return string.Format("{0}({1})", this.GetType().Namespace.Substring(32), Cfg.ToString(1)); }
readonly ComponentCfg myCfg;
public double Buoyancy { get { return myCfg.Buoyancy; } }
public Component()
{
}
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
myCfg = cfg as ComponentCfg;
/// This is to use data in formulas
Config.Data.Buoyancy = Buoyancy;
/// This is to have data in reports
Results.WMeterRsltItemSpec.Buoyancy = Buoyancy;
log.Debug(this.ToString());
}
}
}
@@ -0,0 +1,118 @@
///
/// 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.DataContainers.Buoyancy
{
/// <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 double Buoyancy;
/// Private parameterless constructor invoked by all other (public) constructors
ComponentCfg() {}
public ComponentCfg(string name, IComponentFactory factory)
: this()
{
Name = name;
Factory = factory;
ParentName = string.Empty;
InitializeAll();
}
public string ComponentName { get { return Name; } }
public void InitializeAll()
{
Buoyancy = 1.00103;
}
string[] paramNames = new string[]
{
"Buoyancy",
};
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}: Buoyancy = {1}", Name, Buoyancy);
}
switch (i)
{
case 0: return Buoyancy.ToString();
default: return string.Empty;
}
}
public CfgUpdateFlags UpdateParam(int i, string strValue)
{
switch (i)
{
case 0: Buoyancy = Utils.ParseUDouble(strValue); return CfgUpdateFlags.RestartRqrd;
default: return CfgUpdateFlags.None;
}
}
public bool ValidateParam(int i, string strValue, out string message)
{
message = string.Empty;
double dummy;
switch (i)
{
case 0:
/// Real number between 0.8 and 1.2 expected
if (Utils.TryParseUDouble(strValue, out dummy) && (dummy >= 0.8) && (dummy <= 1.2)) return true;
break;
default:
message = "Invalid index";
return false;
}
message = ParamName(i) + " is invalid";
return false;
}
void CopyContentTo(ComponentCfg prms)
{
prms.Buoyancy = this.Buoyancy;
}
public Config.Entities.IParamsProvider Clone()
{
ComponentCfg pars = new ComponentCfg();
CopyContentTo(pars);
return pars;
}
public bool UpdateEmbeddedDbEntity()
{
return true; /// =OK, do nothing
}
}
}
@@ -0,0 +1,26 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System.Collections.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.DataContainers.Buoyancy
{
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.GetType().Namespace.Substring(32), this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(ComponentCfg.Serializer, component, this);
}
}
}
@@ -0,0 +1,42 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using log4net;
namespace TBF.BenchControl.DataContainers.Density
{
/// <summary>
/// Holds measured (true) density value.
/// </summary>
public class Component : ComponentBase
{
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
public override string ToString() { return string.Format("{0}({1})", this.GetType().Namespace.Substring(32), Cfg.ToString(1)); }
readonly ComponentCfg myCfg;
public double RealDensity { get { return myCfg.RealDensity; } }
public double AtTemperature { get { return myCfg.AtTemperature; } }
public Component()
{
}
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
myCfg = cfg as ComponentCfg;
/// This is to use data in formulas
Config.Data.RealDensity = RealDensity;
Config.Data.AtTemperature = AtTemperature;
/// This is to have data in reports
Results.WMeterRsltItemSpec.RealDensity = RealDensity;
Results.WMeterRsltItemSpec.AtTemperature = AtTemperature;
log.Debug(this.ToString());
}
}
}
@@ -0,0 +1,128 @@
///
/// 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.DataContainers.Density
{
/// <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 double RealDensity;
public double AtTemperature;
/// Private parameterless constructor invoked by all other (public) constructors
ComponentCfg() {}
public ComponentCfg(string name, IComponentFactory factory)
: this()
{
Name = name;
Factory = factory;
ParentName = string.Empty;
InitializeAll();
}
public string ComponentName { get { return Name; } }
public void InitializeAll()
{
RealDensity = 998.2008; /// kg/m3
AtTemperature = 20.0; /// °C
}
string[] paramNames = new string[]
{
"True density [kg/m3]",
"@temperature [°C]",
};
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}: True density = {1} kg/m3 measured @temperature {2} °C", Name, RealDensity, AtTemperature);
}
switch (i)
{
case 0: return RealDensity.ToString();
case 1: return AtTemperature.ToString();
default: return string.Empty;
}
}
public CfgUpdateFlags UpdateParam(int i, string strValue)
{
switch (i)
{
case 0: RealDensity = Utils.ParseUDouble(strValue); return CfgUpdateFlags.RestartRqrd;
case 1: AtTemperature = Utils.ParseUDouble(strValue); return CfgUpdateFlags.RestartRqrd;
default: return CfgUpdateFlags.None;
}
}
public bool ValidateParam(int i, string strValue, out string message)
{
message = string.Empty;
double dummy;
switch (i)
{
case 0:
/// Real number between 800 and 1200 kg/m3 expected
if (Utils.TryParseUDouble(strValue, out dummy) && (dummy >= 800) && (dummy <= 1200)) return true;
break;
case 1:
/// Real number above 0 expected
if (Utils.TryParseUDouble(strValue, out dummy) && (dummy >= 0)) return true;
break;
default:
message = "Invalid index";
return false;
}
message = ParamName(i) + " is invalid";
return false;
}
void CopyContentTo(ComponentCfg prms)
{
prms.RealDensity = this.RealDensity;
prms.AtTemperature = this.AtTemperature;
}
public Config.Entities.IParamsProvider Clone()
{
ComponentCfg pars = new ComponentCfg();
CopyContentTo(pars);
return pars;
}
public bool UpdateEmbeddedDbEntity()
{
return true; /// =OK, do nothing
}
}
}
@@ -1,15 +1,14 @@
///
/// Copyright (c) 2013-2016 Sensus Metering Systems
/// Author: Milan Hanajík
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System.Collections.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.BenchInfo.Munich
namespace TBF.BenchControl.DataContainers.Density
{
public class ComponentFactory : IComponentFactory
{
public string ClassName { get { return "Bench-ID"; } }
public string ClassName { get { return this.GetType().Namespace.Substring(17); } }
public void ResetStaticProperties() { Component.ResetStaticProperties(); }
@@ -17,11 +16,11 @@ namespace TBF.BenchControl.BenchInfo.Munich
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Component(cfg); }
public IComponentCfg DefaultConfig() { return new ComponentCfg(this); }
public IComponentCfg DefaultConfig() { return new ComponentCfg(this.GetType().Namespace.Substring(32), this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(ComponentCfg.Serializer, component, this);
return ComponentCfgBase.CreateFromDbEntity(ComponentCfg.Serializer, component, this);
}
}
}
@@ -63,8 +63,8 @@ namespace TBF.BenchControl.DataEntry.iPerl
///
/// Draw an appropriate test bench picture
///
Config.Entities.Side side = (TBF.BenchControl.Sequences.ProcessData.BenchInfo is BenchInfo.iPerl.Component)
? (TBF.BenchControl.Sequences.ProcessData.BenchInfo as BenchInfo.iPerl.Component).Side
Config.Entities.Side side = (TBF.BenchControl.Sequences.ProcessData.BenchInfo is DataContainers.BenchInfo.iPerl.Component)
? (TBF.BenchControl.Sequences.ProcessData.BenchInfo as DataContainers.BenchInfo.iPerl.Component).Side
: Config.Entities.Side.Left;
if (reversedDirection && (side == Config.Entities.Side.Left))
{
@@ -40,9 +40,9 @@ namespace TBF.BenchControl.Elde.FlowMeterDewa
refFreq[1] = refFreq[0] - refFreq[2] - refFreq[3];
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);
if (flowMeter1 != null) ltrPerPulseCorrected += refFreq[flowMeter1.Idx1] * flowMeter1.LtrPerPulseCorrected(flow * refFreq[flowMeter1.Idx1] / refFreq[0], rangeIx);
if (flowMeter2 != null) ltrPerPulseCorrected += refFreq[flowMeter2.Idx1] * flowMeter2.LtrPerPulseCorrected(flow * refFreq[flowMeter2.Idx1] / refFreq[0], rangeIx);
if (flowMeter3 != null) ltrPerPulseCorrected += refFreq[flowMeter3.Idx1] * flowMeter3.LtrPerPulseCorrected(flow * refFreq[flowMeter3.Idx1] / refFreq[0], rangeIx);
return ltrPerPulseCorrected / refFreq[0];
}
+3 -1
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
///
using System.Collections.Generic;
@@ -21,6 +21,8 @@ namespace TBF.BenchControl.Generic
IList<Config.Entities.MeasurementCorrection> Corrections { get; set; }
IList<Config.Entities.Uncertainty> Uncertainties { get; set; }
void StartChangeHandler();
void StopChangeHandler();
@@ -43,6 +43,11 @@ namespace TBF.BenchControl.Generic
/// </summary>
IList<Config.Entities.MeasurementCorrection> Corrections { get; set; }
/// <summary>
/// Measurement correction values
/// </summary>
IList<Config.Entities.Uncertainty> Uncertainties { get; set; }
/// <summary>
/// Creates a new database entity 'Component' from the parameters
/// </summary>
@@ -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; }
}
}
+2 -2
View File
@@ -1794,8 +1794,8 @@ namespace TBF.BenchControl.Sequences
StateMachine.Procedure,
waterMeterData,
waterMeterParts,
Formulas.DensityCorrection(Program.LocalSettings.RealDensity,
Program.LocalSettings.AtTemperature));
Formulas.DensityCorrection(Config.Formulas.RealDensity(),
Config.Formulas.AtTemperature()));
}
+7 -8
View File
@@ -7,7 +7,6 @@ namespace TBF.BenchControl.Sequences
{
public class ProcessData
{
public static IBackupAndSecurity BackupAndSecurity;
public static IBenchInfo BenchInfo;
public static IErrorFlags ErrorFlagsComp;
public static Output.DB.SensusOracle.Database OracleDB;
@@ -94,13 +93,13 @@ namespace TBF.BenchControl.Sequences
public static Statistics AmbPressStat = new Statistics(new Plotter("Ambient pressure"));
public static Statistics AmbHumiStat = new Statistics(new Plotter("Ambient humidity"));
public static Statistics TempUpStat = new Statistics(0, 7, true, new Plotter("Temperature up"));
public static Statistics TempDownStat = new Statistics(0, 7, true, new Plotter("Temperature down"));
public static Statistics TempDiffStat = new Statistics(0, 7, true);
public static Statistics TempDivStat = new Statistics(0, 7, true, new Plotter("Temperature div"));
public static Statistics PressUpStat = new Statistics(5, 7, true, new Plotter("Pressure up"));
public static Statistics PressDownStat = new Statistics(5, 7, true, new Plotter("Pressure down"));
public static Statistics PressDeltaStat = new Statistics(5, 7, true);
public static Statistics TempUpStat = new Statistics(0, 4, true, new Plotter("Temperature up"));
public static Statistics TempDownStat = new Statistics(0, 4, true, new Plotter("Temperature down"));
public static Statistics TempDiffStat = new Statistics(0, 4, true);
public static Statistics TempDivStat = new Statistics(0, 4, true, new Plotter("Temperature div"));
public static Statistics PressUpStat = new Statistics(3, 4, true, new Plotter("Pressure up"));
public static Statistics PressDownStat = new Statistics(3, 4, true, new Plotter("Pressure down"));
public static Statistics PressDeltaStat = new Statistics(3, 4, true);
public static Statistics RefFlowStat = new Statistics(5, 7, true, new Plotter("Flow"));
public static Statistics TempRefHiStat = new Statistics();
+17 -24
View File
@@ -960,17 +960,10 @@ namespace TBF.BenchControl.Sequences
tstRslt.TempDivEnd = (float)TempDivStat.Last;
tstRslt.TempDivMin = (float)TempDivStat.Min;
tstRslt.TempDivMax = (float)TempDivStat.Max;
tstRslt.DensityIn = Formulas.WaterDensityFromTempPress(tstRslt.TempUpMean,
tstRslt.PressUpMean,
Program.LocalSettings.RealDensity,
Program.LocalSettings.AtTemperature); /// [kg/m3]
tstRslt.DensityDiv = Formulas.WaterDensityFromTemp(tstRslt.TempDivMean,
Program.LocalSettings.RealDensity,
Program.LocalSettings.AtTemperature); /// [kg/m3]
tstRslt.DensityIn = Formulas.WaterDensityFromTempPress(tstRslt.TempUpMean, tstRslt.PressUpMean);
tstRslt.DensityDiv = Formulas.WaterDensityFromTempPress(tstRslt.TempDivMean, 0);
tstRslt.DensityLine = Formulas.WaterDensityFromTempPress((tstRslt.TempUpMean + tstRslt.TempDownMean) / 2,
(tstRslt.PressUpMean + tstRslt.PressDownMean) / 2,
Program.LocalSettings.RealDensity,
Program.LocalSettings.AtTemperature); /// [kg/m3]
(tstRslt.PressUpMean + tstRslt.PressDownMean) / 2);
}
@@ -1059,8 +1052,8 @@ namespace TBF.BenchControl.Sequences
sb.Append(";"); sb.Append(" "); /// BB d_air: Hustota vzduchu: Sheet1 - K9
sb.Append(";"); sb.Append(tstRslt.Buoyancy); /// BC Buoyancy: Sheet1 - X9
sb.Append(";"); sb.Append(Program.LocalSettings.RealDensity); /// BD
sb.Append(";"); sb.Append(Program.LocalSettings.AtTemperature); /// BE
sb.Append(";"); sb.Append(Config.Formulas.RealDensity()); /// BD
sb.Append(";"); sb.Append(Config.Formulas.AtTemperature()); /// BE
sb.Append(";"); sb.Append(tstRslt.FlowMax); /// BF pipe expansion: teraz vynechat
sb.Append(";"); sb.Append(tstRslt.FlowMin); /// BG [kg/h] Qm
sb.Append(";"); sb.Append(tstRslt.FlowVolume); /// BH [l/h] Qv
@@ -1300,9 +1293,9 @@ namespace TBF.BenchControl.Sequences
tstRslt.TempDownMax = 20.0f;
tstRslt.TempDivMax = 20.0f;
tstRslt.DensityIn = Program.LocalSettings.RealDensity;
tstRslt.DensityLine = Program.LocalSettings.RealDensity;
tstRslt.DensityDiv = Program.LocalSettings.RealDensity;
tstRslt.DensityIn = Config.Formulas.RealDensity();
tstRslt.DensityLine = Config.Formulas.RealDensity();
tstRslt.DensityDiv = Config.Formulas.RealDensity();
tstRslt.MethodClass = TbfComponents.FindComponent(test.Method).ClassName;
tstRslt.StartTime = DateTime.Now;
@@ -1312,7 +1305,7 @@ namespace TBF.BenchControl.Sequences
tstRslt.PulsesMaster = (outPath.FlowMeter.LtrPerPulse > 1E-6) ? (1.0075 * tstRslt.TargetVolume() / outPath.FlowMeter.LtrPerPulse) : 1;
tstRslt.MassStartRaw = 0;
tstRslt.MassStart = Config.Formulas.CorrectedValue(tstRslt.MassStartRaw, outPath.Scale.Corrections);
tstRslt.MassEndRaw = tstRslt.TargetVolume() * Program.LocalSettings.RealDensity / 1000.0f;
tstRslt.MassEndRaw = tstRslt.TargetVolume() * Config.Formulas.RealDensity() / 1000.0f;
tstRslt.MassEnd = Config.Formulas.CorrectedValue(tstRslt.MassEndRaw, outPath.Scale.Corrections);
tstRslt.FlowMass = 3600.0 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.TestTime;
tstRslt.FlowVolume = 3.6 * outPath.FlowMeter.LtrPerPulse * tstRslt.PulsesMaster / tstRslt.TestTime;
@@ -1393,11 +1386,11 @@ namespace TBF.BenchControl.Sequences
tstRslt.ConstMaster = LtrPerRefPulse;
tstRslt.MassStartRaw = 0;
tstRslt.MassStart = 0;
tstRslt.MassEndRaw = tstRslt.TargetVolume() * Program.LocalSettings.RealDensity / 1000.0f;
tstRslt.MassEndRaw = tstRslt.TargetVolume() * Config.Formulas.RealDensity() / 1000.0f;
tstRslt.MassEnd = tstRslt.MassEndRaw;
tstRslt.DensityIn = Program.LocalSettings.RealDensity;
tstRslt.DensityLine = Program.LocalSettings.RealDensity;
tstRslt.DensityDiv = Program.LocalSettings.RealDensity;
tstRslt.DensityIn = Config.Formulas.RealDensity();
tstRslt.DensityLine = Config.Formulas.RealDensity();
tstRslt.DensityDiv = Config.Formulas.RealDensity();
tstRslt.Buoyancy = Formulas.Buoyancy();
tstRslt.FlowMass = tstRslt.MassEnd / tstRslt.TargetTime();
tstRslt.FlowVolume = tstRslt.TargetVolume() / tstRslt.TargetTime();
@@ -1522,11 +1515,11 @@ namespace TBF.BenchControl.Sequences
tstRslt.ConstMaster = LtrPerRefPulse;
tstRslt.MassStartRaw = 0;
tstRslt.MassStart = 0;
tstRslt.MassEndRaw = tstRslt.TargetVolume() * Program.LocalSettings.RealDensity / 1000.0f;
tstRslt.MassEndRaw = tstRslt.TargetVolume() * Config.Formulas.RealDensity() / 1000.0f;
tstRslt.MassEnd = tstRslt.MassEndRaw;
tstRslt.DensityIn = Program.LocalSettings.RealDensity;
tstRslt.DensityLine = Program.LocalSettings.RealDensity;
tstRslt.DensityDiv = Program.LocalSettings.RealDensity;
tstRslt.DensityIn = Config.Formulas.RealDensity();
tstRslt.DensityLine = Config.Formulas.RealDensity();
tstRslt.DensityDiv = Config.Formulas.RealDensity();
tstRslt.Buoyancy = Formulas.Buoyancy();
tstRslt.FlowMass = tstRslt.MassEnd / tstRslt.TargetTime();
tstRslt.FlowVolume = tstRslt.TargetVolume() / tstRslt.TargetTime();
+1 -2
View File
@@ -228,7 +228,6 @@ 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 IErrorFlags) ProcessData.ErrorFlagsComp = cmpnt as IErrorFlags;
if ((cmpnt is Output.DB.SensusOracle.Database) && (ProcessData.OracleDB == null))
@@ -684,7 +683,7 @@ namespace TBF.BenchControl
return false;
}
if (Program.LocalSettings.RealDensity < 500.0f || Program.LocalSettings.RealDensity > 2000.0f)
if (Config.Formulas.RealDensity() < 500.0f || Config.Formulas.RealDensity() > 2000.0f)
{
errorMsg = string.Format("Density was not specified");
return false;
+5 -4
View File
@@ -15,10 +15,11 @@ namespace TBF.BenchControl
{
Factories = new List<IComponentFactory>();
Factories.Add(new BackupAndSecurity.Default.ComponentFactory());
Factories.Add(new BenchInfo.Munich.ComponentFactory());
Factories.Add(new BenchInfo.Extended.ComponentFactory());
Factories.Add(new BenchInfo.iPerl.ComponentFactory());
Factories.Add(new DataContainers.BackupAndSecurityOptions.ComponentFactory());
Factories.Add(new DataContainers.BenchInfo.Extended.ComponentFactory());
Factories.Add(new DataContainers.BenchInfo.iPerl.ComponentFactory());
Factories.Add(new DataContainers.Buoyancy.ComponentFactory());
Factories.Add(new DataContainers.Density.ComponentFactory());
Factories.Add(new Elde.ControlBoardFactory());
Factories.Add(new Elde.CoverTest.Factory());
Factories.Add(new DataEntry.Combined.EntryFormFactory());
@@ -17,7 +17,6 @@ namespace TBF.BenchControl.TestMethods.Endurance
/// Used when re-scaling the dialog: 100% = 96dpi, 125% = 120dpi, 150% = 144dpi
public readonly int Dpi;
public const int Dpi100pct = 96;
/// <summary>
/// Transition sequences to be updated by this dialog.
@@ -506,9 +506,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
double massStart = Config.Formulas.CorrectedValue(StartMass.Val, scale.Corrections);
double massEnd = Config.Formulas.CorrectedValue(EndMass.Val, scale.Corrections);
double densityOut = Config.Formulas.WaterDensityFromTempPress((TempUpStat.Average + TempDownStat.Average) / 2,
(PressUpStat.Average + PressDownStat.Average) / 2,
Program.LocalSettings.RealDensity,
Program.LocalSettings.AtTemperature); /// [kg/m3] ///
(PressUpStat.Average + PressDownStat.Average) / 2);
double buoyancy = Config.Formulas.Buoyancy();
double massOfEvaporatedWater = (double)(tMass2 - tMass1) * outPath.Scale.EvaporationRate(TempDivStat.Average);
double volumeCTV = 1000.0 * buoyancy * (massEnd - massStart + massOfEvaporatedWater) / densityOut;
@@ -814,9 +814,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
double massStart = Config.Formulas.CorrectedValue(StartMass.Val, scale.Corrections);
double massEnd = Config.Formulas.CorrectedValue(EndMass.Val, scale.Corrections);
double densityOut = Config.Formulas.WaterDensityFromTempPress((TempUpStat.Average + TempDownStat.Average) / 2,
(PressUpStat.Average + PressDownStat.Average) / 2,
Program.LocalSettings.RealDensity,
Program.LocalSettings.AtTemperature); /// [kg/m3] ///
(PressUpStat.Average + PressDownStat.Average) / 2);
double buoyancy = Config.Formulas.Buoyancy();
double massOfEvaporatedWater = (double)(tMass2 - tMass1) * outPath.Scale.EvaporationRate(TempDivStat.Average);
double volumeCTV = 1000.0 * buoyancy * (massEnd - massStart + massOfEvaporatedWater) / densityOut;
@@ -818,9 +818,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
double massStart = Config.Formulas.CorrectedValue(StartMass.Val, scale.Corrections);
double massEnd = Config.Formulas.CorrectedValue(EndMass.Val, scale.Corrections);
double densityOut = Config.Formulas.WaterDensityFromTempPress((TempUpStat.Average + TempDownStat.Average) / 2,
(PressUpStat.Average + PressDownStat.Average) / 2,
Program.LocalSettings.RealDensity,
Program.LocalSettings.AtTemperature); /// [kg/m3] ///
(PressUpStat.Average + PressDownStat.Average) / 2);
double buoyancy = Config.Formulas.Buoyancy();
double massOfEvaporatedWater = (double)(tMass2 - tMass1) * outPath.Scale.EvaporationRate(TempDivStat.Average);
double volumeCTV = 1000.0 * buoyancy * (massEnd - massStart + massOfEvaporatedWater) / densityOut;
@@ -99,8 +99,8 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
string[] args = testParams.Activity.Substring(IperlCheckCmd.Length).Split(new char[] { ' ' });
int maxTestIndex = (ProcessData.BenchInfo is BenchInfo.iPerl.Component)
? (ProcessData.BenchInfo as BenchInfo.iPerl.Component).MaxTestIndex
int maxTestIndex = (ProcessData.BenchInfo is DataContainers.BenchInfo.iPerl.Component)
? (ProcessData.BenchInfo as DataContainers.BenchInfo.iPerl.Component).MaxTestIndex
: int.MaxValue;
Results.Entities.TestRslt tstRslt = ProcessData.BatchRslts.GetTestRslt(test.Name, 0);
+19 -22
View File
@@ -64,9 +64,6 @@ namespace TBF
public int LastProcedureNr;
public int BatchNr;
public double RealDensity; /// water density [kg/m3]
public double AtTemperature; /// measured at temperature [degree C]
public int RightPaneHorizSplitterDistance;
public int TopPaneVerticalSplitterDistance;
@@ -107,11 +104,6 @@ namespace TBF
public int PathsDlgWidth;
public int PathsDlgHeight;
/// iPerlCommunicationsForm
public int iPerlCommunicationsFormLeft;
public int iPerlCommunicationsFormTop;
public long iPerlCommunicationsFormCheckboxes;
[XmlArrayAttribute("FeedingColumnWidths")]
public int[] FeedingColumnWidths;
[XmlIgnore]
@@ -156,6 +148,20 @@ namespace TBF
public int MetrologyDlgWidth;
public int MetrologyDlgHeight;
/// Conditions
public bool ConditionsDlgMaximized;
public int ConditionsDlgLeft;
public int ConditionsDlgTop;
public int ConditionsDlgWidth;
public int ConditionsDlgHeight;
/// Uncertainty
public bool UncertaintyDlgMaximized;
public int UncertaintyDlgLeft;
public int UncertaintyDlgTop;
public int UncertaintyDlgWidth;
public int UncertaintyDlgHeight;
/// Procedures
public bool ProceduresDlgMaximized;
@@ -190,6 +196,11 @@ namespace TBF
public int EnduranceDlgWidth;
public int EnduranceDlgHeight;
/// iPerlCommunicationsForm
public int iPerlCommunicationsFormLeft;
public int iPerlCommunicationsFormTop;
public long iPerlCommunicationsFormCheckboxes;
/// Serial numbers
public string[] LastSNTexts;
[XmlIgnore]
@@ -323,7 +334,6 @@ namespace TBF
{
LocalSettings ls = serializer.Deserialize(reader) as LocalSettings;
log.WarnFormat("Succesfully loaded and decrypted from '{0}'", fileName);
ls.UpdateResultsOutputData();
return ls;
}
}
@@ -339,7 +349,6 @@ namespace TBF
{
LocalSettings ls = serializer.Deserialize(reader) as LocalSettings;
log.WarnFormat("Succesfully loaded from '{0}'", fileName);
ls.UpdateResultsOutputData();
return ls;
}
}
@@ -356,8 +365,6 @@ namespace TBF
/// </summary>
public void Save()
{
UpdateResultsOutputData();
try
{
#if false
@@ -409,16 +416,6 @@ namespace TBF
}
/// <summary>
/// To be able to have RealDensity and AtTemperatire in reports.
/// </summary>
void UpdateResultsOutputData()
{
Results.WMeterRsltItemSpec.RealDensity = this.RealDensity;
Results.WMeterRsltItemSpec.AtTemperature = this.AtTemperature;
}
/// <summary>
/// Updates history stored in a string array by a new latest string.
/// </summary>
+2 -2
View File
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.18.1314.0")]
[assembly: AssemblyFileVersion("2.18.1314.0")]
[assembly: AssemblyVersion("2.24.1317.0")]
[assembly: AssemblyFileVersion("2.24.1317.0")]
+46 -1
View File
@@ -1356,6 +1356,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Drift per year.
/// </summary>
internal static string Drift_per_year {
get {
return ResourceManager.GetString("Drift_per_year", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Leak duration [s].
/// </summary>
@@ -2095,7 +2104,7 @@ namespace TBF.Resources {
}
/// <summary>
/// Looks up a localized string similar to At least one of Buoyancy parameters is invalid,\r\ncorrect it please..
/// Looks up a localized string similar to Buoyancy is invalid, correct it please..
/// </summary>
internal static string Invalid_buoyancy_parameter_Correct_pls {
get {
@@ -2112,6 +2121,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Invalid density parameters.\r\nCorrect them please..
/// </summary>
internal static string Invalid_density_parameter_Correct_pls {
get {
return ResourceManager.GetString("Invalid_density_parameter_Correct_pls", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Invalid password.
/// </summary>
@@ -2310,6 +2328,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Main uncertainty.
/// </summary>
internal static string Main_uncertainty {
get {
return ResourceManager.GetString("Main_uncertainty", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Main Water Meter.
/// </summary>
@@ -4083,6 +4110,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Resolution.
/// </summary>
internal static string Resolution {
get {
return ResourceManager.GetString("Resolution", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to You must restart to apply these changes.
/// </summary>
@@ -5508,6 +5544,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Uncertainty of correction.
/// </summary>
internal static string Uncertainty_of_correction {
get {
return ResourceManager.GetString("Uncertainty_of_correction", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Uncertainty [%].
/// </summary>
+12
View File
@@ -1488,4 +1488,16 @@
<data name="Program_must_be_closed" xml:space="preserve">
<value>Program musí být uzavřen.</value>
</data>
<data name="Drift_per_year" xml:space="preserve">
<value>Drift za rok</value>
</data>
<data name="Main_uncertainty" xml:space="preserve">
<value>Hlavní neurčitost</value>
</data>
<data name="Resolution" xml:space="preserve">
<value>Rozlišení</value>
</data>
<data name="Uncertainty_of_correction" xml:space="preserve">
<value>Neurčitost korekce</value>
</data>
</root>
+16 -1
View File
@@ -1154,7 +1154,7 @@
<value>Continue in the cycle after this test?</value>
</data>
<data name="Invalid_buoyancy_parameter_Correct_pls" xml:space="preserve">
<value>At least one of Buoyancy parameters is invalid,\r\ncorrect it please.</value>
<value>Buoyancy is invalid, correct it please.</value>
</data>
<data name="Invalid_calib_info_Correct_pls" xml:space="preserve">
<value>Invalid calibration information. Correct it please.</value>
@@ -2062,4 +2062,19 @@
<data name="No_info_available" xml:space="preserve">
<value>No info available</value>
</data>
<data name="Invalid_density_parameter_Correct_pls" xml:space="preserve">
<value>Invalid density parameters.\r\nCorrect them please.</value>
</data>
<data name="Drift_per_year" xml:space="preserve">
<value>Drift per year</value>
</data>
<data name="Main_uncertainty" xml:space="preserve">
<value>Main uncertainty</value>
</data>
<data name="Resolution" xml:space="preserve">
<value>Resolution</value>
</data>
<data name="Uncertainty_of_correction" xml:space="preserve">
<value>Uncertainty of correction</value>
</data>
</root>
+21 -7
View File
@@ -3,32 +3,42 @@
<Language>en</Language>
<TestBenches>
<DatabaseSettings>
<BenchName>Test Bench</BenchName>
<BenchName>DEWA PT300</BenchName>
<IsRealBench>true</IsRealBench>
<ProceduresDBSettings>
<DbType>MySql</DbType>
<ConnectionString>SERVER=localhost; DATABASE=testbench; UID=root; PASSWORD=; CHARSET=utf8;</ConnectionString>
<ConnectionString>SERVER=localhost; DATABASE=dewa300; UID=root; PASSWORD=; CHARSET=utf8;</ConnectionString>
</ProceduresDBSettings>
<WaterMetersDBSettings>
<DbType>MySql</DbType>
<ConnectionString>SERVER=localhost; DATABASE=testbench-r; UID=root; PASSWORD=; CHARSET=utf8;</ConnectionString>
<ConnectionString>SERVER=localhost; DATABASE=dewa300-r; UID=root; PASSWORD=; CHARSET=utf8;</ConnectionString>
</WaterMetersDBSettings>
<UsersDBSettings>
<DbType>MySql</DbType>
<ConnectionString />
</UsersDBSettings>
</DatabaseSettings>
</TestBenches>
<LastBench>Test Bench</LastBench>
<LoginMethod>UserName</LoginMethod>
<LastBench>DEWA PT300</LastBench>
<BatchNr>1</BatchNr>
<RealDensity>998.2008</RealDensity>
<AtTemperature>20</AtTemperature>
<RightPaneHorizSplitterDistance>25</RightPaneHorizSplitterDistance>
<MainWndLeft>75</MainWndLeft>
<MainWndTop>5</MainWndTop>
<TopPaneVerticalSplitterDistance>596</TopPaneVerticalSplitterDistance>
<MainWndLeft>76</MainWndLeft>
<MainWndTop>21</MainWndTop>
<MainWndWidth>1250</MainWndWidth>
<MainWndHeight>750</MainWndHeight>
<ManiWndMaximized>false</ManiWndMaximized>
<ManiWndMaximized>true</ManiWndMaximized>
<ComponentsDlgLeft>200</ComponentsDlgLeft>
<ComponentsDlgTop>100</ComponentsDlgTop>
<ComponentsDlgWidth>850</ComponentsDlgWidth>
<ComponentsDlgHeight>500</ComponentsDlgHeight>
<PopupResultsLeft>0</PopupResultsLeft>
<PopupResultsTop>0</PopupResultsTop>
<PopupResultsWidth>0</PopupResultsWidth>
<PopupResultsHeight>0</PopupResultsHeight>
<PathsDlgLeft>0</PathsDlgLeft>
<PathsDlgTop>0</PathsDlgTop>
<PathsDlgWidth>0</PathsDlgWidth>
@@ -53,6 +63,10 @@
<OneProcedureDlgHeight>0</OneProcedureDlgHeight>
<PrintOrderLeft>0</PrintOrderLeft>
<PrintOrderTop>0</PrintOrderTop>
<EnduranceDlgLeft>0</EnduranceDlgLeft>
<EnduranceDlgTop>0</EnduranceDlgTop>
<EnduranceDlgWidth>0</EnduranceDlgWidth>
<EnduranceDlgHeight>0</EnduranceDlgHeight>
<PrintOrderOnlyGoodResult>false</PrintOrderOnlyGoodResult>
<PrintOrderOnlyLastResult>false</PrintOrderOnlyLastResult>
<ResultsConfigMeters>Vertically</ResultsConfigMeters>
+2 -1
View File
@@ -60,10 +60,11 @@
<logger name="NHibernate"> <level value="ERROR" /> </logger>
<logger name="TBF.BenchControl.StateMachine"> <level value="INFO" /> </logger>
<logger name="TBF.BenchControl.State"> <level value="WARN" /> </logger>
<logger name="TBF.BenchControl.Elde.ControlComdWrap"> <level value="WARN" /> </logger>
<logger name="TBF.BenchControl.Elde.ControlComWrap"> <level value="WARN" /> </logger>
<logger name="TBF.BenchControl.Elde.Pump"> <level value="WARN" /> </logger>
<logger name="TBF.BenchControl.Elde.PumpWithFM"> <level value="WARN" /> </logger>
<logger name="TBF.BenchControl.MettlerToledo"> <level value="WARN" /> </logger>
<logger name="TBF.BenchControl.Fomulas"> <level value="FATAL" /> </logger>
<logger name="TBF.BenchControl.Elde.StartMeasurementOp"> <level value="WARN" /> </logger>
<logger name="TBF.BenchControl.Modbus"> <level value="DEBUG" /> </logger>
</log4net>
+118 -36
View File
@@ -39,7 +39,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH;CAMERA</DefineConstants>
<DefineConstants>TRACE;DEBUG;DEWA_300;CAMERA;STABLE_MASS_EXTRAS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
@@ -49,7 +49,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;MUNICH;CAMERA</DefineConstants>
<DefineConstants>TRACE;DEWA_300;CAMERA;STABLE_MASS_EXTRAS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
@@ -58,7 +58,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH;CAMERA</DefineConstants>
<DefineConstants>TRACE;DEBUG;DEWA_300;CAMERA;STABLE_MASS_EXTRAS</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
@@ -67,7 +67,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE;MUNICH;CAMERA</DefineConstants>
<DefineConstants>TRACE;DEWA_300;CAMERA;STABLE_MASS_EXTRAS</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
@@ -97,8 +97,8 @@
<SignManifests>false</SignManifests>
</PropertyGroup>
<ItemGroup>
<Reference Include="ControlComponent3Munich">
<HintPath>..\packages\ControlBoard\Munich\ControlComponent3Munich.dll</HintPath>
<Reference Include="ControlComponent3U">
<HintPath>..\packages\ControlBoard\DEWA_300\ControlComponent3U.dll</HintPath>
</Reference>
<Reference Include="FluentNHibernate">
<HintPath>..\packages\FluentNHibernate.2.0.3.0\lib\net40\FluentNHibernate.dll</HintPath>
@@ -158,24 +158,6 @@
<DependentUpon>AmbientCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="BenchControl\Ambient\Greco\Factory.cs" />
<Compile Include="BenchControl\BackupAndSecurity\Default\Component.cs" />
<Compile Include="BenchControl\BackupAndSecurity\Default\ComponentCfg.cs" />
<Compile Include="BenchControl\BackupAndSecurity\Default\ComponentFactory.cs" />
<Compile Include="BenchControl\BenchInfo\Extended\Component.cs" />
<Compile Include="BenchControl\BenchInfo\Extended\ComponentCfg.cs" />
<Compile Include="BenchControl\BenchInfo\Extended\ComponentFactory.cs" />
<Compile Include="BenchControl\BenchInfo\iPerl\Component.cs" />
<Compile Include="BenchControl\BenchInfo\iPerl\ComponentCfg.cs" />
<Compile Include="BenchControl\BenchInfo\iPerl\ComponentFactory.cs" />
<Compile Include="BenchControl\BenchInfo\Munich\Component.cs" />
<Compile Include="BenchControl\BenchInfo\Munich\ComponentCfg.cs" />
<Compile Include="BenchControl\BenchInfo\Munich\ComponentCfgCtrl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="BenchControl\BenchInfo\Munich\ComponentCfgCtrl.designer.cs">
<DependentUpon>ComponentCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="BenchControl\BenchInfo\Munich\ComponentFactory.cs" />
<Compile Include="BenchControl\ComponentParametersDlg.cs">
<SubType>Form</SubType>
</Compile>
@@ -198,6 +180,21 @@
<Compile Include="BenchControl\Configs\ParamsProvider\ComponentCfgCtrl.designer.cs">
<DependentUpon>ComponentCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="BenchControl\DataContainers\BackupAndSecurityOptions\Component.cs" />
<Compile Include="BenchControl\DataContainers\BackupAndSecurityOptions\ComponentCfg.cs" />
<Compile Include="BenchControl\DataContainers\BackupAndSecurityOptions\ComponentFactory.cs" />
<Compile Include="BenchControl\DataContainers\BenchInfo\Extended\Component.cs" />
<Compile Include="BenchControl\DataContainers\BenchInfo\Extended\ComponentCfg.cs" />
<Compile Include="BenchControl\DataContainers\BenchInfo\Extended\ComponentFactory.cs" />
<Compile Include="BenchControl\DataContainers\BenchInfo\iPerl\Component.cs" />
<Compile Include="BenchControl\DataContainers\BenchInfo\iPerl\ComponentCfg.cs" />
<Compile Include="BenchControl\DataContainers\BenchInfo\iPerl\ComponentFactory.cs" />
<Compile Include="BenchControl\DataContainers\Buoyancy\Component.cs" />
<Compile Include="BenchControl\DataContainers\Buoyancy\ComponentCfg.cs" />
<Compile Include="BenchControl\DataContainers\Buoyancy\ComponentFactory.cs" />
<Compile Include="BenchControl\DataContainers\Density\Component.cs" />
<Compile Include="BenchControl\DataContainers\Density\ComponentCfg.cs" />
<Compile Include="BenchControl\DataContainers\Density\ComponentFactory.cs" />
<Compile Include="BenchControl\DataEntry\Combined\TestStartEndForm.cs">
<SubType>Form</SubType>
</Compile>
@@ -597,7 +594,6 @@
<DependentUpon>ValveCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="BenchControl\Elde\ValveEx\ValveFactory.cs" />
<Compile Include="BenchControl\GenericDevices\IBackupAndSecurity.cs" />
<Compile Include="BenchControl\GenericDevices\ICalibInfoCfg.cs" />
<Compile Include="BenchControl\GenericDevices\IEvaporation.cs" />
<Compile Include="BenchControl\GenericDevices\IParallelOutput.cs" />
@@ -1987,6 +1983,12 @@
<Compile Include="UI\Bench\Components\SelectComponentClassDlg.designer.cs">
<DependentUpon>SelectComponentClassDlg.cs</DependentUpon>
</Compile>
<Compile Include="UI\Bench\Conditions\ConditionsDlg.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\Bench\Conditions\ConditionsDlg.designer.cs">
<DependentUpon>ConditionsDlg.cs</DependentUpon>
</Compile>
<Compile Include="UI\Bench\Metrology\IMetrologyDlgTab.cs" />
<Compile Include="UI\Bench\Metrology\MetrologyDlg.cs">
<SubType>Form</SubType>
@@ -2000,6 +2002,12 @@
<Compile Include="UI\Bench\Metrology\MetrologyDlgBalanceTab.designer.cs">
<DependentUpon>MetrologyDlgBalanceTab.cs</DependentUpon>
</Compile>
<Compile Include="UI\Bench\Metrology\MetrologyDlgBuoyancyTab.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UI\Bench\Metrology\MetrologyDlgBuoyancyTab.designer.cs">
<DependentUpon>MetrologyDlgBuoyancyTab.cs</DependentUpon>
</Compile>
<Compile Include="UI\Bench\Metrology\MetrologyDlgDensityTab.cs">
<SubType>UserControl</SubType>
</Compile>
@@ -2081,6 +2089,43 @@
<Compile Include="UI\Bench\Transitions\VirtualBenchStepsCtrl.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="UI\Bench\Uncertainties\IUncetaintiesDlgTab.cs" />
<Compile Include="UI\Bench\Uncertainties\UncertntDlgBuoyancyTab.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UI\Bench\Uncertainties\UncertntDlgBuoyancyTab.designer.cs">
<DependentUpon>UncertntDlgBuoyancyTab.cs</DependentUpon>
</Compile>
<Compile Include="UI\Bench\Uncertainties\UncertntDlgDensityTab.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UI\Bench\Uncertainties\UncertntDlgDensityTab.designer.cs">
<DependentUpon>UncertntDlgDensityTab.cs</DependentUpon>
</Compile>
<Compile Include="UI\Bench\Uncertainties\UncertntDlgScaleTab.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UI\Bench\Uncertainties\UncertntDlgScaleTab.designer.cs">
<DependentUpon>UncertntDlgScaleTab.cs</DependentUpon>
</Compile>
<Compile Include="UI\Bench\Uncertainties\UncertntDlgPressMeterTab.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UI\Bench\Uncertainties\UncertntDlgPressMeterTab.designer.cs">
<DependentUpon>UncertntDlgPressMeterTab.cs</DependentUpon>
</Compile>
<Compile Include="UI\Bench\Uncertainties\UncertntDlgTempMeterTab.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UI\Bench\Uncertainties\UncertntDlgTempMeterTab.designer.cs">
<DependentUpon>UncertntDlgTempMeterTab.cs</DependentUpon>
</Compile>
<Compile Include="UI\Bench\Uncertainties\UncertaintiesDlg.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\Bench\Uncertainties\UncertaintiesDlg.designer.cs">
<DependentUpon>UncertaintiesDlg.cs</DependentUpon>
</Compile>
<Compile Include="UI\Camera\CameraPictureCtrl.cs">
<SubType>UserControl</SubType>
</Compile>
@@ -2164,36 +2209,52 @@
<Compile Include="UI\Procedures\TestParamsCtrl.designer.cs">
<DependentUpon>TestParamsCtrl.cs</DependentUpon>
</Compile>
<Compile Include="UI\Procedures\TestWizard\FlowSelection.cs" />
<Compile Include="UI\Procedures\TestWizard\FlowSelection.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\Procedures\TestWizard\FlowSelection.designer.cs">
<DependentUpon>FlowSelection.cs</DependentUpon>
</Compile>
<Compile Include="UI\Procedures\TestWizard\HeatMetersSelection.cs" />
<Compile Include="UI\Procedures\TestWizard\HeatMetersSelection.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\Procedures\TestWizard\HeatMetersSelection.designer.cs">
<DependentUpon>HeatMetersSelection.cs</DependentUpon>
</Compile>
<Compile Include="UI\Procedures\TestWizard\MethodSelection.cs" />
<Compile Include="UI\Procedures\TestWizard\MethodSelection.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\Procedures\TestWizard\MethodSelection.designer.cs">
<DependentUpon>MethodSelection.cs</DependentUpon>
</Compile>
<Compile Include="UI\Procedures\TestWizard\PressureSelection.cs" />
<Compile Include="UI\Procedures\TestWizard\PressureSelection.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\Procedures\TestWizard\PressureSelection.designer.cs">
<DependentUpon>PressureSelection.cs</DependentUpon>
</Compile>
<Compile Include="UI\Procedures\TestWizard\Roi1.cs" />
<Compile Include="UI\Procedures\TestWizard\Roi1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\Procedures\TestWizard\Roi1.designer.cs">
<DependentUpon>Roi1.cs</DependentUpon>
</Compile>
<Compile Include="UI\Procedures\TestWizard\Roi2.cs" />
<Compile Include="UI\Procedures\TestWizard\Roi2.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\Procedures\TestWizard\Roi2.designer.cs">
<DependentUpon>Roi2.cs</DependentUpon>
</Compile>
<Compile Include="UI\Procedures\TestWizard\Roi3.cs" />
<Compile Include="UI\Procedures\TestWizard\Roi3.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\Procedures\TestWizard\Roi3.designer.cs">
<DependentUpon>Roi3.cs</DependentUpon>
</Compile>
<Compile Include="UI\Procedures\TestWizard\RoiData.cs" />
<Compile Include="UI\Procedures\TestWizard\VolumeAndErrorSelection.cs" />
<Compile Include="UI\Procedures\TestWizard\VolumeAndErrorSelection.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\Procedures\TestWizard\VolumeAndErrorSelection.designer.cs">
<DependentUpon>VolumeAndErrorSelection.cs</DependentUpon>
</Compile>
@@ -2355,9 +2416,6 @@
<EmbeddedResource Include="BenchControl\Ambient\Greco\AmbientCfgCtrl.resx">
<DependentUpon>AmbientCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="BenchControl\BenchInfo\Munich\ComponentCfgCtrl.resx">
<DependentUpon>ComponentCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="BenchControl\ComponentParametersDlg.resx">
<DependentUpon>ComponentParametersDlg.cs</DependentUpon>
</EmbeddedResource>
@@ -2994,12 +3052,18 @@
<EmbeddedResource Include="UI\Bench\Components\SelectComponentClassDlg.resx">
<DependentUpon>SelectComponentClassDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Bench\Conditions\ConditionsDlg.resx">
<DependentUpon>ConditionsDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Bench\Metrology\MetrologyDlg.resx">
<DependentUpon>MetrologyDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Bench\Metrology\MetrologyDlgBalanceTab.resx">
<DependentUpon>MetrologyDlgBalanceTab.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Bench\Metrology\MetrologyDlgBuoyancyTab.resx">
<DependentUpon>MetrologyDlgBuoyancyTab.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Bench\Metrology\MetrologyDlgDensityTab.resx">
<DependentUpon>MetrologyDlgDensityTab.cs</DependentUpon>
</EmbeddedResource>
@@ -3030,6 +3094,24 @@
<EmbeddedResource Include="UI\Bench\Transitions\TransitionsDlg.resx">
<DependentUpon>TransitionsDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Bench\Uncertainties\UncertntDlgBuoyancyTab.resx">
<DependentUpon>UncertntDlgBuoyancyTab.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Bench\Uncertainties\UncertntDlgDensityTab.resx">
<DependentUpon>UncertntDlgDensityTab.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Bench\Uncertainties\UncertntDlgScaleTab.resx">
<DependentUpon>UncertntDlgScaleTab.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Bench\Uncertainties\UncertntDlgPressMeterTab.resx">
<DependentUpon>UncertntDlgPressMeterTab.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Bench\Uncertainties\UncertntDlgTempMeterTab.resx">
<DependentUpon>UncertntDlgTempMeterTab.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Bench\Uncertainties\UncertaintiesDlg.resx">
<DependentUpon>UncertaintiesDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Camera\CameraPictureCtrl.resx">
<DependentUpon>CameraPictureCtrl.cs</DependentUpon>
</EmbeddedResource>
+91
View File
@@ -0,0 +1,91 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
namespace TBF.UI.Bench.Conditions
{
partial class ConditionsDlg
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ConditionsDlg));
this.mainSplitContainer = new System.Windows.Forms.SplitContainer();
this.tabControl = new System.Windows.Forms.TabControl();
this.sharedButtons = new TBF.UI.Shared.SharedButtons();
((System.ComponentModel.ISupportInitialize)(this.mainSplitContainer)).BeginInit();
this.mainSplitContainer.Panel1.SuspendLayout();
this.mainSplitContainer.Panel2.SuspendLayout();
this.mainSplitContainer.SuspendLayout();
this.SuspendLayout();
//
// mainSplitContainer
//
resources.ApplyResources(this.mainSplitContainer, "mainSplitContainer");
this.mainSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
this.mainSplitContainer.Name = "mainSplitContainer";
//
// mainSplitContainer.Panel1
//
this.mainSplitContainer.Panel1.Controls.Add(this.tabControl);
//
// mainSplitContainer.Panel2
//
this.mainSplitContainer.Panel2.Controls.Add(this.sharedButtons);
//
// tabControl
//
resources.ApplyResources(this.tabControl, "tabControl");
this.tabControl.Name = "tabControl";
this.tabControl.SelectedIndex = 0;
this.tabControl.SelectedIndexChanged += new System.EventHandler(this.tabControl_SelectedIndexChanged);
//
// sharedButtons
//
resources.ApplyResources(this.sharedButtons, "sharedButtons");
this.sharedButtons.Name = "sharedButtons";
//
// ConditionsDlg
//
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.mainSplitContainer);
this.Name = "ConditionsDlg";
this.Load += new System.EventHandler(this.TransitionsDlg_Load);
this.mainSplitContainer.Panel1.ResumeLayout(false);
this.mainSplitContainer.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.mainSplitContainer)).EndInit();
this.mainSplitContainer.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer mainSplitContainer;
private System.Windows.Forms.TabControl tabControl;
private TBF.UI.Shared.SharedButtons sharedButtons;
}
}
+706
View File
@@ -0,0 +1,706 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using log4net;
using NHibernate;
using Config.Entities;
using Results.Forms;
using TBF.BenchControl.Generic;
using TBF.BenchControl.GenericDevices;
using TBF.Resources;
using TBF.UI.Shared;
using TBF.UI.Bench.Transitions; /// TODO: Remove
namespace TBF.UI.Bench.Conditions
{
public partial class ConditionsDlg : Form, IParentOfListViewEx
{
static readonly ILog log = LogManager.GetLogger(typeof(ConditionsDlg));
/// Used when re-scaling the dialog: 100% = 96dpi, 125% = 120dpi, 150% = 144dpi
public readonly int Dpi;
/// <summary>
/// Fluent-NHibernate database session
/// </summary>
public ISession Session;
IList<Procedure> procedures;
IList<Test> tests;
Dictionary<string, string> renameInfo; /// Pairs original name / new name
/// <summary>
/// Transition sequences to be updated by this dialog.
/// Set by the constructor or updated by the parent after creation and before loading.
/// </summary>
public IList<TransitionSequence> TransitionSequences;
public IList<TransitionSequence> RemovedTransitionSequences;
/// <summary>
/// Virtual bench sequences to be updated by this dialog.
/// Set by the constructor or updated by the parent after creation and before loading.
/// </summary>
public IList<VirtualBenchSequence> VirtualBenchSequences;
public IList<VirtualBenchSequence> RemovedVirtualBenchSequences;
/// Auxiliary public lists used also by user controls in tab pages
public IList<BenchControl.Generic.IComponent> TbfComponents;
public IList<IValve> Valves;
public IList<IRegulValve> RegulValves;
IList<ITabWithListViewEx> seqStepsCtrls;
public ConditionsDlg()
{
/// Detect display setting: 100% = 96dpi, 125% = 120dpi, 150% = 144dpi.
Dpi = (int)this.CreateGraphics().DpiX;
InitializeComponent();
/// 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.Buttons.Export | SharedButtons.Buttons.Import |
SharedButtons.Buttons.Compare | SharedButtons.Buttons.NewTab |
SharedButtons.Buttons.RenameTab | SharedButtons.Buttons.RemoveTab;
sharedButtons.Unlocked += Unlocked;
sharedButtons.OKClicked += okButton_Click;
sharedButtons.CancelClicked += cancelButton_Click;
sharedButtons.AddClicked += addButton_Click;
sharedButtons.RemoveClicked += removeButton_Click;
sharedButtons.UpClicked += upButton_Click;
sharedButtons.DownClicked += downButton_Click;
sharedButtons.ExportClicked += exportButton_Click;
sharedButtons.ImportClicked += importButton_Click;
sharedButtons.CompareClicked += compareButton_Click;
sharedButtons.NewTabClicked += newTabButton_Click;
sharedButtons.RenameTabClicked += renameTabButton_Click;
sharedButtons.RemoveTabClicked += removeTabButton_Click;
seqStepsCtrls = new List<ITabWithListViewEx>();
/// Open the database
Session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config);
/// Prepare a list of components and a list of all valves in the test bench
TbfComponents = BenchControl.TbfComponents.LoadComponentsFromDB(Session);
Valves = BenchControl.GenericDevices.ValveBase.MasterValves(TbfComponents);
RegulValves = new List<IRegulValve>();
foreach (var cmpnt in TbfComponents)
{
if ((cmpnt is IRegulValve) && !(cmpnt is BenchControl.Elde.RegulValveTandem.RegulValveTandem))
{
RegulValves.Add(cmpnt as IRegulValve);
}
}
/// Load the sequences
/// Note: Each sequence (in both sequences together) has a unique ItemNr (0 .. N-1)
TransitionSequences = Session.QueryOver<TransitionSequence>().OrderBy(x => x.ItemNr).Asc.List();
VirtualBenchSequences = Session.QueryOver<VirtualBenchSequence>().OrderBy(x => x.ItemNr).Asc.List();
procedures = Session.QueryOver<Procedure>().List();
tests = Session.QueryOver<Test>().List();
RemovedTransitionSequences = new List<TransitionSequence>();
RemovedVirtualBenchSequences = new List<VirtualBenchSequence>();
/// Create a tab with sequence steps for each sequence ordered by ItemNr.
foreach (var transSeq in TransitionSequences)
{
transSeq.OriName = transSeq.Name;
AddTransitionSeqTab(transSeq);
}
foreach (var vBenchSeq in VirtualBenchSequences)
{
vBenchSeq.OriName = vBenchSeq.Name;
AddVirtualBenchSeqTab(vBenchSeq);
}
}
void AddTransitionSeqTab(TransitionSequence sequence)
{
//TabPage nwTab = new TabPage(sequence.Name);
//nwTab.Tag = sequence;
//TransitionStepsCtrl newCtrl = new TransitionStepsCtrl();
//seqStepsCtrls.Add(newCtrl);
//nwTab.Controls.Add(newCtrl);
//tabControl.TabPages.Add(nwTab);
//newCtrl.Initialize(sequence, this, tabControl.TabPages[tabControl.TabPages.Count - 1]);
//newCtrl.SelectedIndexChanged += new System.EventHandler(SelectedIndexChanged);
}
void AddVirtualBenchSeqTab(VirtualBenchSequence sequence)
{
//TabPage nwTab = new TabPage(sequence.Name);
//nwTab.Tag = sequence;
//VirtualBenchStepsCtrl newCtrl = new VirtualBenchStepsCtrl();
//seqStepsCtrls.Add(newCtrl);
//nwTab.Controls.Add(newCtrl);
//tabControl.TabPages.Add(nwTab);
//newCtrl.Initialize(sequence, this, tabControl.TabPages[tabControl.TabPages.Count - 1]);
//newCtrl.SelectedIndexChanged += new System.EventHandler(SelectedIndexChanged);
}
private void TransitionsDlg_Load(object sender, EventArgs e)
{
Localize();
LoadUISettings();
/// Now refresh the content of the dialog
RefreshAllTabs();
}
void Localize()
{
Text = Strings.Conditions;
}
void RefreshAllTabs()
{
foreach (var ctrl in seqStepsCtrls) (ctrl as ListViewEx).Refresh();
}
private void Unlocked(object sender, EventArgs e)
{
foreach (var ctrl in seqStepsCtrls) ctrl.Unlock();
}
private void newTabButton_Click(object sender, EventArgs e)
{
TabNameDlg dlg;
bool nameUsed;
int tabId = TransitionSequences.Count + VirtualBenchSequences.Count;
do
{
/// Find an unused procedure name
string newName;
for (int nameId = 1; true; nameId++)
{
newName = "Tr" + nameId.ToString();
nameUsed = false;
foreach (var seq in TransitionSequences) if (seq.Name.Equals(newName)) nameUsed = true;
if (!nameUsed) break;
}
dlg = new TabNameDlg();
dlg.TabNameLabel = Strings.New_transition_name;
dlg.TabName = newName;
if (DialogResult.OK != dlg.ShowDialog()) return;
foreach (var seq in TransitionSequences) if (seq.Name.Equals(dlg.TabName)) nameUsed = true;
if (nameUsed) MessageBox.Show(Strings.Please_choose_another_transition_sequence_name,
Strings.Warning,
MessageBoxButtons.OK,
MessageBoxIcon.Information);
}
while (nameUsed);
if (dlg.IsVirtualBenchSeq)
{
VirtualBenchSequence sequence = new VirtualBenchSequence(dlg.TabName, tabId);
VirtualBenchSequences.Add(sequence);
AddVirtualBenchSeqTab(sequence);
seqStepsCtrls[tabId].Unlock();
}
else
{
TransitionSequence sequence = new TransitionSequence(dlg.TabName, tabId);
TransitionSequences.Add(sequence);
AddTransitionSeqTab(sequence);
seqStepsCtrls[tabId].Unlock();
}
tabControl.SelectTab(tabId);
}
private void renameTabButton_Click(object sender, EventArgs e)
{
TabPage tabPage = tabControl.SelectedTab;
TransitionSequence transitionSeq = tabPage.Tag as TransitionSequence;
VirtualBenchSequence virtualBenchSeq = tabPage.Tag as VirtualBenchSequence;
TabNameDlg dlg = new TabNameDlg(true);
dlg.TabNameLabel = Strings.New_transition_name;
if (dlg.ShowDialog() == DialogResult.OK)
{
bool nameUsed = false;
foreach (var seq in TransitionSequences) if (seq != transitionSeq && seq.Name == dlg.TabName) nameUsed = true;
foreach (var seq in VirtualBenchSequences) if (seq != virtualBenchSeq && seq.Name == dlg.TabName) nameUsed = true;
if (nameUsed)
{
MessageBox.Show(Strings.Please_choose_another_transition_sequence_name,
Strings.Warning,
MessageBoxButtons.OK,
MessageBoxIcon.Information);
}
else
{
if (transitionSeq != null)
{
transitionSeq.Name = dlg.TabName;
tabPage.Text = dlg.TabName;
}
else if (virtualBenchSeq != null)
{
virtualBenchSeq.Name = dlg.TabName;
tabPage.Text = dlg.TabName;
}
}
}
}
private void removeTabButton_Click(object sender, EventArgs e)
{
TabPage tabPage = tabControl.SelectedTab;
TransitionSequence transitionSeq = tabPage.Tag as TransitionSequence;
VirtualBenchSequence virtualBenchSeq = tabPage.Tag as VirtualBenchSequence;
if (DialogResult.Yes == MessageBox.Show(string.Format(Strings.Do_you_really_want_to_delete_sequence_0, tabPage.Text),
Strings.Warning,
MessageBoxButtons.YesNo,
MessageBoxIcon.Question))
{
if (transitionSeq != null)
{
RemovedTransitionSequences.Add(transitionSeq);
TransitionSequences.Remove(transitionSeq);
tabControl.TabPages.Remove(tabPage);
}
else if (virtualBenchSeq != null)
{
RemovedVirtualBenchSequences.Add(virtualBenchSeq);
VirtualBenchSequences.Remove(virtualBenchSeq);
tabControl.TabPages.Remove(tabPage);
}
}
}
void RetrieveData()
{
if (seqStepsCtrls.Count > slctdTab) seqStepsCtrls[slctdTab].OkBtnClicked();
}
string GetWarningsBeforeSaving(ref Dictionary<string, string> renmInfo)
{
string warnings = string.Empty;
renmInfo = new Dictionary<string, string>();
foreach (var seq in RemovedTransitionSequences)
{
if (!string.IsNullOrEmpty(seq.OriName))
{
int occurances = 0;
foreach (var test in tests)
{
if (!string.IsNullOrEmpty(test.RelTransBefore) && test.RelTransBefore == seq.OriName) occurances++;
if (!string.IsNullOrEmpty(test.TransitionAfter) && test.TransitionAfter == seq.OriName) occurances++;
}
foreach (var proc in procedures)
{
if (!string.IsNullOrEmpty(proc.TransitionStart) && proc.TransitionStart == seq.OriName) occurances++;
if (!string.IsNullOrEmpty(proc.TransitionEnd) && proc.TransitionEnd == seq.OriName) occurances++;
}
if (occurances > 0)
{
warnings += string.Format("Deleting transition sequence {0} used in {1} tests and procedures{2}", seq.OriName, occurances, Environment.NewLine);
renmInfo.Add(seq.OriName, string.Empty);
}
}
}
foreach (var seq in RemovedVirtualBenchSequences)
{
if (!string.IsNullOrEmpty(seq.OriName))
{
int occurances = 0;
foreach (var test in tests)
{
if (!string.IsNullOrEmpty(test.RelTransBefore) && test.RelTransBefore == seq.OriName) occurances++;
if (!string.IsNullOrEmpty(test.TransitionAfter) && test.TransitionAfter == seq.OriName) occurances++;
}
foreach (var proc in procedures)
{
if (!string.IsNullOrEmpty(proc.TransitionStart) && proc.TransitionStart == seq.OriName) occurances++;
if (!string.IsNullOrEmpty(proc.TransitionEnd) && proc.TransitionEnd == seq.OriName) occurances++;
}
if (occurances > 0)
{
warnings += string.Format("Deleting virtual bench sequence {0} used in {1} tests and procedures{2}", seq.OriName, occurances, Environment.NewLine);
renmInfo.Add(seq.OriName, string.Empty);
}
}
}
foreach (var seq in TransitionSequences)
{
if (!string.IsNullOrEmpty(seq.OriName) && seq.OriName != seq.Name)
{
int occurances = 0;
foreach (var test in tests)
{
if (!string.IsNullOrEmpty(test.RelTransBefore) && test.RelTransBefore == seq.OriName) occurances++;
if (!string.IsNullOrEmpty(test.TransitionAfter) && test.TransitionAfter == seq.OriName) occurances++;
}
foreach (var proc in procedures)
{
if (!string.IsNullOrEmpty(proc.TransitionStart) && proc.TransitionStart == seq.OriName) occurances++;
if (!string.IsNullOrEmpty(proc.TransitionEnd) && proc.TransitionEnd == seq.OriName) occurances++;
}
if (occurances > 0)
{
warnings += string.Format("Renaming transition sequence {0} used in {1} tests and procedures{2}", seq.OriName, occurances, Environment.NewLine);
renmInfo.Add(seq.OriName, seq.Name);
}
}
}
foreach (var seq in VirtualBenchSequences)
{
if (!string.IsNullOrEmpty(seq.OriName) && seq.OriName != seq.Name)
{
int occurances = 0;
foreach (var test in tests)
{
if (!string.IsNullOrEmpty(test.RelTransBefore) && test.RelTransBefore == seq.OriName) occurances++;
if (!string.IsNullOrEmpty(test.TransitionAfter) && test.TransitionAfter == seq.OriName) occurances++;
}
foreach (var proc in procedures)
{
if (!string.IsNullOrEmpty(proc.TransitionStart) && proc.TransitionStart == seq.OriName) occurances++;
if (!string.IsNullOrEmpty(proc.TransitionEnd) && proc.TransitionEnd == seq.OriName) occurances++;
}
if (occurances > 0)
{
warnings += string.Format("Renaming virtual bench sequence {0} used in {1} tests and procedures{2}", seq.OriName, occurances, Environment.NewLine);
renmInfo.Add(seq.OriName, seq.Name);
}
}
}
return warnings;
}
private void okButton_Click(object sender, EventArgs e)
{
RetrieveData();
string warnings = GetWarningsBeforeSaving(ref renameInfo);
bool updateRelatedItems = false;
if (!string.IsNullOrEmpty(warnings))
{
string message = string.Format("{0}{1}{2}", warnings, Environment.NewLine,
Strings.Do_you_want_to_update_related_tests_and_procedures);
DialogResult dr = MessageBox.Show(message, Strings.Warning, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation);
if (dr == DialogResult.Cancel)
{
DialogResult = DialogResult.Cancel;
return;
}
else if (dr == DialogResult.Yes)
{
updateRelatedItems = true;
}
}
Cursor.Current = Cursors.WaitCursor;
using (var transaction = Session.BeginTransaction())
{
try
{
if (updateRelatedItems)
{
foreach (var ri in renameInfo)
{
var tests = Session.QueryOver<Config.Entities.Test>()
.Where(x => (x.RelTransBefore == ri.Key))
.List();
foreach (var t in tests)
{
t.RelTransBefore = ri.Value;
Session.Update(t);
}
tests = Session.QueryOver<Config.Entities.Test>()
.Where(x => (x.TransitionAfter == ri.Key))
.List();
foreach (var t in tests)
{
t.TransitionAfter = ri.Value;
Session.Update(t);
}
var procedures = Session.QueryOver<Config.Entities.Procedure>()
.Where(x => (x.TransitionStart == ri.Key))
.List();
foreach (var p in procedures)
{
p.TransitionStart = ri.Value;
Session.Update(p);
}
procedures = Session.QueryOver<Config.Entities.Procedure>()
.Where(x => (x.TransitionEnd == ri.Key))
.List();
foreach (var p in procedures)
{
p.TransitionEnd = ri.Value;
Session.Update(p);
}
}
}
foreach (var transSeq in RemovedTransitionSequences)
{
foreach (var step in transSeq.TransitionSteps) Session.Delete(step);
Session.Delete(transSeq);
}
foreach (var vBnchSeq in RemovedVirtualBenchSequences)
{
foreach (var step in vBnchSeq.VirtualBenchSteps) Session.Delete(step);
Session.Delete(vBnchSeq);
}
int itemNr = 0;
foreach (var transSeq in TransitionSequences)
{
transSeq.ItemNr = itemNr++;
Session.SaveOrUpdate(transSeq);
}
itemNr = 0;
foreach (var vBnchSeq in VirtualBenchSequences)
{
vBnchSeq.ItemNr = itemNr++;
Session.SaveOrUpdate(vBnchSeq);
}
transaction.Commit();
}
catch (Exception e2)
{
transaction.Rollback();
Cursor.Current = Cursors.Default;
MessageBox.Show(Strings.Cannot_save_changes, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
log.ErrorFormat("Update of sequences in the database failed: {0}", e2.Message);
}
}
Cursor.Current = Cursors.Default;
SaveUISettings();
DialogResult = DialogResult.OK;
Close();
return;
}
private void cancelButton_Click(object sender, EventArgs e)
{
SaveUISettings();
DialogResult = DialogResult.Cancel;
Close();
return;
}
private void SaveUISettings()
{
/// Obtain ConditionsDlg dimensions, etc.
bool isMaximized = (WindowState == FormWindowState.Maximized);
int left = (WindowState == FormWindowState.Normal) ? Location.X : RestoreBounds.Left;
int top = (WindowState == FormWindowState.Normal) ? Location.Y : RestoreBounds.Top;
int width = (WindowState == FormWindowState.Normal) ? Size.Width : RestoreBounds.Width;
int height = (WindowState == FormWindowState.Normal) ? Size.Height : RestoreBounds.Height;
LocalSettings ls = Program.LocalSettings;
if (ls != null && (ls.ConditionsDlgMaximized != isMaximized ||
ls.ConditionsDlgLeft != left ||
ls.ConditionsDlgTop != top ||
ls.ConditionsDlgWidth != width ||
ls.ConditionsDlgHeight != height))
{
/// At least one ConditionsDlg dimension differs => Update local settings and save them
ls.ConditionsDlgMaximized = isMaximized;
ls.ConditionsDlgLeft = left;
ls.ConditionsDlgTop = top;
ls.ConditionsDlgWidth = width;
ls.ConditionsDlgHeight = height;
ls.Save();
}
}
private void LoadUISettings()
{
TBF.LocalSettings ls = Program.LocalSettings;
WindowState = (ls.ConditionsDlgMaximized ? FormWindowState.Maximized : FormWindowState.Normal);
Width = (ls.ConditionsDlgWidth > 0) ? ls.ConditionsDlgWidth : 1050;
Height = (ls.ConditionsDlgHeight > 0) ? ls.ConditionsDlgHeight : 650;
Left = (ls.ConditionsDlgLeft != 0) ? ls.ConditionsDlgLeft : 100;
Top = (ls.ConditionsDlgTop != 0) ? ls.ConditionsDlgTop : 100;
}
int slctdTab;
private void tabControl_SelectedIndexChanged(object sender, EventArgs e)
{
if (seqStepsCtrls.Count > slctdTab)
{
seqStepsCtrls[slctdTab].OkBtnClicked();
}
slctdTab = tabControl.SelectedIndex;
sharedButtons.EnableButtons(SharedButtons.Buttons.Add);
sharedButtons.DisableButtons(SharedButtons.Buttons.Remove);
RefreshAllTabs();
}
private void addButton_Click(object sender, EventArgs e)
{
if (seqStepsCtrls.Count > slctdTab) seqStepsCtrls[slctdTab].AddOne();
}
private void removeButton_Click(object sender, EventArgs e)
{
if (seqStepsCtrls.Count > slctdTab) seqStepsCtrls[slctdTab].RemoveSelected();
}
private void upButton_Click(object sender, EventArgs e)
{
if (seqStepsCtrls.Count > slctdTab) seqStepsCtrls[slctdTab].MoveUpSelected();
}
private void downButton_Click(object sender, EventArgs e)
{
if (seqStepsCtrls.Count > slctdTab) seqStepsCtrls[slctdTab].MoveDownSelected();
}
public void UpdateButtonStates(SharedButtons.SelectedItemPos selectedItemPos)
{
if (selectedItemPos == SharedButtons.SelectedItemPos.None)
{
sharedButtons.DisableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Up | SharedButtons.Buttons.Down);
}
else if (selectedItemPos == SharedButtons.SelectedItemPos.First)
{
sharedButtons.EnableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Down);
sharedButtons.DisableButtons(SharedButtons.Buttons.Up);
}
else if (selectedItemPos == SharedButtons.SelectedItemPos.Last)
{
sharedButtons.EnableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Up);
sharedButtons.DisableButtons(SharedButtons.Buttons.Down);
}
else if (selectedItemPos == SharedButtons.SelectedItemPos.FirstAndLast)
{
sharedButtons.EnableButtons(SharedButtons.Buttons.Remove);
sharedButtons.DisableButtons(SharedButtons.Buttons.Up | SharedButtons.Buttons.Down);
}
else
{
sharedButtons.EnableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Up | SharedButtons.Buttons.Down);
}
}
/// <summary>
/// Common part for three xxxListViewEx_SelectedIndexChanged event handlers
/// </summary>
/// <param name="listViewEx"></param>
void SelectedIndexChanged(object sender, EventArgs e)
{
ListViewEx listViewEx = sender as ListViewEx;
if (listViewEx.SelectedItems.Count != 1)
{
UpdateButtonStates(SharedButtons.SelectedItemPos.None);
}
else if (listViewEx.Items.Count == 1)
{
UpdateButtonStates(SharedButtons.SelectedItemPos.FirstAndLast);
}
else if (listViewEx.SelectedIndices[0] == 0)
{
UpdateButtonStates(SharedButtons.SelectedItemPos.First);
}
else if (listViewEx.SelectedIndices[0] == (listViewEx.Items.Count - 1))
{
UpdateButtonStates(SharedButtons.SelectedItemPos.Last);
}
else
{
UpdateButtonStates(SharedButtons.SelectedItemPos.Middle);
}
}
private void exportButton_Click(object sender, EventArgs e)
{
TabPage tabPage = tabControl.SelectedTab;
TransitionSequence transitionSeq = tabPage.Tag as TransitionSequence;
VirtualBenchSequence virtualBenchSeq = tabPage.Tag as VirtualBenchSequence;
SaveFileDialog dlg = new SaveFileDialog();
if (dlg.ShowDialog() == DialogResult.OK)
{
if (transitionSeq != null)
{
/// export transition sequence
transitionSeq.Export(new StreamWriter(dlg.FileName, false, System.Text.Encoding.UTF8));
}
else if (virtualBenchSeq != null)
{
/// export virtual sequence
virtualBenchSeq.Export(new StreamWriter(dlg.FileName, false, System.Text.Encoding.UTF8));
}
}
}
private void importButton_Click(object sender, EventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
if (dlg.ShowDialog() != DialogResult.OK) return;
/// Import a procedure from a file
int tabId = TransitionSequences.Count + VirtualBenchSequences.Count;
TransitionSequence newSequence = TransitionSequence.Import(new StreamReader(dlg.FileName, System.Text.Encoding.UTF8));
newSequence.ItemNr = tabId;
/// Find an unused procedure name
string newName;
bool nameUsed;
for (int nameId = 1; true; nameId++)
{
newName = string.Format("{0} imported{1}", newSequence.Name, (nameId == 1) ? string.Empty : string.Format("({0})", nameId));
nameUsed = false;
foreach (var seq in TransitionSequences) if (seq.Name.Equals(newName)) nameUsed = true;
if (!nameUsed) break;
}
newSequence.Name = newName;
TransitionSequences.Add(newSequence);
AddTransitionSeqTab(newSequence);
seqStepsCtrls[tabId].Unlock();
tabControl.SelectTab(tabId);
}
private void compareButton_Click(object sender, EventArgs e)
{
MessageBox.Show("Comparing sequences in not implemented yet");
}
}
}
+246
View File
@@ -0,0 +1,246 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="mainSplitContainer.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="mainSplitContainer.IsSplitterFixed" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="mainSplitContainer.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
</data>
<data name="tabControl.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="tabControl.ItemSize" type="System.Drawing.Size, System.Drawing">
<value>58, 30</value>
</data>
<data name="tabControl.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
</data>
<data name="tabControl.Size" type="System.Drawing.Size, System.Drawing">
<value>760, 366</value>
</data>
<data name="tabControl.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="&gt;&gt;tabControl.Name" xml:space="preserve">
<value>tabControl</value>
</data>
<data name="&gt;&gt;tabControl.Type" xml:space="preserve">
<value>System.Windows.Forms.TabControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;tabControl.Parent" xml:space="preserve">
<value>mainSplitContainer.Panel1</value>
</data>
<data name="&gt;&gt;tabControl.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="&gt;&gt;mainSplitContainer.Panel1.Name" xml:space="preserve">
<value>mainSplitContainer.Panel1</value>
</data>
<data name="&gt;&gt;mainSplitContainer.Panel1.Type" xml:space="preserve">
<value>System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;mainSplitContainer.Panel1.Parent" xml:space="preserve">
<value>mainSplitContainer</value>
</data>
<data name="&gt;&gt;mainSplitContainer.Panel1.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="sharedButtons.Location" type="System.Drawing.Point, System.Drawing">
<value>-1, 0</value>
</data>
<data name="sharedButtons.Size" type="System.Drawing.Size, System.Drawing">
<value>100, 636</value>
</data>
<data name="sharedButtons.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="&gt;&gt;sharedButtons.Name" xml:space="preserve">
<value>sharedButtons</value>
</data>
<data name="&gt;&gt;sharedButtons.Type" xml:space="preserve">
<value>TBF.UiControls.SharedButtons, TBF, Version=2.18.1313.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;sharedButtons.Parent" xml:space="preserve">
<value>mainSplitContainer.Panel2</value>
</data>
<data name="&gt;&gt;sharedButtons.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="&gt;&gt;mainSplitContainer.Panel2.Name" xml:space="preserve">
<value>mainSplitContainer.Panel2</value>
</data>
<data name="&gt;&gt;mainSplitContainer.Panel2.Type" xml:space="preserve">
<value>System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;mainSplitContainer.Panel2.Parent" xml:space="preserve">
<value>mainSplitContainer</value>
</data>
<data name="&gt;&gt;mainSplitContainer.Panel2.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="mainSplitContainer.Size" type="System.Drawing.Size, System.Drawing">
<value>863, 366</value>
</data>
<data name="mainSplitContainer.SplitterDistance" type="System.Int32, mscorlib">
<value>760</value>
</data>
<data name="mainSplitContainer.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="&gt;&gt;mainSplitContainer.Name" xml:space="preserve">
<value>mainSplitContainer</value>
</data>
<data name="&gt;&gt;mainSplitContainer.Type" xml:space="preserve">
<value>System.Windows.Forms.SplitContainer, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;mainSplitContainer.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;mainSplitContainer.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>6, 13</value>
</data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>863, 366</value>
</data>
<data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
<value>CenterParent</value>
</data>
<data name="$this.Text" xml:space="preserve">
<value>Conditions</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>ConditionsDlg</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>
+30 -12
View File
@@ -60,19 +60,38 @@ namespace TBF.UI.Bench.Metrology
.OrderBy(x => x. ItemNr).Asc
.List();
// Density tab-page
fixedCount++;
TabPage dstyTabPage = new TabPage(" " + Strings.Density + " ");
MetrologyDlgDensityTab uiCtl = new MetrologyDlgDensityTab();
uiCtl.Dock = DockStyle.Fill;
dstyTabPage.Tag = uiCtl;
dstyTabPage.Controls.Add(uiCtl);
metrologyTabControl.TabPages.Add(dstyTabPage);
foreach (var cmpnt in cmpntEntities)
{
BenchControl.Generic.IComponentFactory factory = TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName);
/// Tab-page density
if (factory is BenchControl.DataContainers.Density.ComponentFactory)
{
fixedCount++;
TabPage tabPage = new TabPage(" " + Strings.Density + " ");
MetrologyDlgDensityTab uiControl = new MetrologyDlgDensityTab();
uiControl.MeterEntity = cmpnt;
uiControl.DensityCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.DataContainers.Density.ComponentCfg;
uiControl.Dock = DockStyle.Fill;
tabPage.Tag = uiControl;
tabPage.Controls.Add(uiControl);
metrologyTabControl.TabPages.Add(tabPage);
}
/// Tab-page buoyancy
if (factory is BenchControl.DataContainers.Buoyancy.ComponentFactory)
{
fixedCount++;
TabPage tabPage = new TabPage(" Buoyancy ");
MetrologyDlgBuoyancyTab uiControl = new MetrologyDlgBuoyancyTab();
uiControl.MeterEntity = cmpnt;
uiControl.BuoyancyCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.DataContainers.Buoyancy.ComponentCfg;
uiControl.Dock = DockStyle.Fill;
tabPage.Tag = uiControl;
tabPage.Controls.Add(uiControl);
metrologyTabControl.TabPages.Add(tabPage);
}
/// Tab-pages for scales
if (factory is BenchControl.MettlerToledo.Standard.BalanceFactory ||
factory is BenchControl.MettlerToledo.Standard.BalanceOldFactory ||
@@ -216,10 +235,9 @@ namespace TBF.UI.Bench.Metrology
foreach (TabPage tabPage in metrologyTabControl.TabPages)
{
IMetrologyDlgTab tab = tabPage.Tag as IMetrologyDlgTab;
tab.OkBtnClicked();
if (!(tabPage.Tag is MetrologyDlgDensityTab))
if (tab != null)
{
tab.OkBtnClicked();
session.SaveOrUpdate(tab.MeterEntity);
foreach (var entity in tab.ToBeRemoved) session.Delete(entity);
}
@@ -190,7 +190,7 @@ namespace TBF.UI.Bench.Metrology
item.SubItems[3].Text = error.ToString(Config.Utils.SignificantDigitsToFmt(error, 5));
}
else
{
{
item.SubItems[3].Text = Strings.NaN;
}
@@ -209,7 +209,7 @@ namespace TBF.UI.Bench.Metrology
item.SubItems[3].Text = error.ToString(Config.Utils.SignificantDigitsToFmt(error, 5));
}
else
{
{
item.SubItems[3].Text = Strings.NaN;
}
@@ -221,7 +221,7 @@ namespace TBF.UI.Bench.Metrology
{
}
else
{
{
double measurement;
if (Utils.TryParseEDouble(item.SubItems[1].Text, out measurement) && measurement != 0)
{
@@ -0,0 +1,97 @@
///
/// Copyright (c) 2013-2015 Senus Slovensko a.s.
///
namespace TBF.UI.Bench.Metrology
{
partial class MetrologyDlgBuoyancyTab
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.buoyancyTextBox = new System.Windows.Forms.TextBox();
this.buoyancyLabel = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.buoyancyTextBox);
this.splitContainer1.Panel1.Controls.Add(this.buoyancyLabel);
this.splitContainer1.Size = new System.Drawing.Size(420, 300);
this.splitContainer1.SplitterDistance = 120;
this.splitContainer1.TabIndex = 1;
//
// buoyancyTextBox
//
this.buoyancyTextBox.Enabled = false;
this.buoyancyTextBox.Location = new System.Drawing.Point(189, 51);
this.buoyancyTextBox.Name = "buoyancyTextBox";
this.buoyancyTextBox.Size = new System.Drawing.Size(110, 20);
this.buoyancyTextBox.TabIndex = 1;
//
// buoyancyLabel
//
this.buoyancyLabel.AutoSize = true;
this.buoyancyLabel.Location = new System.Drawing.Point(41, 54);
this.buoyancyLabel.Name = "buoyancyLabel";
this.buoyancyLabel.Size = new System.Drawing.Size(54, 13);
this.buoyancyLabel.TabIndex = 0;
this.buoyancyLabel.Text = "Buoyancy";
//
// MetrologyDlgBuoyancyTab
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.splitContainer1);
this.Name = "MetrologyDlgBuoyancyTab";
this.Size = new System.Drawing.Size(420, 300);
this.Load += new System.EventHandler(this.MetrologyDlgBuoyancyTab_Load);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.TextBox buoyancyTextBox;
private System.Windows.Forms.Label buoyancyLabel;
}
}
@@ -0,0 +1,132 @@
///
/// Copyright (c) 2013-2019 Senus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using log4net;
using Config.Entities;
using TBF.Resources;
namespace TBF.UI.Bench.Metrology
{
public partial class MetrologyDlgBuoyancyTab : UserControl, IMetrologyDlgTab
{
static readonly ILog log = LogManager.GetLogger(typeof(MetrologyDlgBuoyancyTab));
/// <summary>
/// Component entity that has a list of 'measurement-correction' pairs
/// to be updated in the database on OK.
/// </summary>
public Component MeterEntity
{
get { return meterEntity; }
set { meterEntity = value; }
}
Component meterEntity;
/// <summary>
/// Buoyancy configuration
/// </summary>
public BenchControl.DataContainers.Buoyancy.ComponentCfg BuoyancyCfg;
/// <summary>
/// A list of 'measurement-correction' pairs to be deleted from the database on OK.
/// </summary>
public IList<MeasurementCorrection> ToBeRemoved
{
get { return toBeRemoved; }
set { toBeRemoved = value; }
}
IList<MeasurementCorrection> toBeRemoved;
MetrologyDlg parent;
bool unlocked;
public MetrologyDlgBuoyancyTab()
{
InitializeComponent();
toBeRemoved = new List<MeasurementCorrection>();
unlocked = false;
}
private void MetrologyDlgBuoyancyTab_Load(object sender, System.EventArgs e)
{
if (meterEntity == null) return;
parent = ParentForm as MetrologyDlg;
/// Panel1
buoyancyLabel.Text = "Buoyancy";
/// Panel2
RefreshAll();
}
void RefreshAll()
{
buoyancyTextBox.Text = Config.Data.Buoyancy.ToString("F5");
}
public void Unlock()
{
unlocked = true;
buoyancyTextBox.Enabled = true;
}
public void OkBtnClicked()
{
if (BuoyancyCfg != null)
{
try
{
double buoyancy = Utils.ParseUDouble(buoyancyTextBox.Text);
global::Results.WMeterRsltItemSpec.Buoyancy =
Config.Data.Buoyancy = BuoyancyCfg.Buoyancy = buoyancy;
Component modified = BuoyancyCfg.CreateDbEntity();
MeterEntity.Parameters = modified.Parameters;
}
catch
{
MessageBox.Show(Strings.Invalid_buoyancy_parameter_Correct_pls,
Strings.Error,
MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
}
}
}
public void CancelBtnClicked()
{
}
public void AddOne()
{
}
public void RemoveSelected()
{
}
public void MoveUpSelected()
{
}
public void MoveDownSelected()
{
}
public string GetWarningsBeforeSaving(ref Dictionary<string, string> renmInfo)
{
return string.Empty;
}
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
{
}
}
}
@@ -1,9 +1,8 @@
///
/// Copyright (c) 2013-2017 Senus Slovensko a.s.
/// Copyright (c) 2013-2019 Senus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Windows.Forms;
using log4net;
using Config.Entities;
@@ -21,9 +20,15 @@ namespace TBF.UI.Bench.Metrology
/// </summary>
public Component MeterEntity
{
get { return null; }
set { }
}
get { return meterEntity; }
set { meterEntity = value; }
}
Component meterEntity;
/// <summary>
/// Density configuration
/// </summary>
public BenchControl.DataContainers.Density.ComponentCfg DensityCfg;
/// <summary>
/// A list of 'measurement-correction' pairs to be deleted from the database on OK.
@@ -47,7 +52,9 @@ namespace TBF.UI.Bench.Metrology
private void MetrologyDlgDensityTab_Load(object sender, System.EventArgs e)
{
parent = ParentForm as MetrologyDlg;
if (meterEntity == null) return;
parent = ParentForm as MetrologyDlg;
/// Panel1
densityLabel.Text = string.Format("{0} [{1}]", Strings.Density, Config.Unit.kgpm3.ToDescription());
@@ -61,9 +68,9 @@ namespace TBF.UI.Bench.Metrology
void RefreshAll()
{
densityTextBox.Text = Program.LocalSettings.RealDensity.ToString("F4");
temperatureTextBox.Text = Program.LocalSettings.AtTemperature.ToString("F2");
densityCorrTextBox.Text = Config.Formulas.DensityCorrection(Program.LocalSettings.RealDensity, Program.LocalSettings.AtTemperature).ToString("F5");
densityTextBox.Text = Config.Data.RealDensity.ToString("F4");
temperatureTextBox.Text = Config.Data.AtTemperature.ToString("F2");
densityCorrTextBox.Text = Config.Formulas.DensityCorrection(Config.Data.RealDensity, Config.Data.AtTemperature).ToString("F5");
}
public void Unlock()
@@ -76,16 +83,30 @@ namespace TBF.UI.Bench.Metrology
public void OkBtnClicked()
{
double tmp;
if (Utils.TryParseUDouble(densityTextBox.Text, out tmp))
{
Program.LocalSettings.RealDensity = tmp;
}
if (Utils.TryParseUDouble(temperatureTextBox.Text, out tmp))
{
Program.LocalSettings.AtTemperature = tmp;
}
Program.LocalSettings.Save();
if (DensityCfg != null)
{
try
{
double realDensity = Utils.ParseUDouble(densityTextBox.Text);
double atTemperature = Utils.ParseUDouble(temperatureTextBox.Text);
global::Results.WMeterRsltItemSpec.RealDensity =
Config.Data.RealDensity = DensityCfg.RealDensity = realDensity;
global::Results.WMeterRsltItemSpec.AtTemperature =
Config.Data.AtTemperature = DensityCfg.AtTemperature = atTemperature;
Component modified = DensityCfg.CreateDbEntity();
MeterEntity.Parameters = modified.Parameters;
}
catch
{
MessageBox.Show(Strings.Invalid_density_parameter_Correct_pls,
Strings.Error,
MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
}
}
}
public void CancelBtnClicked()
@@ -154,7 +154,7 @@ namespace TBF.UI.Bench.Metrology
item.SubItems[3].Text = error.ToString(Config.Utils.SignificantDigitsToFmt(error, 5));
}
else
{
{
item.SubItems[3].Text = Strings.NaN;
}
@@ -173,7 +173,7 @@ namespace TBF.UI.Bench.Metrology
item.SubItems[3].Text = error.ToString(Config.Utils.SignificantDigitsToFmt(error, 5));
}
else
{
{
item.SubItems[3].Text = Strings.NaN;
}
@@ -185,7 +185,7 @@ namespace TBF.UI.Bench.Metrology
{
}
else
{
{
double measurement;
if (Utils.TryParseEDouble(item.SubItems[1].Text, out measurement) && measurement != 0)
{
@@ -154,7 +154,7 @@ namespace TBF.UI.Bench.Metrology
item.SubItems[3].Text = error.ToString(Config.Utils.SignificantDigitsToFmt(error, 5));
}
else
{
{
item.SubItems[3].Text = Strings.NaN;
}
@@ -173,7 +173,7 @@ namespace TBF.UI.Bench.Metrology
item.SubItems[3].Text = error.ToString(Config.Utils.SignificantDigitsToFmt(error, 5));
}
else
{
{
item.SubItems[3].Text = Strings.NaN;
}
@@ -185,7 +185,7 @@ namespace TBF.UI.Bench.Metrology
{
}
else
{
{
double measurement;
if (Utils.TryParseEDouble(item.SubItems[1].Text, out measurement) && measurement != 0)
{
@@ -23,7 +23,6 @@ namespace TBF.UI.Bench.Transitions
/// Used when re-scaling the dialog: 100% = 96dpi, 125% = 120dpi, 150% = 144dpi
public readonly int Dpi;
public const int Dpi100pct = 96;
/// <summary>
/// Fluent-NHibernate database session
@@ -0,0 +1,22 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System.Collections.Generic;
using Config.Entities;
namespace TBF.UI.Bench.Uncertainties
{
interface IUncetaintiesDlgTab : TBF.UI.Shared.ITabWithListViewEx
{
/// <summary>
/// Component entity that has a list of 'measurement-correction' pairs
/// to be updated in the database on OK.
/// </summary>
Component MeterEntity { get; set; }
/// <summary>
/// A list of 'measurement-correction' pairs to be deleted from the database on OK.
/// </summary>
IList<Uncertainty> ToBeRemoved { get; set; }
}
}
@@ -0,0 +1,323 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using NHibernate;
using log4net;
using Config.Entities;
using TBF.BenchControl;
using TBF.Resources;
using TBF.UI.Shared;
namespace TBF.UI.Bench.Uncertainties
{
public partial class UncertaintiesDlg : Form, IParentOfListViewEx
{
static readonly ILog log = LogManager.GetLogger(typeof(UncertaintiesDlg));
public IList<Component> cmpntEntities;
ISession session;
public UncertaintiesDlg()
{
InitializeComponent();
/// SharedDlgButtons configuration
#if KEMPNO_50
sharedButtons.RequiredGroupMembership = new Users.Grp.GID[] { Users.Grp.GID.MetrologicalAuthority };
#else
sharedButtons.RequiredGroupMembership = new Users.Grp.GID[] { Users.Grp.GID.Metrologists };
#endif
sharedButtons.OptionalButtons = SharedButtons.Buttons.Add | SharedButtons.Buttons.Remove;
sharedButtons.Unlocked += unlockButton_Click;
sharedButtons.OKClicked += okButton_Click;
sharedButtons.CancelClicked += cancelButton_Click;
sharedButtons.AddClicked += addButton_Click;
sharedButtons.RemoveClicked += removeButton_Click;
}
private void UncertaintiesDlg_Load(object sender, EventArgs e)
{
LoadUISettings();
Text = Strings.Uncertainty;
int fixedCount = 0;
int balancesCount = 0;
int levelMetersCount = 0;
int divertersCount = 0;
int flowMetersCount = 0;
int pressMetersCount = 0;
int tempMetersCount = 0;
int evaporationsCount = 0;
session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config);
cmpntEntities = session.QueryOver<Component>()
.OrderBy(x => x. ItemNr).Asc
.List();
foreach (var cmpnt in cmpntEntities)
{
BenchControl.Generic.IComponentFactory factory = TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName);
/// Tab-page density
if (factory is BenchControl.DataContainers.Density.ComponentFactory)
{
fixedCount++;
TabPage tabPage = new TabPage(" " + Strings.Density + " ");
UncertntDlgDensityTab uiControl = new UncertntDlgDensityTab();
uiControl.MeterEntity = cmpnt;
uiControl.DensityCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.DataContainers.Density.ComponentCfg;
uiControl.Dock = DockStyle.Fill;
tabPage.Tag = uiControl;
tabPage.Controls.Add(uiControl);
uncertaintiesTabControl.TabPages.Add(tabPage);
}
/// Tab-page buoyancy
if (factory is BenchControl.DataContainers.Buoyancy.ComponentFactory)
{
fixedCount++;
TabPage tabPage = new TabPage(" Buoyancy ");
UncertntDlgBuoyancyTab uiControl = new UncertntDlgBuoyancyTab();
uiControl.MeterEntity = cmpnt;
uiControl.BuoyancyCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.DataContainers.Buoyancy.ComponentCfg;
uiControl.Dock = DockStyle.Fill;
tabPage.Tag = uiControl;
tabPage.Controls.Add(uiControl);
uncertaintiesTabControl.TabPages.Add(tabPage);
}
/// Tab-pages for scales
if (factory is BenchControl.MettlerToledo.Standard.BalanceFactory ||
factory is BenchControl.MettlerToledo.Standard.BalanceOldFactory ||
factory is BenchControl.MettlerToledo.Standard.BalanceNewFactory ||
factory is BenchControl.MettlerToledo.Multi.BalanceFactory)
{
balancesCount++;
TabPage tabPage = new TabPage(" " + cmpnt.Name + " ");
UncertntDlgScaleTab uiControl = new UncertntDlgScaleTab();
uiControl.MeterEntity = cmpnt;
uiControl.ScaleCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.GenericDevices.IScaleCfg;
uiControl.Dock = DockStyle.Fill;
tabPage.Tag = uiControl;
tabPage.Controls.Add(uiControl);
uncertaintiesTabControl.TabPages.Add(tabPage);
}
///// Tab-pages for flowmeters
//if (factory is BenchControl.Elde.FlowMeter.FlowMeterFactory)
//{
// BenchControl.Elde.FlowMeter.FlowMeterCfg flowMeterCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.Elde.FlowMeter.FlowMeterCfg;
// for (int r = 0; r <= 5; r++)
// {
// if (flowMeterCfg.RangeEnabled(r))
// {
// flowMetersCount++;
// TabPage tabPage = new TabPage(string.Format(((r == 0) ? " {0} " : " {0} r{1} "), cmpnt.Name, r));
// MetrologyDlgFlowMeterTab uiControl = new MetrologyDlgFlowMeterTab(r);
// uiControl.MeterEntity = cmpnt;
// uiControl.CalibInfoCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.GenericDevices.ICalibRangesCfg;
// uiControl.Dock = DockStyle.Fill;
// tabPage.Tag = uiControl;
// tabPage.Controls.Add(uiControl);
// metrologyTabControl.TabPages.Add(tabPage);
// }
// }
//}
/// Tab-pages for pressure meters
if (factory is BenchControl.Elde.PressureMeter.PressureMeterFactory ||
factory is BenchControl.Elde.PressureMeterInternal.PressureMeterFactory ||
factory is BenchControl.Modbus.PressureMeter.Meret.Factory)
{
pressMetersCount++;
TabPage tabPage = new TabPage(" " + cmpnt.Name + " ");
UncertntDlgPressMeterTab uiControl = new UncertntDlgPressMeterTab();
uiControl.MeterEntity = cmpnt;
uiControl.Dock = DockStyle.Fill;
tabPage.Tag = uiControl;
tabPage.Controls.Add(uiControl);
uncertaintiesTabControl.TabPages.Add(tabPage);
}
/// Tab-pages for temperature meters (incl. platinum temp. meter with Keithley)
if (factory is BenchControl.Elde.TempMeter.TempMeterFactory ||
factory is BenchControl.Elde.TempMeterInternal.TempMeterFactory ||
factory is BenchControl.Keithley.TempMeter.Factory)
{
tempMetersCount++;
TabPage tabPage = new TabPage(" " + cmpnt.Name + " ");
UncertntDlgTempMeterTab uiControl = new UncertntDlgTempMeterTab();
uiControl.MeterEntity = cmpnt;
uiControl.Dock = DockStyle.Fill;
tabPage.Tag = uiControl;
tabPage.Controls.Add(uiControl);
uncertaintiesTabControl.TabPages.Add(tabPage);
}
///// Tab-pages for diverters
//if (factory is BenchControl.Elde.Diverter.DiverterFactory)
//{
// divertersCount++;
// TabPage tabPage = new TabPage(" " + cmpnt.Name + " ");
// MetrologyDlgDiverterTab uiControl = new MetrologyDlgDiverterTab();
// uiControl.MeterEntity = cmpnt;
// uiControl.CalibInfoCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.GenericDevices.ICalibInfoCfg;
// uiControl.Dock = DockStyle.Fill;
// tabPage.Tag = uiControl;
// tabPage.Controls.Add(uiControl);
// metrologyTabControl.TabPages.Add(tabPage);
//}
///// Tab-pages for level meters inside water tanks
//if (factory is BenchControl.Hart.Nivotrack.Factory)
//{
// levelMetersCount++;
// TabPage tabPage = new TabPage(" " + cmpnt.Name + " ");
// MetrologyDlgLevelMeterTab uiControl = new MetrologyDlgLevelMeterTab();
// uiControl.MeterEntity = cmpnt;
// uiControl.CalibInfoCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.GenericDevices.ICalibInfoCfg;
// uiControl.Dock = DockStyle.Fill;
// tabPage.Tag = uiControl;
// tabPage.Controls.Add(uiControl);
// metrologyTabControl.TabPages.Add(tabPage);
//}
///// Tab-pages for water tank evaporation rates
//if (factory is BenchControl.Various.Evaporation.Factory)
//{
// evaporationsCount++;
// TabPage tabPage = new TabPage(" " + cmpnt.Name + " ");
// MetrologyDlgEvaporationTab uiControl = new MetrologyDlgEvaporationTab();
// uiControl.MeterEntity = cmpnt;
// uiControl.CalibInfoCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.GenericDevices.ICalibInfoCfg;
// uiControl.Dock = DockStyle.Fill;
// tabPage.Tag = uiControl;
// tabPage.Controls.Add(uiControl);
// metrologyTabControl.TabPages.Add(tabPage);
//}
}
}
private void unlockButton_Click(object sender, EventArgs e)
{
foreach (TabPage tabPage in uncertaintiesTabControl.TabPages)
{
(tabPage.Tag as IUncetaintiesDlgTab).Unlock();
}
}
private void okButton_Click(object sender, EventArgs e)
{
using (ITransaction transaction = session.BeginTransaction())
{
try
{
foreach (TabPage tabPage in uncertaintiesTabControl.TabPages)
{
IUncetaintiesDlgTab tab = tabPage.Tag as IUncetaintiesDlgTab;
if (tab != null)
{
tab.OkBtnClicked();
session.SaveOrUpdate(tab.MeterEntity);
foreach (var entity in tab.ToBeRemoved) session.Delete(entity);
}
}
transaction.Commit();
session.Flush();
}
catch (Exception exc)
{
transaction.Rollback();
log.ErrorFormat("Cannot save changes to DB: {0}", exc.Message);
MessageBox.Show(Strings.Cannot_save_changes, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
SaveUISettings();
DialogResult = DialogResult.OK;
Close();
}
private void cancelButton_Click(object sender, EventArgs e)
{
foreach (TabPage tabPage in uncertaintiesTabControl.TabPages)
{
(tabPage.Tag as IUncetaintiesDlgTab).CancelBtnClicked();
}
SaveUISettings();
DialogResult = DialogResult.Cancel;
Close();
}
private void SaveUISettings()
{
/// Obtain UncertaintyDlg dimensions, etc.
bool isMaximized = (WindowState == FormWindowState.Maximized);
int left = (WindowState == FormWindowState.Normal) ? Location.X : RestoreBounds.Left;
int top = (WindowState == FormWindowState.Normal) ? Location.Y : RestoreBounds.Top;
int width = (WindowState == FormWindowState.Normal) ? Size.Width : RestoreBounds.Width;
int height = (WindowState == FormWindowState.Normal) ? Size.Height : RestoreBounds.Height;
LocalSettings ls = Program.LocalSettings;
if (ls != null && (ls.UncertaintyDlgMaximized != isMaximized ||
ls.UncertaintyDlgLeft != left ||
ls.UncertaintyDlgTop != top ||
ls.UncertaintyDlgWidth != width ||
ls.UncertaintyDlgHeight != height))
{
/// At least one UncertaintyDlg dimension differs => Update local settings and save them
ls.UncertaintyDlgMaximized = isMaximized;
ls.UncertaintyDlgLeft = left;
ls.UncertaintyDlgTop = top;
ls.UncertaintyDlgWidth = width;
ls.UncertaintyDlgHeight = height;
ls.Save();
}
}
private void LoadUISettings()
{
TBF.LocalSettings ls = Program.LocalSettings;
WindowState = (ls.UncertaintyDlgMaximized ? FormWindowState.Maximized : FormWindowState.Normal);
Width = (ls.UncertaintyDlgWidth > 0) ? ls.UncertaintyDlgWidth : 900;
Height = (ls.UncertaintyDlgHeight > 0) ? ls.UncertaintyDlgHeight : 500;
Left = (ls.UncertaintyDlgLeft != 0) ? ls.UncertaintyDlgLeft : 200;
Top = (ls.UncertaintyDlgTop != 0) ? ls.UncertaintyDlgTop : 100;
}
private void addButton_Click(object sender, EventArgs e)
{
(uncertaintiesTabControl.SelectedTab.Tag as IUncetaintiesDlgTab).AddOne();
}
private void removeButton_Click(object sender, EventArgs e)
{
(uncertaintiesTabControl.SelectedTab.Tag as IUncetaintiesDlgTab).RemoveSelected();
}
public void UpdateButtonStates(SharedButtons.SelectedItemPos selectedItemPos)
{
if (selectedItemPos == SharedButtons.SelectedItemPos.None)
{
sharedButtons.DisableButtons(SharedButtons.Buttons.Remove);
}
else
{
sharedButtons.EnableButtons(SharedButtons.Buttons.Remove);
}
}
private void metrologyTabControl_SelectedIndexChanged(object sender, EventArgs e)
{
sharedButtons.DisableButtons(SharedButtons.Buttons.Remove);
}
}
}
+103
View File
@@ -0,0 +1,103 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
namespace TBF.UI.Bench.Uncertainties
{
partial class UncertaintiesDlg
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.splitContainer = new System.Windows.Forms.SplitContainer();
this.uncertaintiesTabControl = new System.Windows.Forms.TabControl();
this.sharedButtons = new TBF.UI.Shared.SharedButtons();
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
this.splitContainer.Panel1.SuspendLayout();
this.splitContainer.Panel2.SuspendLayout();
this.splitContainer.SuspendLayout();
this.SuspendLayout();
//
// splitContainer
//
this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
this.splitContainer.Location = new System.Drawing.Point(0, 0);
this.splitContainer.Name = "splitContainer";
//
// splitContainer.Panel1
//
this.splitContainer.Panel1.Controls.Add(this.uncertaintiesTabControl);
//
// splitContainer.Panel2
//
this.splitContainer.Panel2.Controls.Add(this.sharedButtons);
this.splitContainer.Size = new System.Drawing.Size(965, 344);
this.splitContainer.SplitterDistance = 863;
this.splitContainer.TabIndex = 0;
//
// uncertaintiesTabControl
//
this.uncertaintiesTabControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.uncertaintiesTabControl.ItemSize = new System.Drawing.Size(60, 30);
this.uncertaintiesTabControl.Location = new System.Drawing.Point(0, 0);
this.uncertaintiesTabControl.Name = "uncertaintiesTabControl";
this.uncertaintiesTabControl.SelectedIndex = 0;
this.uncertaintiesTabControl.Size = new System.Drawing.Size(863, 344);
this.uncertaintiesTabControl.TabIndex = 0;
this.uncertaintiesTabControl.SelectedIndexChanged += new System.EventHandler(this.metrologyTabControl_SelectedIndexChanged);
//
// sharedButtons
//
this.sharedButtons.Location = new System.Drawing.Point(-2, 0);
this.sharedButtons.Name = "sharedButtons";
this.sharedButtons.Size = new System.Drawing.Size(100, 400);
this.sharedButtons.TabIndex = 0;
//
// UncertaintiesDlg
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(965, 344);
this.Controls.Add(this.splitContainer);
this.Name = "UncertaintiesDlg";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Uncertainty";
this.Load += new System.EventHandler(this.UncertaintiesDlg_Load);
this.splitContainer.Panel1.ResumeLayout(false);
this.splitContainer.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
this.splitContainer.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer;
private System.Windows.Forms.TabControl uncertaintiesTabControl;
private TBF.UI.Shared.SharedButtons sharedButtons;
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,132 @@
///
/// Copyright (c) 2019 Senus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using log4net;
using Config.Entities;
using TBF.Resources;
namespace TBF.UI.Bench.Uncertainties
{
public partial class UncertntDlgBuoyancyTab : UserControl, IUncetaintiesDlgTab
{
static readonly ILog log = LogManager.GetLogger(typeof(UncertntDlgBuoyancyTab));
/// <summary>
/// Component entity that has a list of 'measurement-correction' pairs
/// to be updated in the database on OK.
/// </summary>
public Component MeterEntity
{
get { return meterEntity; }
set { meterEntity = value; }
}
Component meterEntity;
/// <summary>
/// Buoyancy configuration
/// </summary>
public BenchControl.DataContainers.Buoyancy.ComponentCfg BuoyancyCfg;
/// <summary>
/// A list of 'measurement-correction' pairs to be deleted from the database on OK.
/// </summary>
public IList<Uncertainty> ToBeRemoved
{
get { return toBeRemoved; }
set { toBeRemoved = value; }
}
IList<Uncertainty> toBeRemoved;
UncertaintiesDlg parent;
bool unlocked;
public UncertntDlgBuoyancyTab()
{
InitializeComponent();
toBeRemoved = new List<Uncertainty>();
unlocked = false;
}
private void MetrologyDlgBuoyancyTab_Load(object sender, System.EventArgs e)
{
if (meterEntity == null) return;
parent = ParentForm as UncertaintiesDlg;
/// Panel1
buoyancyLabel.Text = "Buoyancy";
/// Panel2
RefreshAll();
}
void RefreshAll()
{
buoyancyTextBox.Text = Config.Data.Buoyancy.ToString("F5");
}
public void Unlock()
{
unlocked = true;
buoyancyTextBox.Enabled = true;
}
public void OkBtnClicked()
{
if (BuoyancyCfg != null)
{
try
{
double buoyancy = Utils.ParseUDouble(buoyancyTextBox.Text);
global::Results.WMeterRsltItemSpec.Buoyancy =
Config.Data.Buoyancy = BuoyancyCfg.Buoyancy = buoyancy;
Component modified = BuoyancyCfg.CreateDbEntity();
MeterEntity.Parameters = modified.Parameters;
}
catch
{
MessageBox.Show(Strings.Invalid_buoyancy_parameter_Correct_pls,
Strings.Error,
MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
}
}
}
public void CancelBtnClicked()
{
}
public void AddOne()
{
}
public void RemoveSelected()
{
}
public void MoveUpSelected()
{
}
public void MoveDownSelected()
{
}
public string GetWarningsBeforeSaving(ref Dictionary<string, string> renmInfo)
{
return string.Empty;
}
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
{
}
}
}
@@ -0,0 +1,97 @@
///
/// Copyright (c) 2019 Senus Slovensko a.s.
///
namespace TBF.UI.Bench.Uncertainties
{
partial class UncertntDlgBuoyancyTab
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.buoyancyTextBox = new System.Windows.Forms.TextBox();
this.buoyancyLabel = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.buoyancyTextBox);
this.splitContainer1.Panel1.Controls.Add(this.buoyancyLabel);
this.splitContainer1.Size = new System.Drawing.Size(420, 300);
this.splitContainer1.SplitterDistance = 120;
this.splitContainer1.TabIndex = 1;
//
// buoyancyTextBox
//
this.buoyancyTextBox.Enabled = false;
this.buoyancyTextBox.Location = new System.Drawing.Point(189, 51);
this.buoyancyTextBox.Name = "buoyancyTextBox";
this.buoyancyTextBox.Size = new System.Drawing.Size(110, 20);
this.buoyancyTextBox.TabIndex = 1;
//
// buoyancyLabel
//
this.buoyancyLabel.AutoSize = true;
this.buoyancyLabel.Location = new System.Drawing.Point(41, 54);
this.buoyancyLabel.Name = "buoyancyLabel";
this.buoyancyLabel.Size = new System.Drawing.Size(54, 13);
this.buoyancyLabel.TabIndex = 0;
this.buoyancyLabel.Text = "Buoyancy";
//
// MetrologyDlgBuoyancyTab
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.splitContainer1);
this.Name = "MetrologyDlgBuoyancyTab";
this.Size = new System.Drawing.Size(420, 300);
this.Load += new System.EventHandler(this.MetrologyDlgBuoyancyTab_Load);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.TextBox buoyancyTextBox;
private System.Windows.Forms.Label buoyancyLabel;
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,162 @@
///
/// Copyright (c) 2019 Senus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using log4net;
using Config.Entities;
using TBF.Resources;
namespace TBF.UI.Bench.Uncertainties
{
public partial class UncertntDlgDensityTab : UserControl, IUncetaintiesDlgTab
{
static readonly ILog log = LogManager.GetLogger(typeof(UncertntDlgDensityTab));
/// <summary>
/// Component entity that has a list of 'measurement-correction' pairs
/// to be updated in the database on OK.
/// </summary>
public Component MeterEntity
{
get { return meterEntity; }
set { meterEntity = value; }
}
Component meterEntity;
/// <summary>
/// Density configuration
/// </summary>
public BenchControl.DataContainers.Density.ComponentCfg DensityCfg;
/// <summary>
/// A list of 'measurement-correction' pairs to be deleted from the database on OK.
/// </summary>
public IList<Uncertainty> ToBeRemoved
{
get { return toBeRemoved; }
set { toBeRemoved = value; }
}
IList<Uncertainty> toBeRemoved;
UncertaintiesDlg parent;
bool unlocked;
public UncertntDlgDensityTab()
{
InitializeComponent();
toBeRemoved = new List<Uncertainty>();
unlocked = false;
}
private void MetrologyDlgDensityTab_Load(object sender, System.EventArgs e)
{
if (meterEntity == null) return;
parent = ParentForm as UncertaintiesDlg;
/// Panel1
densityLabel.Text = string.Format("{0} [{1}]", Strings.Density, Config.Unit.kgpm3.ToDescription());
temperatureLabel.Text = string.Format("{0} [{1}]", Strings.At_temperature, Config.Unit.C.ToDescription());
densityCorrLabel.Text = string.Format("{0} [{1}]", Strings.Density_correction, Config.Unit.kgpm3.ToDescription());
/// Panel2
RefreshAll();
}
void RefreshAll()
{
densityTextBox.Text = Config.Data.RealDensity.ToString("F4");
temperatureTextBox.Text = Config.Data.AtTemperature.ToString("F2");
densityCorrTextBox.Text = Config.Formulas.DensityCorrection(Config.Data.RealDensity, Config.Data.AtTemperature).ToString("F5");
}
public void Unlock()
{
unlocked = true;
densityTextBox.Enabled = true;
temperatureTextBox.Enabled = true;
}
public void OkBtnClicked()
{
if (DensityCfg != null)
{
try
{
double realDensity = Utils.ParseUDouble(densityTextBox.Text);
double atTemperature = Utils.ParseUDouble(temperatureTextBox.Text);
global::Results.WMeterRsltItemSpec.RealDensity =
Config.Data.RealDensity = DensityCfg.RealDensity = realDensity;
global::Results.WMeterRsltItemSpec.AtTemperature =
Config.Data.AtTemperature = DensityCfg.AtTemperature = atTemperature;
Component modified = DensityCfg.CreateDbEntity();
MeterEntity.Parameters = modified.Parameters;
}
catch
{
MessageBox.Show(Strings.Invalid_density_parameter_Correct_pls,
Strings.Error,
MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
}
}
}
public void CancelBtnClicked()
{
}
public void AddOne()
{
}
public void RemoveSelected()
{
}
public void MoveUpSelected()
{
}
public void MoveDownSelected()
{
}
public string GetWarningsBeforeSaving(ref Dictionary<string, string> renmInfo)
{
return string.Empty;
}
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
{
}
private void densityTextBox_TextChanged(object sender, EventArgs e)
{
UpdateDensityCorrectionDisplay();
}
private void temperatureTextBox_TextChanged(object sender, EventArgs e)
{
UpdateDensityCorrectionDisplay();
}
void UpdateDensityCorrectionDisplay()
{
double density;
double temp;
if (Utils.TryParseUDouble(densityTextBox.Text, out density) &&
Utils.TryParseUDouble(temperatureTextBox.Text, out temp))
{
densityCorrTextBox.Text = Config.Formulas.DensityCorrection(density, temp).ToString();
}
}
}
}
@@ -0,0 +1,145 @@
///
/// Copyright (c) 2019 Senus Slovensko a.s.
///
namespace TBF.UI.Bench.Uncertainties
{
partial class UncertntDlgDensityTab
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.densityCorrTextBox = new System.Windows.Forms.TextBox();
this.densityCorrLabel = new System.Windows.Forms.Label();
this.temperatureTextBox = new System.Windows.Forms.TextBox();
this.temperatureLabel = new System.Windows.Forms.Label();
this.densityTextBox = new System.Windows.Forms.TextBox();
this.densityLabel = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.densityCorrTextBox);
this.splitContainer1.Panel1.Controls.Add(this.densityCorrLabel);
this.splitContainer1.Panel1.Controls.Add(this.temperatureTextBox);
this.splitContainer1.Panel1.Controls.Add(this.temperatureLabel);
this.splitContainer1.Panel1.Controls.Add(this.densityTextBox);
this.splitContainer1.Panel1.Controls.Add(this.densityLabel);
this.splitContainer1.Size = new System.Drawing.Size(420, 300);
this.splitContainer1.SplitterDistance = 120;
this.splitContainer1.TabIndex = 1;
//
// densityCorrTextBox
//
this.densityCorrTextBox.Enabled = false;
this.densityCorrTextBox.Location = new System.Drawing.Point(185, 86);
this.densityCorrTextBox.Name = "densityCorrTextBox";
this.densityCorrTextBox.Size = new System.Drawing.Size(110, 20);
this.densityCorrTextBox.TabIndex = 5;
//
// densityCorrLabel
//
this.densityCorrLabel.AutoSize = true;
this.densityCorrLabel.Location = new System.Drawing.Point(37, 89);
this.densityCorrLabel.Name = "densityCorrLabel";
this.densityCorrLabel.Size = new System.Drawing.Size(132, 13);
this.densityCorrLabel.TabIndex = 4;
this.densityCorrLabel.Text = "Density correction [kg/m3]";
//
// temperatureTextBox
//
this.temperatureTextBox.Enabled = false;
this.temperatureTextBox.Location = new System.Drawing.Point(185, 43);
this.temperatureTextBox.Name = "temperatureTextBox";
this.temperatureTextBox.Size = new System.Drawing.Size(110, 20);
this.temperatureTextBox.TabIndex = 3;
this.temperatureTextBox.TextChanged += new System.EventHandler(this.temperatureTextBox_TextChanged);
//
// temperatureLabel
//
this.temperatureLabel.AutoSize = true;
this.temperatureLabel.Location = new System.Drawing.Point(37, 46);
this.temperatureLabel.Name = "temperatureLabel";
this.temperatureLabel.Size = new System.Drawing.Size(112, 13);
this.temperatureLabel.TabIndex = 2;
this.temperatureLabel.Text = "@Temperature [degC]";
//
// densityTextBox
//
this.densityTextBox.Enabled = false;
this.densityTextBox.Location = new System.Drawing.Point(185, 17);
this.densityTextBox.Name = "densityTextBox";
this.densityTextBox.Size = new System.Drawing.Size(110, 20);
this.densityTextBox.TabIndex = 1;
this.densityTextBox.TextChanged += new System.EventHandler(this.densityTextBox_TextChanged);
//
// densityLabel
//
this.densityLabel.AutoSize = true;
this.densityLabel.Location = new System.Drawing.Point(37, 20);
this.densityLabel.Name = "densityLabel";
this.densityLabel.Size = new System.Drawing.Size(82, 13);
this.densityLabel.TabIndex = 0;
this.densityLabel.Text = "Density [kg/m3]";
//
// MetrologyDlgDensityTab
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.splitContainer1);
this.Name = "MetrologyDlgDensityTab";
this.Size = new System.Drawing.Size(420, 300);
this.Load += new System.EventHandler(this.MetrologyDlgDensityTab_Load);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.TextBox temperatureTextBox;
private System.Windows.Forms.Label temperatureLabel;
private System.Windows.Forms.TextBox densityTextBox;
private System.Windows.Forms.Label densityLabel;
private System.Windows.Forms.TextBox densityCorrTextBox;
private System.Windows.Forms.Label densityCorrLabel;
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,264 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Windows.Forms;
using log4net;
using Config.Entities;
using Results.Forms;
using TBF.Resources;
using TBF.UI.Shared;
namespace TBF.UI.Bench.Uncertainties
{
public partial class UncertntDlgPressMeterTab : UserControl, IUncetaintiesDlgTab
{
static readonly ILog log = LogManager.GetLogger(typeof(UncertntDlgPressMeterTab));
/// <summary>
/// Component entity that has a list of 'measurement-correction' pairs
/// to be updated in the database on OK.
/// </summary>
Component meterEntity;
public Component MeterEntity
{
get { return meterEntity; }
set { meterEntity = value; }
}
/// <summary>
/// A list of 'measurement-correction' pairs to be deleted from the database on OK.
/// </summary>
public IList<Uncertainty> ToBeRemoved
{
get { return toBeRemoved; }
set { toBeRemoved = value; }
}
IList<Uncertainty> toBeRemoved;
UncertaintiesDlg parent;
bool unlocked;
Control[] textBoxes;
public UncertntDlgPressMeterTab()
{
InitializeComponent();
toBeRemoved = new List<Uncertainty>();
}
private void UncertntDlgPressMeterTab_Load(object sender, System.EventArgs e)
{
if (meterEntity == null) return;
parent = ParentForm as UncertaintiesDlg;
/// Panel1
cmpntLabel.Text = Strings.Component;
cmpntNameLabel.Text = meterEntity.Name;
/// Panel2
listViewEx.SubItemClicked += new SubItemEventHandler(listViewEx_SubItemClicked);
listViewEx.SubItemEndEditing += new SubItemEndEditingEventHandler(listViewEx_SubItemEndEditing);
listViewEx.Columns.Add(new ColumnHeader() { Text = Strings.Nr, Width = 40 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [bar]", Strings.Pressure), Width = 100 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [mbar]", Strings.Main_uncertainty), Width = 120 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [mbar]", Strings.Resolution), Width = 100 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [mbar/year]", Strings.Drift_per_year), Width = 120 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [mbar]", Strings.Conditions), Width = 100 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [mbar]", Strings.Uncertainty_of_correction), Width = 160 });
textBoxes = new TextBox[listViewEx.Columns.Count];
for (int i = 1; i < textBoxes.Length; i++)
{
this.Controls.Add(textBoxes[i] = new TextBox());
}
RefreshAll();
}
void RefreshAll()
{
listViewEx.Items.Clear();
foreach (var uncrtnty in MeterEntity.Uncertainties) AddOneLVI(uncrtnty);
}
void AddOneLVI(Uncertainty corr)
{
int nr = listViewEx.Items.Count + 1;
ListViewItem lvi = new ListViewItem(nr.ToString());
lvi.Tag = corr;
lvi.SubItems.Add(corr.Measurement.ToString());
lvi.SubItems.Add((1000 * corr.MainUncertainty).ToString());
lvi.SubItems.Add((1000 * corr.Resolution).ToString());
lvi.SubItems.Add((1000 * corr.DriftPerYr).ToString());
lvi.SubItems.Add((1000 * corr.Conditions).ToString());
lvi.SubItems.Add((1000 * corr.UncertaintyOfCorrection).ToString());
listViewEx.Items.Add(lvi);
}
void listViewEx_SubItemClicked(object sender, SubItemEventArgs e)
{
if (unlocked && (e.SubItem >= 1) && (e.SubItem < listViewEx.Columns.Count))
{
/// This is not the first column
listViewEx.StartEditing(textBoxes[e.SubItem], e.Item, e.SubItem);
}
}
void listViewEx_SubItemEndEditing(object sender, SubItemEndEditingEventArgs e)
{
if (ParseItem(e.Item, e.SubItem, e.DisplayText)) return;
/// New value is NOK, revert the original text
e.DisplayText = e.Item.Text;
e.Cancel = true;
}
/// <summary>
/// Parse text of a ListViewItem
/// </summary>
/// <returns>true = value parsed OK</returns>
bool ParseItem(ListViewItem item, int subItem, string strValue)
{
Uncertainty uncrtnty = item.Tag as Uncertainty;
double dblValue = 0;
if ((uncrtnty != null) && Utils.TryParseEDouble(strValue, out dblValue) && (dblValue >= 0))
{
double inDefaultUnits = dblValue / 1000;
switch (subItem)
{
case 1:
uncrtnty.Measurement = (float)dblValue;
return true;
case 2:
uncrtnty.MainUncertainty = (float)inDefaultUnits;
return true;
case 3:
uncrtnty.Resolution = (float)inDefaultUnits;
return true;
case 4:
uncrtnty.DriftPerYr = (float)inDefaultUnits;
return true;
case 5:
uncrtnty.Conditions = (float)inDefaultUnits;
return true;
case 6:
uncrtnty.UncertaintyOfCorrection = (float)inDefaultUnits;
return true;
default:
return false;
}
}
else
{
return false;
}
}
public void Unlock()
{
unlocked = true;
if (listViewEx.SelectedItems.Count == 1)
{
int ix = listViewEx.SelectedIndices[0];
listViewEx.Focus();
listViewEx.Items[ix].Selected = true;
listViewEx.Items[ix].EnsureVisible();
}
}
public void OkBtnClicked()
{
}
public void CancelBtnClicked()
{
}
public void AddOne()
{
Uncertainty uncrtnty = new Uncertainty();
MeterEntity.Uncertainties.Add(uncrtnty);
AddOneLVI(uncrtnty);
listViewEx.Focus();
listViewEx.SelectedItems.Clear();
listViewEx.Items[listViewEx.Items.Count - 1].Selected = true;
listViewEx.Items[listViewEx.Items.Count - 1].EnsureVisible();
}
public void RemoveSelected()
{
if (listViewEx.SelectedItems.Count != 1) return;
int removeItemNr = listViewEx.SelectedIndices[0];
Uncertainty selected =
(Uncertainty)listViewEx.SelectedItems[0].Tag;
if (selected.Id != 0) toBeRemoved.Add(selected);
MeterEntity.Corrections.RemoveAt(removeItemNr);
RefreshAll();
if (removeItemNr < listViewEx.Items.Count)
{
listViewEx.Focus();
listViewEx.Items[removeItemNr].Selected = true;
listViewEx.Items[removeItemNr].EnsureVisible();
}
else
{
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.None);
}
}
public void MoveUpSelected()
{
}
public void MoveDownSelected()
{
}
/// <summary>
/// Event handler that indicates the selected item position
/// and updates 'Remove', 'Up' and 'Down' buttons in the parent dialog.
/// </summary>
private void listViewEx_SelectedIndexChanged(object sender, EventArgs e)
{
if (listViewEx.SelectedItems.Count != 1)
{
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.None);
}
else if (listViewEx.Items.Count == 1)
{
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.FirstAndLast);
}
else if (listViewEx.SelectedIndices[0] == 0)
{
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.First);
}
else if (listViewEx.SelectedIndices[0] == (listViewEx.Items.Count - 1))
{
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.Last);
}
else
{
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.Middle);
}
}
public string GetWarningsBeforeSaving(ref Dictionary<string, string> renmInfo)
{
return string.Empty;
}
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
{
}
}
}
@@ -0,0 +1,122 @@
///
/// Copyright (c) 2019 Senus Slovensko a.s.
///
namespace TBF.UI.Bench.Uncertainties
{
partial class UncertntDlgPressMeterTab
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.cmpntLabel = new System.Windows.Forms.Label();
this.cmpntNameLabel = new System.Windows.Forms.Label();
this.listViewEx = new global::Results.Forms.ListViewEx();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.cmpntLabel);
this.splitContainer1.Panel1.Controls.Add(this.cmpntNameLabel);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.listViewEx);
this.splitContainer1.Size = new System.Drawing.Size(420, 300);
this.splitContainer1.SplitterDistance = 40;
this.splitContainer1.TabIndex = 2;
//
// componentLabel
//
this.cmpntLabel.AutoSize = true;
this.cmpntLabel.Location = new System.Drawing.Point(14, 12);
this.cmpntLabel.Name = "componentLabel";
this.cmpntLabel.Size = new System.Drawing.Size(64, 13);
this.cmpntLabel.TabIndex = 1;
this.cmpntLabel.Text = "Component:";
//
// cmpntNameLabel
//
this.cmpntNameLabel.AutoSize = true;
this.cmpntNameLabel.Location = new System.Drawing.Point(97, 12);
this.cmpntNameLabel.Name = "cmpntNameLabel";
this.cmpntNameLabel.Size = new System.Drawing.Size(88, 13);
this.cmpntNameLabel.TabIndex = 0;
this.cmpntNameLabel.Text = "componentName";
//
// listViewEx
//
this.listViewEx.AllowColumnReorder = true;
this.listViewEx.Dock = System.Windows.Forms.DockStyle.Fill;
this.listViewEx.DoubleClickActivation = false;
this.listViewEx.FullRowSelect = true;
this.listViewEx.GridLines = true;
this.listViewEx.Location = new System.Drawing.Point(0, 0);
this.listViewEx.Name = "listViewEx";
this.listViewEx.Size = new System.Drawing.Size(420, 256);
this.listViewEx.TabIndex = 0;
this.listViewEx.UseCompatibleStateImageBehavior = false;
this.listViewEx.View = System.Windows.Forms.View.Details;
this.listViewEx.SelectedIndexChanged += new System.EventHandler(this.listViewEx_SelectedIndexChanged);
//
// UncertntDlgPressMeterTab
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.splitContainer1);
this.Name = "UncertntDlgPressMeterTab";
this.Size = new System.Drawing.Size(420, 300);
this.Load += new System.EventHandler(this.UncertntDlgPressMeterTab_Load);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel1.PerformLayout();
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.Label cmpntLabel;
private System.Windows.Forms.Label cmpntNameLabel;
private global::Results.Forms.ListViewEx listViewEx;
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,269 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Windows.Forms;
using log4net;
using Config.Entities;
using Results.Forms;
using TBF.Resources;
using TBF.UI.Shared;
namespace TBF.UI.Bench.Uncertainties
{
public partial class UncertntDlgScaleTab : UserControl, IUncetaintiesDlgTab
{
static readonly ILog log = LogManager.GetLogger(typeof(UncertntDlgScaleTab));
/// <summary>
/// Component entity that has a list of 'measurement-correction' pairs
/// to be updated in the database on OK.
/// </summary>
public Component MeterEntity
{
get { return meterEntity; }
set { meterEntity = value; }
}
Component meterEntity;
/// <summary>
/// Balance configuration (with buoyancy parameters)
/// </summary>
public BenchControl.GenericDevices.IScaleCfg ScaleCfg;
/// <summary>
/// A list of 'measurement-correction' pairs to be deleted from the database on OK.
/// </summary>
public IList<Uncertainty> ToBeRemoved
{
get { return toBeRemoved; }
set { toBeRemoved = value; }
}
IList<Uncertainty> toBeRemoved;
UncertaintiesDlg parent;
bool unlocked;
Control[] textBoxes;
public UncertntDlgScaleTab()
{
InitializeComponent();
toBeRemoved = new List<Uncertainty>();
unlocked = false;
}
private void UncertntDlgScaleTab_Load(object sender, System.EventArgs e)
{
if (meterEntity == null) return;
parent = ParentForm as UncertaintiesDlg;
/// Panel1
cmpntLabel.Text = Strings.Component;
cmpntNameLabel.Text = meterEntity.Name;
/// Panel2
listViewEx.SubItemClicked += new SubItemEventHandler(listViewEx_SubItemClicked);
listViewEx.SubItemEndEditing += new SubItemEndEditingEventHandler(listViewEx_SubItemEndEditing);
listViewEx.Columns.Add(new ColumnHeader() { Text = Strings.Nr, Width = 40 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [kg]", Strings.Mass), Width = 100 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [g]", Strings.Main_uncertainty), Width = 120 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [g]", Strings.Resolution), Width = 100 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [g/year]", Strings.Drift_per_year), Width = 120 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [g]", Strings.Conditions), Width = 100 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [g]", Strings.Uncertainty_of_correction), Width = 160 });
textBoxes = new TextBox[listViewEx.Columns.Count];
for (int i = 1; i < textBoxes.Length; i++)
{
this.Controls.Add(textBoxes[i] = new TextBox());
}
RefreshAll();
}
void RefreshAll()
{
listViewEx.Items.Clear();
foreach (var uncrtnty in MeterEntity.Uncertainties) AddOneLVI(uncrtnty);
}
void AddOneLVI(Uncertainty corr)
{
int nr = listViewEx.Items.Count + 1;
ListViewItem lvi = new ListViewItem(nr.ToString());
lvi.Tag = corr;
lvi.SubItems.Add(corr.Measurement.ToString());
lvi.SubItems.Add((1000 * corr.MainUncertainty).ToString());
lvi.SubItems.Add((1000 * corr.Resolution).ToString());
lvi.SubItems.Add((1000 * corr.DriftPerYr).ToString());
lvi.SubItems.Add((1000 * corr.Conditions).ToString());
lvi.SubItems.Add((1000 * corr.UncertaintyOfCorrection).ToString());
listViewEx.Items.Add(lvi);
}
void listViewEx_SubItemClicked(object sender, SubItemEventArgs e)
{
if (unlocked && (e.SubItem >= 1) && (e.SubItem < listViewEx.Columns.Count))
{
/// This is not the first column
listViewEx.StartEditing(textBoxes[e.SubItem], e.Item, e.SubItem);
}
}
void listViewEx_SubItemEndEditing(object sender, SubItemEndEditingEventArgs e)
{
if (ParseItem(e.Item, e.SubItem, e.DisplayText)) return;
/// New value is NOK, revert the original text
e.DisplayText = e.Item.Text;
e.Cancel = true;
}
/// <summary>
/// Parse text of a ListViewItem
/// </summary>
/// <returns>true = value parsed OK</returns>
bool ParseItem(ListViewItem item, int subItem, string strValue)
{
Uncertainty uncrtnty = item.Tag as Uncertainty;
double dblValue = 0;
if ((uncrtnty != null) && Utils.TryParseEDouble(strValue, out dblValue) && (dblValue >= 0))
{
double inDefaultUnits = dblValue / 1000;
switch (subItem)
{
case 1:
uncrtnty.Measurement = (float)dblValue;
return true;
case 2:
uncrtnty.MainUncertainty = (float)inDefaultUnits;
return true;
case 3:
uncrtnty.Resolution = (float)inDefaultUnits;
return true;
case 4:
uncrtnty.DriftPerYr = (float)inDefaultUnits;
return true;
case 5:
uncrtnty.Conditions = (float)inDefaultUnits;
return true;
case 6:
uncrtnty.UncertaintyOfCorrection = (float)inDefaultUnits;
return true;
default:
return false;
}
}
else
{
return false;
}
}
public void Unlock()
{
unlocked = true;
if (listViewEx.SelectedItems.Count == 1)
{
int ix = listViewEx.SelectedIndices[0];
listViewEx.Focus();
listViewEx.Items[ix].Selected = true;
listViewEx.Items[ix].EnsureVisible();
}
}
public void OkBtnClicked()
{
}
public void CancelBtnClicked()
{
}
public void AddOne()
{
Uncertainty uncrtnty = new Uncertainty();
MeterEntity.Uncertainties.Add(uncrtnty);
AddOneLVI(uncrtnty);
listViewEx.Focus();
listViewEx.SelectedItems.Clear();
listViewEx.Items[listViewEx.Items.Count - 1].Selected = true;
listViewEx.Items[listViewEx.Items.Count - 1].EnsureVisible();
}
public void RemoveSelected()
{
if (listViewEx.SelectedItems.Count != 1) return;
int removeItemNr = listViewEx.SelectedIndices[0];
Uncertainty selected = listViewEx.SelectedItems[0].Tag as Uncertainty;
if ((selected != null) && (selected.Id != 0)) toBeRemoved.Add(selected);
MeterEntity.Uncertainties.RemoveAt(removeItemNr);
RefreshAll();
if (removeItemNr < listViewEx.Items.Count)
{
listViewEx.Focus();
listViewEx.Items[removeItemNr].Selected = true;
listViewEx.Items[removeItemNr].EnsureVisible();
}
else
{
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.None);
}
}
public void MoveUpSelected()
{
}
public void MoveDownSelected()
{
}
/// <summary>
/// Event handler that indicates the selected item position
/// and updates 'Remove', 'Up' and 'Down' buttons in the parent dialog.
/// </summary>
private void listViewEx_SelectedIndexChanged(object sender, EventArgs e)
{
if (listViewEx.SelectedItems.Count != 1)
{
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.None);
}
else if (listViewEx.Items.Count == 1)
{
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.FirstAndLast);
}
else if (listViewEx.SelectedIndices[0] == 0)
{
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.First);
}
else if (listViewEx.SelectedIndices[0] == (listViewEx.Items.Count - 1))
{
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.Last);
}
else
{
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.Middle);
}
}
public string GetWarningsBeforeSaving(ref Dictionary<string, string> renmInfo)
{
return string.Empty;
}
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
{
}
}
}
+121
View File
@@ -0,0 +1,121 @@
///
/// Copyright (c) 2019 Senus Slovensko a.s.
///
namespace TBF.UI.Bench.Uncertainties
{
partial class UncertntDlgScaleTab
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.listViewEx = new global::Results.Forms.ListViewEx();
this.cmpntLabel = new System.Windows.Forms.Label();
this.cmpntNameLabel = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.cmpntLabel);
this.splitContainer1.Panel1.Controls.Add(this.cmpntNameLabel);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.listViewEx);
this.splitContainer1.Size = new System.Drawing.Size(668, 400);
this.splitContainer1.SplitterDistance = 40;
this.splitContainer1.TabIndex = 1;
//
// listViewEx
//
this.listViewEx.AllowColumnReorder = true;
this.listViewEx.Dock = System.Windows.Forms.DockStyle.Fill;
this.listViewEx.DoubleClickActivation = false;
this.listViewEx.FullRowSelect = true;
this.listViewEx.GridLines = true;
this.listViewEx.Location = new System.Drawing.Point(0, 0);
this.listViewEx.Name = "listViewEx";
this.listViewEx.Size = new System.Drawing.Size(668, 356);
this.listViewEx.TabIndex = 0;
this.listViewEx.UseCompatibleStateImageBehavior = false;
this.listViewEx.View = System.Windows.Forms.View.Details;
this.listViewEx.SelectedIndexChanged += new System.EventHandler(this.listViewEx_SelectedIndexChanged);
//
// componentLabel
//
this.cmpntLabel.AutoSize = true;
this.cmpntLabel.Location = new System.Drawing.Point(14, 12);
this.cmpntLabel.Name = "componentLabel";
this.cmpntLabel.Size = new System.Drawing.Size(64, 13);
this.cmpntLabel.TabIndex = 3;
this.cmpntLabel.Text = "Component:";
//
// cmpntNameLabel
//
this.cmpntNameLabel.AutoSize = true;
this.cmpntNameLabel.Location = new System.Drawing.Point(97, 12);
this.cmpntNameLabel.Name = "cmpntNameLabel";
this.cmpntNameLabel.Size = new System.Drawing.Size(88, 13);
this.cmpntNameLabel.TabIndex = 2;
this.cmpntNameLabel.Text = "componentName";
//
// UncertntDlgScaleTab
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.splitContainer1);
this.Name = "UncertntDlgScaleTab";
this.Size = new System.Drawing.Size(668, 400);
this.Load += new System.EventHandler(this.UncertntDlgScaleTab_Load);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel1.PerformLayout();
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private global::Results.Forms.ListViewEx listViewEx;
private System.Windows.Forms.Label cmpntLabel;
private System.Windows.Forms.Label cmpntNameLabel;
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,264 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Windows.Forms;
using log4net;
using Config.Entities;
using Results.Forms;
using TBF.Resources;
using TBF.UI.Shared;
namespace TBF.UI.Bench.Uncertainties
{
public partial class UncertntDlgTempMeterTab : UserControl, IUncetaintiesDlgTab
{
static readonly ILog log = LogManager.GetLogger(typeof(UncertntDlgTempMeterTab));
/// <summary>
/// Component entity that has a list of 'measurement-correction' pairs
/// to be updated in the database on OK.
/// </summary>
Component meterEntity;
public Component MeterEntity
{
get { return meterEntity; }
set { meterEntity = value; }
}
/// <summary>
/// A list of 'measurement-correction' pairs to be deleted from the database on OK.
/// </summary>
public IList<Uncertainty> ToBeRemoved
{
get { return toBeRemoved; }
set { toBeRemoved = value; }
}
IList<Uncertainty> toBeRemoved;
UncertaintiesDlg parent;
bool unlocked;
Control[] textBoxes;
public UncertntDlgTempMeterTab()
{
InitializeComponent();
toBeRemoved = new List<Uncertainty>();
}
private void UncertntDlgTempMeterTab_Load(object sender, System.EventArgs e)
{
if (meterEntity == null) return;
parent = ParentForm as UncertaintiesDlg;
/// Panel1
cmpntLabel.Text = Strings.Component;
cmpntNameLabel.Text = meterEntity.Name;
/// Panel2
listViewEx.SubItemClicked += new SubItemEventHandler(listViewEx_SubItemClicked);
listViewEx.SubItemEndEditing += new SubItemEndEditingEventHandler(listViewEx_SubItemEndEditing);
listViewEx.Columns.Add(new ColumnHeader() { Text = Strings.Nr, Width = 40 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [°C]", Strings.Temperature), Width = 100 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [1/1000 °C]", Strings.Main_uncertainty), Width = 120 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [1/1000 °C]", Strings.Resolution), Width = 100 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [1/1000 °C/year]", Strings.Drift_per_year), Width = 120 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [1/1000 °C]", Strings.Conditions), Width = 100 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [1/1000 °C]", Strings.Uncertainty_of_correction), Width = 160 });
textBoxes = new TextBox[listViewEx.Columns.Count];
for (int i = 1; i < textBoxes.Length; i++)
{
this.Controls.Add(textBoxes[i] = new TextBox());
}
RefreshAll();
}
void RefreshAll()
{
listViewEx.Items.Clear();
foreach (var uncrtnty in MeterEntity.Uncertainties) AddOneLVI(uncrtnty);
}
void AddOneLVI(Uncertainty corr)
{
int nr = listViewEx.Items.Count + 1;
ListViewItem lvi = new ListViewItem(nr.ToString());
lvi.Tag = corr;
lvi.SubItems.Add(corr.Measurement.ToString());
lvi.SubItems.Add((1000 * corr.MainUncertainty).ToString());
lvi.SubItems.Add((1000 * corr.Resolution).ToString());
lvi.SubItems.Add((1000 * corr.DriftPerYr).ToString());
lvi.SubItems.Add((1000 * corr.Conditions).ToString());
lvi.SubItems.Add((1000 * corr.UncertaintyOfCorrection).ToString());
listViewEx.Items.Add(lvi);
}
void listViewEx_SubItemClicked(object sender, SubItemEventArgs e)
{
if (unlocked && (e.SubItem >= 1) && (e.SubItem < listViewEx.Columns.Count))
{
/// This is not the first column
listViewEx.StartEditing(textBoxes[e.SubItem], e.Item, e.SubItem);
}
}
void listViewEx_SubItemEndEditing(object sender, SubItemEndEditingEventArgs e)
{
if (ParseItem(e.Item, e.SubItem, e.DisplayText)) return;
/// New value is NOK, revert the original text
e.DisplayText = e.Item.Text;
e.Cancel = true;
}
/// <summary>
/// Parse text of a ListViewItem
/// </summary>
/// <returns>true = value parsed OK</returns>
bool ParseItem(ListViewItem item, int subItem, string strValue)
{
Uncertainty uncrtnty = item.Tag as Uncertainty;
double dblValue = 0;
if ((uncrtnty != null) && Utils.TryParseEDouble(strValue, out dblValue) && (dblValue >= 0))
{
double inDefaultUnits = dblValue / 1000;
switch (subItem)
{
case 1:
uncrtnty.Measurement = (float)dblValue;
return true;
case 2:
uncrtnty.MainUncertainty = (float)inDefaultUnits;
return true;
case 3:
uncrtnty.Resolution = (float)inDefaultUnits;
return true;
case 4:
uncrtnty.DriftPerYr = (float)inDefaultUnits;
return true;
case 5:
uncrtnty.Conditions = (float)inDefaultUnits;
return true;
case 6:
uncrtnty.UncertaintyOfCorrection = (float)inDefaultUnits;
return true;
default:
return false;
}
}
else
{
return false;
}
}
public void Unlock()
{
unlocked = true;
if (listViewEx.SelectedItems.Count == 1)
{
int ix = listViewEx.SelectedIndices[0];
listViewEx.Focus();
listViewEx.Items[ix].Selected = true;
listViewEx.Items[ix].EnsureVisible();
}
}
public void OkBtnClicked()
{
}
public void CancelBtnClicked()
{
}
public void AddOne()
{
Uncertainty uncrtnty = new Uncertainty();
MeterEntity.Uncertainties.Add(uncrtnty);
AddOneLVI(uncrtnty);
listViewEx.Focus();
listViewEx.SelectedItems.Clear();
listViewEx.Items[listViewEx.Items.Count - 1].Selected = true;
listViewEx.Items[listViewEx.Items.Count - 1].EnsureVisible();
}
public void RemoveSelected()
{
if (listViewEx.SelectedItems.Count != 1) return;
int removeItemNr = listViewEx.SelectedIndices[0];
Uncertainty selected =
(Uncertainty)listViewEx.SelectedItems[0].Tag;
if (selected.Id != 0) toBeRemoved.Add(selected);
MeterEntity.Corrections.RemoveAt(removeItemNr);
RefreshAll();
if (removeItemNr < listViewEx.Items.Count)
{
listViewEx.Focus();
listViewEx.Items[removeItemNr].Selected = true;
listViewEx.Items[removeItemNr].EnsureVisible();
}
else
{
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.None);
}
}
public void MoveUpSelected()
{
}
public void MoveDownSelected()
{
}
/// <summary>
/// Event handler that indicates the selected item position
/// and updates 'Remove', 'Up' and 'Down' buttons in the parent dialog.
/// </summary>
private void listViewEx_SelectedIndexChanged(object sender, EventArgs e)
{
if (listViewEx.SelectedItems.Count != 1)
{
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.None);
}
else if (listViewEx.Items.Count == 1)
{
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.FirstAndLast);
}
else if (listViewEx.SelectedIndices[0] == 0)
{
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.First);
}
else if (listViewEx.SelectedIndices[0] == (listViewEx.Items.Count - 1))
{
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.Last);
}
else
{
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.Middle);
}
}
public string GetWarningsBeforeSaving(ref Dictionary<string, string> renmInfo)
{
return string.Empty;
}
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
{
}
}
}
@@ -0,0 +1,122 @@
///
/// Copyright (c) 2019 Senus Slovensko a.s.
///
namespace TBF.UI.Bench.Uncertainties
{
partial class UncertntDlgTempMeterTab
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.cmpntLabel = new System.Windows.Forms.Label();
this.cmpntNameLabel = new System.Windows.Forms.Label();
this.listViewEx = new global::Results.Forms.ListViewEx();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.cmpntLabel);
this.splitContainer1.Panel1.Controls.Add(this.cmpntNameLabel);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.listViewEx);
this.splitContainer1.Size = new System.Drawing.Size(420, 300);
this.splitContainer1.SplitterDistance = 40;
this.splitContainer1.TabIndex = 2;
//
// componentLabel
//
this.cmpntLabel.AutoSize = true;
this.cmpntLabel.Location = new System.Drawing.Point(14, 12);
this.cmpntLabel.Name = "componentLabel";
this.cmpntLabel.Size = new System.Drawing.Size(64, 13);
this.cmpntLabel.TabIndex = 1;
this.cmpntLabel.Text = "Component:";
//
// cmpntNameLabel
//
this.cmpntNameLabel.AutoSize = true;
this.cmpntNameLabel.Location = new System.Drawing.Point(97, 12);
this.cmpntNameLabel.Name = "cmpntNameLabel";
this.cmpntNameLabel.Size = new System.Drawing.Size(88, 13);
this.cmpntNameLabel.TabIndex = 0;
this.cmpntNameLabel.Text = "componentName";
//
// listViewEx
//
this.listViewEx.AllowColumnReorder = true;
this.listViewEx.Dock = System.Windows.Forms.DockStyle.Fill;
this.listViewEx.DoubleClickActivation = false;
this.listViewEx.FullRowSelect = true;
this.listViewEx.GridLines = true;
this.listViewEx.Location = new System.Drawing.Point(0, 0);
this.listViewEx.Name = "listViewEx";
this.listViewEx.Size = new System.Drawing.Size(420, 256);
this.listViewEx.TabIndex = 0;
this.listViewEx.UseCompatibleStateImageBehavior = false;
this.listViewEx.View = System.Windows.Forms.View.Details;
this.listViewEx.SelectedIndexChanged += new System.EventHandler(this.listViewEx_SelectedIndexChanged);
//
// UncertntDlgTempMeterTab
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.splitContainer1);
this.Name = "UncertntDlgTempMeterTab";
this.Size = new System.Drawing.Size(420, 300);
this.Load += new System.EventHandler(this.UncertntDlgTempMeterTab_Load);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel1.PerformLayout();
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.Label cmpntLabel;
private System.Windows.Forms.Label cmpntNameLabel;
private global::Results.Forms.ListViewEx listViewEx;
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+21 -6
View File
@@ -54,7 +54,7 @@ namespace TBF.UI
this.horizontalSplitContainer = new System.Windows.Forms.SplitContainer();
this.mainTabControl = new System.Windows.Forms.TabControl();
this.homeTabPage = new System.Windows.Forms.TabPage();
this.ctrlBrdComponent = new ControlComponent3Munich.UserControl1();
this.ctrlBrdComponent = new ControlComponent_Torino2015.UserControl1();
this.processTabPage = new System.Windows.Forms.TabPage();
this.processTabPageCtrl = new TBF.UI.Process.ProcessTabPageCtrl6();
this.insertTabPage = new System.Windows.Forms.TabPage();
@@ -79,6 +79,8 @@ namespace TBF.UI
this.benchPathsTSMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.benchTransitionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.benchMetrologyTSMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.benchConditionsTSMItem = new System.Windows.Forms.ToolStripMenuItem();
this.benchUncertaintyTSMItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.homeTSMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -136,6 +138,7 @@ namespace TBF.UI
((System.ComponentModel.ISupportInitialize)(this.rightHorizSplitContainer)).BeginInit();
this.rightHorizSplitContainer.Panel1.SuspendLayout();
this.rightHorizSplitContainer.SuspendLayout();
this.measurementTabPage.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.mainMenuStrip.SuspendLayout();
this.SuspendLayout();
@@ -382,11 +385,6 @@ namespace TBF.UI
this.progressFlowLayoutPanel.BackColor = System.Drawing.SystemColors.Control;
this.progressFlowLayoutPanel.Name = "progressFlowLayoutPanel";
//
// measurementTabPage
//
resources.ApplyResources(this.measurementTabPage, "measurementTabPage");
this.measurementTabPage.Name = "measurementTabPage";
//
// statusStrip1
//
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -425,6 +423,8 @@ namespace TBF.UI
this.benchPathsTSMenuItem,
this.benchTransitionsToolStripMenuItem,
this.benchMetrologyTSMenuItem,
this.benchConditionsTSMItem,
this.benchUncertaintyTSMItem,
this.toolStripSeparator1,
this.exitToolStripMenuItem});
this.benchTSMenuItem.Name = "benchTSMenuItem";
@@ -454,6 +454,18 @@ namespace TBF.UI
resources.ApplyResources(this.benchMetrologyTSMenuItem, "benchMetrologyTSMenuItem");
this.benchMetrologyTSMenuItem.Click += new System.EventHandler(this.benchMetrologyTSMItem_Click);
//
// benchConditionsTSMItem
//
this.benchConditionsTSMItem.Name = "benchConditionsTSMItem";
resources.ApplyResources(this.benchConditionsTSMItem, "benchConditionsTSMItem");
this.benchConditionsTSMItem.Click += new System.EventHandler(this.benchConditionsTSMItem_Click);
//
// benchUncertaintyTSMItem
//
this.benchUncertaintyTSMItem.Name = "benchUncertaintyTSMItem";
resources.ApplyResources(this.benchUncertaintyTSMItem, "benchUncertaintyTSMItem");
this.benchUncertaintyTSMItem.Click += new System.EventHandler(this.benchUncertaintyTSMItem_Click);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
@@ -660,6 +672,7 @@ namespace TBF.UI
this.rightHorizSplitContainer.Panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.rightHorizSplitContainer)).EndInit();
this.rightHorizSplitContainer.ResumeLayout(false);
this.measurementTabPage.ResumeLayout(false);
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.mainMenuStrip.ResumeLayout(false);
@@ -760,6 +773,8 @@ namespace TBF.UI
private System.Windows.Forms.ToolStripMenuItem backUpTSMItem;
private System.Windows.Forms.ToolStripMenuItem backUpConfigTSMItem;
private System.Windows.Forms.ToolStripMenuItem backUpResultsTSMItem;
private System.Windows.Forms.ToolStripMenuItem benchConditionsTSMItem;
private System.Windows.Forms.ToolStripMenuItem benchUncertaintyTSMItem;
}
}
+2
View File
@@ -474,6 +474,8 @@ namespace TBF.UI
private void benchPathsTSMItem_Click(object s, EventArgs e) { Cursor = Cursors.WaitCursor; new TBF.UI.Bench.Paths.PathsDlg().ShowDialog(); Cursor = Cursors.Default; }
private void benchTransitionsTSMItem_Click(object s, EventArgs e) { Cursor = Cursors.WaitCursor; new TBF.UI.Bench.Transitions.TransitionsDlg().ShowDialog(); Cursor = Cursors.Default; }
private void benchMetrologyTSMItem_Click(object s, EventArgs e) { Cursor = Cursors.WaitCursor; new TBF.UI.Bench.Metrology.MetrologyDlg().ShowDialog(); Cursor = Cursors.Default; }
private void benchConditionsTSMItem_Click(object s, EventArgs e) { Cursor = Cursors.WaitCursor; new TBF.UI.Bench.Conditions.ConditionsDlg().ShowDialog(); Cursor = Cursors.Default; }
private void benchUncertaintyTSMItem_Click(object s, EventArgs e) { Cursor = Cursors.WaitCursor; new TBF.UI.Bench.Uncertainties.UncertaintiesDlg().ShowDialog(); Cursor = Cursors.Default; }
private void proceduresTSMItem_Click(object s, EventArgs e) { Cursor = Cursors.WaitCursor; new TBF.UI.Procedures.ProceduresDlg().ShowDialog(); Cursor = Cursors.Default; }
private void usersTSMItem_Click(object s, EventArgs e)
+674 -389
View File
File diff suppressed because it is too large Load Diff
+1 -3
View File
@@ -455,9 +455,7 @@ namespace TBF.UI.Process
double massDiff = ProcessData.Mass.Val - ProcessData.StartMass.Val;
massDiffLabel.Text = massDiff.ToString("F3");
double volumeCtv = 1000 * Config.Formulas.Buoyancy() * massDiff / Config.Formulas.WaterDensityFromTempPress((ProcessData.TempUp.Val + ProcessData.TempDown.Val) / 2,
(ProcessData.PressUp.Val + ProcessData.PressDown.Val) / 2,
Program.LocalSettings.RealDensity,
Program.LocalSettings.AtTemperature); /// [kg/m3]
(ProcessData.PressUp.Val + ProcessData.PressDown.Val) / 2);
volumeCtvLabel.Text = volumeCtv.ToString("F2");
double refError = Config.Formulas.ErrorFromVolumes(refVolume, volumeCtv);
refErrorLabel.Text = refError.ToString("F3");
+1 -3
View File
@@ -484,9 +484,7 @@ namespace TBF.UI.Process
double massDiff = ProcessData.Mass.Val - ProcessData.StartMass.Val;
massDiffLabel.Text = massDiff.ToString("F3");
double volumeCtv = 1000 * Config.Formulas.Buoyancy() * massDiff / Config.Formulas.WaterDensityFromTempPress((ProcessData.TempUp.Val + ProcessData.TempDown.Val) / 2,
(ProcessData.PressUp.Val + ProcessData.PressDown.Val) / 2,
Program.LocalSettings.RealDensity,
Program.LocalSettings.AtTemperature); /// [kg/m3]
(ProcessData.PressUp.Val + ProcessData.PressDown.Val) / 2);
volumeCtvLabel.Text = volumeCtv.ToString("F2");
double refError = Config.Formulas.ErrorFromVolumes(refVolume, volumeCtv);
refErrorLabel.Text = refError.ToString("F3");
+1 -3
View File
@@ -488,9 +488,7 @@ namespace TBF.UI.Process
double massDiff = ProcessData.Mass.Val - ProcessData.StartMass.Val;
massDiffLabel.Text = massDiff.ToString("F3");
double volumeCtv = 1000 * Config.Formulas.Buoyancy() * massDiff / Config.Formulas.WaterDensityFromTempPress((ProcessData.TempUp.Val + ProcessData.TempDown.Val) / 2,
(ProcessData.PressUp.Val + ProcessData.PressDown.Val) / 2,
Program.LocalSettings.RealDensity,
Program.LocalSettings.AtTemperature); /// [kg/m3]
(ProcessData.PressUp.Val + ProcessData.PressDown.Val) / 2);
volumeCtvLabel.Text = volumeCtv.ToString("F2");
double refError = Config.Formulas.ErrorFromVolumes(refVolume, volumeCtv);
refErrorLabel.Text = refError.ToString("F3");
+1 -3
View File
@@ -455,9 +455,7 @@ namespace TBF.UI.Process
massDiffLabel.Text = massDiff.ToString("F3");
double volumeCtv = 1000 * Config.Formulas.Buoyancy() * massDiff
/ Config.Formulas.WaterDensityFromTempPress((ProcessData.TempUp.Val + ProcessData.TempDown.Val) / 2,
(ProcessData.PressUp.Val + ProcessData.PressDown.Val) / 2,
Program.LocalSettings.RealDensity,
Program.LocalSettings.AtTemperature); /// [kg/m3]
(ProcessData.PressUp.Val + ProcessData.PressDown.Val) / 2);
volumeCtvLabel.Text = volumeCtv.ToString("F2");
double refError = Config.Formulas.ErrorFromVolumes(refVolume, volumeCtv);
refErrorLabel.Text = refError.ToString("F3");
+30 -17
View File
@@ -41,8 +41,9 @@
this.label2 = new System.Windows.Forms.Label();
this.pressureRepresentationButton = new System.Windows.Forms.Button();
this.upgradeDb_24_29_Button = new System.Windows.Forms.Button();
this.upgradeDb_218_220_Button = new System.Windows.Forms.Button();
this.upgradeDb_218_222_Button = new System.Windows.Forms.Button();
this.upgradeDb_NFC_button = new System.Windows.Forms.Button();
this.upgradeDb_222_224_Button = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// upgradeDb_215_216_Button
@@ -118,7 +119,7 @@
// textBox1
//
this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.textBox1.Location = new System.Drawing.Point(94, 418);
this.textBox1.Location = new System.Drawing.Point(94, 431);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(100, 20);
this.textBox1.TabIndex = 11;
@@ -126,7 +127,7 @@
// textBox2
//
this.textBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.textBox2.Location = new System.Drawing.Point(94, 444);
this.textBox2.Location = new System.Drawing.Point(94, 457);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(100, 20);
this.textBox2.TabIndex = 13;
@@ -135,7 +136,7 @@
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 421);
this.label1.Location = new System.Drawing.Point(12, 434);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(70, 13);
this.label1.TabIndex = 10;
@@ -145,7 +146,7 @@
//
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(12, 447);
this.label2.Location = new System.Drawing.Point(12, 460);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(60, 13);
this.label2.TabIndex = 12;
@@ -154,7 +155,7 @@
// pressureRepresentationButton
//
this.pressureRepresentationButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.pressureRepresentationButton.Location = new System.Drawing.Point(207, 418);
this.pressureRepresentationButton.Location = new System.Drawing.Point(207, 431);
this.pressureRepresentationButton.Name = "pressureRepresentationButton";
this.pressureRepresentationButton.Size = new System.Drawing.Size(65, 42);
this.pressureRepresentationButton.TabIndex = 14;
@@ -172,15 +173,15 @@
this.upgradeDb_24_29_Button.UseVisualStyleBackColor = true;
this.upgradeDb_24_29_Button.Click += new System.EventHandler(this.upgradeDb_24_29_Button_Click);
//
// upgradeDb_218_220_Button
// upgradeDb_218_222_Button
//
this.upgradeDb_218_220_Button.Location = new System.Drawing.Point(12, 337);
this.upgradeDb_218_220_Button.Name = "upgradeDb_218_220_Button";
this.upgradeDb_218_220_Button.Size = new System.Drawing.Size(260, 34);
this.upgradeDb_218_220_Button.TabIndex = 9;
this.upgradeDb_218_220_Button.Text = "Upgrade database from ver. 2.18 to ver. 2.20";
this.upgradeDb_218_220_Button.UseVisualStyleBackColor = true;
this.upgradeDb_218_220_Button.Click += new System.EventHandler(this.upgradeDb_218_220_Button_Click);
this.upgradeDb_218_222_Button.Location = new System.Drawing.Point(12, 337);
this.upgradeDb_218_222_Button.Name = "upgradeDb_218_222_Button";
this.upgradeDb_218_222_Button.Size = new System.Drawing.Size(260, 34);
this.upgradeDb_218_222_Button.TabIndex = 9;
this.upgradeDb_218_222_Button.Text = "Upgrade database from ver. 2.18 to ver. 2.22";
this.upgradeDb_218_222_Button.UseVisualStyleBackColor = true;
this.upgradeDb_218_222_Button.Click += new System.EventHandler(this.upgradeDb_218_222_Button_Click);
//
// upgradeDb_NFC_button
//
@@ -192,13 +193,24 @@
this.upgradeDb_NFC_button.UseVisualStyleBackColor = true;
this.upgradeDb_NFC_button.Click += new System.EventHandler(this.upgradeDb_NFC_button_Click);
//
// upgradeDb_222_224_Button
//
this.upgradeDb_222_224_Button.Location = new System.Drawing.Point(12, 377);
this.upgradeDb_222_224_Button.Name = "upgradeDb_222_224_Button";
this.upgradeDb_222_224_Button.Size = new System.Drawing.Size(260, 34);
this.upgradeDb_222_224_Button.TabIndex = 15;
this.upgradeDb_222_224_Button.Text = "Upgrade database from ver. 2.22 to ver. 2.24";
this.upgradeDb_222_224_Button.UseVisualStyleBackColor = true;
this.upgradeDb_222_224_Button.Click += new System.EventHandler(this.upgradeDb_222_224_Button_Click);
//
// UpgradeSelectionDlg
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(284, 480);
this.ClientSize = new System.Drawing.Size(284, 493);
this.Controls.Add(this.upgradeDb_222_224_Button);
this.Controls.Add(this.upgradeDb_NFC_button);
this.Controls.Add(this.upgradeDb_218_220_Button);
this.Controls.Add(this.upgradeDb_218_222_Button);
this.Controls.Add(this.upgradeDb_24_29_Button);
this.Controls.Add(this.pressureRepresentationButton);
this.Controls.Add(this.label2);
@@ -234,8 +246,9 @@
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button pressureRepresentationButton;
private System.Windows.Forms.Button upgradeDb_24_29_Button;
private System.Windows.Forms.Button upgradeDb_218_220_Button;
private System.Windows.Forms.Button upgradeDb_218_222_Button;
private System.Windows.Forms.Button upgradeDb_NFC_button;
private System.Windows.Forms.Button upgradeDb_222_224_Button;
}
}

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