(1) MetrologyDlgDiverterTab added to UI, (2) double TestTimeCorrection(double flow) added to IDiverter and implemented in Elde.Diverter and Dummy.Diverter.
This commit is contained in:
parent
55ed11ae58
commit
3fceee156b
@ -221,45 +221,60 @@ namespace Config
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Calculates corrected value form a list of corrections by interpolation.
|
|
||||||
/// It is assumed that values in the list 'corrections' are sorted.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="rawMeasurement">Raw uncorrected value</param>
|
|
||||||
/// <param name="corrections">Sorted (value, correction) pairs</param>
|
|
||||||
/// <returns>Corrected value</returns>
|
|
||||||
public static double CorrectedValue(double rawValue, IList<Config.Entities.MeasurementCorrection> corrections)
|
|
||||||
{
|
|
||||||
if (corrections == null || corrections.Count == 0) return rawValue;
|
|
||||||
|
|
||||||
if (rawValue < corrections[0].Measurement)
|
/// <summary>
|
||||||
{
|
/// Calculates corrected value from a list of corrections by interpolation.
|
||||||
return rawValue + corrections[0].Correction;
|
/// It is assumed that values in the list 'corrections' are sorted.
|
||||||
}
|
/// </summary>
|
||||||
|
/// <param name="rawMeasurement">Raw uncorrected value</param>
|
||||||
|
/// <param name="corrections">Sorted (value, correction) pairs</param>
|
||||||
|
/// <returns>Corrected value</returns>
|
||||||
|
public static double CorrectedValue(double rawValue, IList<Config.Entities.MeasurementCorrection> corrections)
|
||||||
|
{
|
||||||
|
return rawValue + GetCorrection(rawValue, corrections);
|
||||||
|
}
|
||||||
|
|
||||||
int count = corrections.Count;
|
/// <summary>
|
||||||
for (int i = 1; i < count; i++)
|
/// Get a correction from a list of corrections by interpolation.
|
||||||
{
|
/// It is assumed that values in the list 'corrections' are sorted.
|
||||||
if (rawValue < corrections[i].Measurement)
|
/// </summary>
|
||||||
{
|
/// <param name="rawMeasurement">Raw uncorrected value</param>
|
||||||
double d1 = rawValue - corrections[i-1].Measurement;
|
/// <param name="corrections">Sorted (value, correction) pairs</param>
|
||||||
double d2 = corrections[i].Measurement - rawValue;
|
/// <returns>Corrected value</returns>
|
||||||
|
public static double GetCorrection(double rawValue, IList<Config.Entities.MeasurementCorrection> corrections)
|
||||||
|
{
|
||||||
|
if ((corrections == null) || (corrections.Count == 0)) return 0; /// No correction
|
||||||
|
|
||||||
double corr;
|
if (rawValue < corrections[0].Measurement)
|
||||||
if (d1 + d2 <= float.Epsilon)
|
{
|
||||||
{
|
/// rawValue is below the lowest value in the correction table
|
||||||
corr = (corrections[i - 1].Correction + corrections[i].Correction) / 2.0;
|
return corrections[0].Correction;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
corr = (corrections[i - 1].Correction * d2 + corrections[i].Correction * d1) / (d1 + d2);
|
|
||||||
}
|
|
||||||
return rawValue + corr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return rawValue + corrections[count - 1].Correction;
|
int count = corrections.Count;
|
||||||
}
|
for (int i = 1; i < count; i++)
|
||||||
|
{
|
||||||
|
if (rawValue < corrections[i].Measurement)
|
||||||
|
{
|
||||||
|
double d1 = rawValue - corrections[i - 1].Measurement;
|
||||||
|
double d2 = corrections[i].Measurement - rawValue;
|
||||||
|
|
||||||
|
if (d1 + d2 <= float.Epsilon)
|
||||||
|
{
|
||||||
|
/// Neigboring values in the corection table are close to each other -> calculate the average
|
||||||
|
return (corrections[i - 1].Correction + corrections[i].Correction) / 2.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/// Interpolate the correction from neigboring values in the corection table
|
||||||
|
return (corrections[i - 1].Correction * d2 + corrections[i].Correction * d1) / (d1 + d2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// rawValue is above the highest value in the correction table
|
||||||
|
return corrections[count - 1].Correction;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -32,5 +32,10 @@ namespace TBF.BenchControl.Dummy.Diverter
|
|||||||
public int ThresholdGate { get { return 50; } }
|
public int ThresholdGate { get { return 50; } }
|
||||||
public int ThresholdLo { get { return 10; } }
|
public int ThresholdLo { get { return 10; } }
|
||||||
public int ThresholdHi { get { return 90; } }
|
public int ThresholdHi { get { return 90; } }
|
||||||
|
|
||||||
|
public double TestTimeCorrection(double flow)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,6 +46,15 @@ namespace TBF.BenchControl.Elde.Diverter
|
|||||||
public int ThresholdHi { get { return diverterCfg.ThresholdHi; } }
|
public int ThresholdHi { get { return diverterCfg.ThresholdHi; } }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// For a given flow in [m3/h] returns a test time correction in [s]
|
||||||
|
/// </summary>
|
||||||
|
public double TestTimeCorrection(double flow)
|
||||||
|
{
|
||||||
|
return Config.Formulas.GetCorrection(flow, Corrections);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public Diverter()
|
public Diverter()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
///
|
///
|
||||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
|
||||||
///
|
///
|
||||||
using TBF.BenchControl.Generic;
|
using TBF.BenchControl.Generic;
|
||||||
|
|
||||||
@ -32,5 +32,12 @@ namespace TBF.BenchControl.GenericDevices
|
|||||||
/// Threshold for high level when diverter transition time is measured in %, 0..100
|
/// Threshold for high level when diverter transition time is measured in %, 0..100
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int ThresholdHi { get; }
|
int ThresholdHi { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// For a given flow in [m3/h] returns a test time correction in [s]
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="flow">Flow in [m3/h]</param>
|
||||||
|
/// <returns>Test time correction in [s]</returns>
|
||||||
|
double TestTimeCorrection(double flow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -67,7 +67,7 @@ namespace TBF
|
|||||||
{
|
{
|
||||||
BenchControl.Generic.IComponentFactory factory = TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName);
|
BenchControl.Generic.IComponentFactory factory = TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName);
|
||||||
|
|
||||||
/// Balance tab-pages
|
/// Tab-pages for scales
|
||||||
if (factory is BenchControl.MettlerToledo.Standard.BalanceFactory ||
|
if (factory is BenchControl.MettlerToledo.Standard.BalanceFactory ||
|
||||||
factory is BenchControl.MettlerToledo.Standard.BalanceOldFactory ||
|
factory is BenchControl.MettlerToledo.Standard.BalanceOldFactory ||
|
||||||
factory is BenchControl.MettlerToledo.Standard.BalanceNewFactory ||
|
factory is BenchControl.MettlerToledo.Standard.BalanceNewFactory ||
|
||||||
@ -84,21 +84,7 @@ namespace TBF
|
|||||||
metrologyTabControl.TabPages.Add(tabPage);
|
metrologyTabControl.TabPages.Add(tabPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Level meters for tanks tab-pages
|
/// Tab-pages for flowmeters
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Flowmeter tab-pages
|
|
||||||
if (factory is BenchControl.Elde.FlowMeter.FlowMeterFactory)
|
if (factory is BenchControl.Elde.FlowMeter.FlowMeterFactory)
|
||||||
{
|
{
|
||||||
BenchControl.Elde.FlowMeter.FlowMeterCfg flowMeterCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.Elde.FlowMeter.FlowMeterCfg;
|
BenchControl.Elde.FlowMeter.FlowMeterCfg flowMeterCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.Elde.FlowMeter.FlowMeterCfg;
|
||||||
@ -120,7 +106,7 @@ namespace TBF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Pressure meter tab-pages
|
/// Tab-pages for pressure meters
|
||||||
if (factory is BenchControl.Elde.PressureMeter.PressureMeterFactory ||
|
if (factory is BenchControl.Elde.PressureMeter.PressureMeterFactory ||
|
||||||
factory is BenchControl.Elde.PressureMeterInternal.PressureMeterFactory ||
|
factory is BenchControl.Elde.PressureMeterInternal.PressureMeterFactory ||
|
||||||
factory is BenchControl.Modbus.PressureMeter.Meret.Factory)
|
factory is BenchControl.Modbus.PressureMeter.Meret.Factory)
|
||||||
@ -135,7 +121,7 @@ namespace TBF
|
|||||||
metrologyTabControl.TabPages.Add(tabPage);
|
metrologyTabControl.TabPages.Add(tabPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Temperature meter tab-pages
|
/// Tab-pages for temperature meters
|
||||||
if (factory is BenchControl.Elde.TempMeter.TempMeterFactory ||
|
if (factory is BenchControl.Elde.TempMeter.TempMeterFactory ||
|
||||||
factory is BenchControl.Elde.TempMeterInternal.TempMeterFactory)
|
factory is BenchControl.Elde.TempMeterInternal.TempMeterFactory)
|
||||||
{
|
{
|
||||||
@ -149,7 +135,7 @@ namespace TBF
|
|||||||
metrologyTabControl.TabPages.Add(tabPage);
|
metrologyTabControl.TabPages.Add(tabPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Platinum resistance temperature meter tab-pages
|
/// Tab-pages for platinum resistance temperature meters
|
||||||
if (factory is BenchControl.Keithley.TempMeter.Factory)
|
if (factory is BenchControl.Keithley.TempMeter.Factory)
|
||||||
{
|
{
|
||||||
platinumTempMetersCount++;
|
platinumTempMetersCount++;
|
||||||
@ -162,6 +148,34 @@ namespace TBF
|
|||||||
tabPage.Controls.Add(uiControl);
|
tabPage.Controls.Add(uiControl);
|
||||||
metrologyTabControl.TabPages.Add(tabPage);
|
metrologyTabControl.TabPages.Add(tabPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Tab-pages for diverters
|
||||||
|
if (factory is BenchControl.Elde.Diverter.DiverterFactory)
|
||||||
|
{
|
||||||
|
levelMetersCount++;
|
||||||
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2236,6 +2236,12 @@
|
|||||||
<Compile Include="UiControls\MetrologyDlgDensityTab.designer.cs">
|
<Compile Include="UiControls\MetrologyDlgDensityTab.designer.cs">
|
||||||
<DependentUpon>MetrologyDlgDensityTab.cs</DependentUpon>
|
<DependentUpon>MetrologyDlgDensityTab.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="UiControls\MetrologyDlgDiverterTab.cs">
|
||||||
|
<SubType>UserControl</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="UiControls\MetrologyDlgDiverterTab.designer.cs">
|
||||||
|
<DependentUpon>MetrologyDlgDiverterTab.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="UiControls\MetrologyDlgFlowMeterTab.cs">
|
<Compile Include="UiControls\MetrologyDlgFlowMeterTab.cs">
|
||||||
<SubType>UserControl</SubType>
|
<SubType>UserControl</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@ -3181,6 +3187,9 @@
|
|||||||
<EmbeddedResource Include="UiControls\MetrologyDlgDensityTab.resx">
|
<EmbeddedResource Include="UiControls\MetrologyDlgDensityTab.resx">
|
||||||
<DependentUpon>MetrologyDlgDensityTab.cs</DependentUpon>
|
<DependentUpon>MetrologyDlgDensityTab.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="UiControls\MetrologyDlgDiverterTab.resx">
|
||||||
|
<DependentUpon>MetrologyDlgDiverterTab.cs</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="UiControls\MetrologyDlgFlowMeterTab.resx">
|
<EmbeddedResource Include="UiControls\MetrologyDlgFlowMeterTab.resx">
|
||||||
<DependentUpon>MetrologyDlgFlowMeterTab.cs</DependentUpon>
|
<DependentUpon>MetrologyDlgFlowMeterTab.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
|||||||
291
TBF/UiControls/MetrologyDlgDiverterTab.Designer.cs
generated
Normal file
291
TBF/UiControls/MetrologyDlgDiverterTab.Designer.cs
generated
Normal file
@ -0,0 +1,291 @@
|
|||||||
|
///
|
||||||
|
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||||
|
///
|
||||||
|
namespace TBF.UiControls
|
||||||
|
{
|
||||||
|
partial class MetrologyDlgDiverterTab
|
||||||
|
{
|
||||||
|
/// <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.calibrationGroupBox = new System.Windows.Forms.GroupBox();
|
||||||
|
this.calibValidDateTextBox = new System.Windows.Forms.TextBox();
|
||||||
|
this.calibValidDateLabel = new System.Windows.Forms.Label();
|
||||||
|
this.calibDateTextBox = new System.Windows.Forms.TextBox();
|
||||||
|
this.calibDateLabel = new System.Windows.Forms.Label();
|
||||||
|
this.calibCertificateNrTextBox = new System.Windows.Forms.TextBox();
|
||||||
|
this.calibCertificateNrLabel = new System.Windows.Forms.Label();
|
||||||
|
this.nameGroupBox = new System.Windows.Forms.GroupBox();
|
||||||
|
this.pressFromToLabel = new System.Windows.Forms.Label();
|
||||||
|
this.tempFromToLabel = new System.Windows.Forms.Label();
|
||||||
|
this.cmpntNameLabel = new System.Windows.Forms.Label();
|
||||||
|
this.testGroupBox = new System.Windows.Forms.GroupBox();
|
||||||
|
this.correctedTextBox = new System.Windows.Forms.TextBox();
|
||||||
|
this.measuredTextBox = new System.Windows.Forms.TextBox();
|
||||||
|
this.correctedLabel = new System.Windows.Forms.Label();
|
||||||
|
this.measuredLabel = new System.Windows.Forms.Label();
|
||||||
|
this.listViewEx = new Results.Forms.ListViewEx();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||||
|
this.splitContainer1.Panel1.SuspendLayout();
|
||||||
|
this.splitContainer1.Panel2.SuspendLayout();
|
||||||
|
this.splitContainer1.SuspendLayout();
|
||||||
|
this.calibrationGroupBox.SuspendLayout();
|
||||||
|
this.nameGroupBox.SuspendLayout();
|
||||||
|
this.testGroupBox.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.calibrationGroupBox);
|
||||||
|
this.splitContainer1.Panel1.Controls.Add(this.nameGroupBox);
|
||||||
|
this.splitContainer1.Panel1.Controls.Add(this.testGroupBox);
|
||||||
|
//
|
||||||
|
// splitContainer1.Panel2
|
||||||
|
//
|
||||||
|
this.splitContainer1.Panel2.Controls.Add(this.listViewEx);
|
||||||
|
this.splitContainer1.Size = new System.Drawing.Size(650, 400);
|
||||||
|
this.splitContainer1.SplitterDistance = 102;
|
||||||
|
this.splitContainer1.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// calibrationGroupBox
|
||||||
|
//
|
||||||
|
this.calibrationGroupBox.Controls.Add(this.calibValidDateTextBox);
|
||||||
|
this.calibrationGroupBox.Controls.Add(this.calibValidDateLabel);
|
||||||
|
this.calibrationGroupBox.Controls.Add(this.calibDateTextBox);
|
||||||
|
this.calibrationGroupBox.Controls.Add(this.calibDateLabel);
|
||||||
|
this.calibrationGroupBox.Controls.Add(this.calibCertificateNrTextBox);
|
||||||
|
this.calibrationGroupBox.Controls.Add(this.calibCertificateNrLabel);
|
||||||
|
this.calibrationGroupBox.Location = new System.Drawing.Point(186, 10);
|
||||||
|
this.calibrationGroupBox.Name = "calibrationGroupBox";
|
||||||
|
this.calibrationGroupBox.Size = new System.Drawing.Size(228, 86);
|
||||||
|
this.calibrationGroupBox.TabIndex = 7;
|
||||||
|
this.calibrationGroupBox.TabStop = false;
|
||||||
|
this.calibrationGroupBox.Text = "Calibration";
|
||||||
|
//
|
||||||
|
// calibValidDateTextBox
|
||||||
|
//
|
||||||
|
this.calibValidDateTextBox.Enabled = false;
|
||||||
|
this.calibValidDateTextBox.Location = new System.Drawing.Point(140, 59);
|
||||||
|
this.calibValidDateTextBox.Name = "calibValidDateTextBox";
|
||||||
|
this.calibValidDateTextBox.Size = new System.Drawing.Size(82, 20);
|
||||||
|
this.calibValidDateTextBox.TabIndex = 15;
|
||||||
|
//
|
||||||
|
// calibValidDateLabel
|
||||||
|
//
|
||||||
|
this.calibValidDateLabel.AutoSize = true;
|
||||||
|
this.calibValidDateLabel.Location = new System.Drawing.Point(17, 62);
|
||||||
|
this.calibValidDateLabel.Name = "calibValidDateLabel";
|
||||||
|
this.calibValidDateLabel.Size = new System.Drawing.Size(52, 13);
|
||||||
|
this.calibValidDateLabel.TabIndex = 14;
|
||||||
|
this.calibValidDateLabel.Text = "Valid until";
|
||||||
|
//
|
||||||
|
// calibDateTextBox
|
||||||
|
//
|
||||||
|
this.calibDateTextBox.Enabled = false;
|
||||||
|
this.calibDateTextBox.Location = new System.Drawing.Point(140, 37);
|
||||||
|
this.calibDateTextBox.Name = "calibDateTextBox";
|
||||||
|
this.calibDateTextBox.Size = new System.Drawing.Size(82, 20);
|
||||||
|
this.calibDateTextBox.TabIndex = 13;
|
||||||
|
//
|
||||||
|
// calibDateLabel
|
||||||
|
//
|
||||||
|
this.calibDateLabel.AutoSize = true;
|
||||||
|
this.calibDateLabel.Location = new System.Drawing.Point(17, 40);
|
||||||
|
this.calibDateLabel.Name = "calibDateLabel";
|
||||||
|
this.calibDateLabel.Size = new System.Drawing.Size(30, 13);
|
||||||
|
this.calibDateLabel.TabIndex = 12;
|
||||||
|
this.calibDateLabel.Text = "Date";
|
||||||
|
//
|
||||||
|
// calibCertificateNrTextBox
|
||||||
|
//
|
||||||
|
this.calibCertificateNrTextBox.Enabled = false;
|
||||||
|
this.calibCertificateNrTextBox.Location = new System.Drawing.Point(140, 15);
|
||||||
|
this.calibCertificateNrTextBox.Name = "calibCertificateNrTextBox";
|
||||||
|
this.calibCertificateNrTextBox.Size = new System.Drawing.Size(82, 20);
|
||||||
|
this.calibCertificateNrTextBox.TabIndex = 11;
|
||||||
|
//
|
||||||
|
// calibCertificateNrLabel
|
||||||
|
//
|
||||||
|
this.calibCertificateNrLabel.AutoSize = true;
|
||||||
|
this.calibCertificateNrLabel.Location = new System.Drawing.Point(17, 18);
|
||||||
|
this.calibCertificateNrLabel.Name = "calibCertificateNrLabel";
|
||||||
|
this.calibCertificateNrLabel.Size = new System.Drawing.Size(69, 13);
|
||||||
|
this.calibCertificateNrLabel.TabIndex = 10;
|
||||||
|
this.calibCertificateNrLabel.Text = "Certificate nr.";
|
||||||
|
//
|
||||||
|
// nameGroupBox
|
||||||
|
//
|
||||||
|
this.nameGroupBox.Controls.Add(this.pressFromToLabel);
|
||||||
|
this.nameGroupBox.Controls.Add(this.tempFromToLabel);
|
||||||
|
this.nameGroupBox.Controls.Add(this.cmpntNameLabel);
|
||||||
|
this.nameGroupBox.Location = new System.Drawing.Point(16, 10);
|
||||||
|
this.nameGroupBox.Name = "nameGroupBox";
|
||||||
|
this.nameGroupBox.Size = new System.Drawing.Size(160, 86);
|
||||||
|
this.nameGroupBox.TabIndex = 5;
|
||||||
|
this.nameGroupBox.TabStop = false;
|
||||||
|
this.nameGroupBox.Text = "Component";
|
||||||
|
//
|
||||||
|
// pressFromToLabel
|
||||||
|
//
|
||||||
|
this.pressFromToLabel.AutoSize = true;
|
||||||
|
this.pressFromToLabel.Location = new System.Drawing.Point(14, 62);
|
||||||
|
this.pressFromToLabel.Name = "pressFromToLabel";
|
||||||
|
this.pressFromToLabel.Size = new System.Drawing.Size(0, 13);
|
||||||
|
this.pressFromToLabel.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// tempFromToLabel
|
||||||
|
//
|
||||||
|
this.tempFromToLabel.AutoSize = true;
|
||||||
|
this.tempFromToLabel.Location = new System.Drawing.Point(14, 44);
|
||||||
|
this.tempFromToLabel.Name = "tempFromToLabel";
|
||||||
|
this.tempFromToLabel.Size = new System.Drawing.Size(0, 13);
|
||||||
|
this.tempFromToLabel.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// cmpntNameLabel
|
||||||
|
//
|
||||||
|
this.cmpntNameLabel.AutoSize = true;
|
||||||
|
this.cmpntNameLabel.Location = new System.Drawing.Point(43, 22);
|
||||||
|
this.cmpntNameLabel.Name = "cmpntNameLabel";
|
||||||
|
this.cmpntNameLabel.Size = new System.Drawing.Size(64, 13);
|
||||||
|
this.cmpntNameLabel.TabIndex = 0;
|
||||||
|
this.cmpntNameLabel.Text = "cmpntName";
|
||||||
|
//
|
||||||
|
// testGroupBox
|
||||||
|
//
|
||||||
|
this.testGroupBox.Controls.Add(this.correctedTextBox);
|
||||||
|
this.testGroupBox.Controls.Add(this.measuredTextBox);
|
||||||
|
this.testGroupBox.Controls.Add(this.correctedLabel);
|
||||||
|
this.testGroupBox.Controls.Add(this.measuredLabel);
|
||||||
|
this.testGroupBox.Location = new System.Drawing.Point(424, 10);
|
||||||
|
this.testGroupBox.Name = "testGroupBox";
|
||||||
|
this.testGroupBox.Size = new System.Drawing.Size(170, 88);
|
||||||
|
this.testGroupBox.TabIndex = 4;
|
||||||
|
this.testGroupBox.TabStop = false;
|
||||||
|
this.testGroupBox.Text = "Correction test";
|
||||||
|
//
|
||||||
|
// correctedTextBox
|
||||||
|
//
|
||||||
|
this.correctedTextBox.Location = new System.Drawing.Point(91, 37);
|
||||||
|
this.correctedTextBox.Name = "correctedTextBox";
|
||||||
|
this.correctedTextBox.ReadOnly = true;
|
||||||
|
this.correctedTextBox.Size = new System.Drawing.Size(73, 20);
|
||||||
|
this.correctedTextBox.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// measuredTextBox
|
||||||
|
//
|
||||||
|
this.measuredTextBox.Location = new System.Drawing.Point(91, 15);
|
||||||
|
this.measuredTextBox.Name = "measuredTextBox";
|
||||||
|
this.measuredTextBox.Size = new System.Drawing.Size(73, 20);
|
||||||
|
this.measuredTextBox.TabIndex = 4;
|
||||||
|
this.measuredTextBox.TextChanged += new System.EventHandler(this.measuredTextBox_TextChanged);
|
||||||
|
//
|
||||||
|
// correctedLabel
|
||||||
|
//
|
||||||
|
this.correctedLabel.AutoSize = true;
|
||||||
|
this.correctedLabel.Location = new System.Drawing.Point(17, 40);
|
||||||
|
this.correctedLabel.Name = "correctedLabel";
|
||||||
|
this.correctedLabel.Size = new System.Drawing.Size(53, 13);
|
||||||
|
this.correctedLabel.TabIndex = 3;
|
||||||
|
this.correctedLabel.Text = "Corrected";
|
||||||
|
//
|
||||||
|
// measuredLabel
|
||||||
|
//
|
||||||
|
this.measuredLabel.AutoSize = true;
|
||||||
|
this.measuredLabel.Location = new System.Drawing.Point(17, 18);
|
||||||
|
this.measuredLabel.Name = "measuredLabel";
|
||||||
|
this.measuredLabel.Size = new System.Drawing.Size(54, 13);
|
||||||
|
this.measuredLabel.TabIndex = 2;
|
||||||
|
this.measuredLabel.Text = "Measured";
|
||||||
|
//
|
||||||
|
// 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(650, 294);
|
||||||
|
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);
|
||||||
|
//
|
||||||
|
// MetrologyDlgLevelMeterTab
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.Controls.Add(this.splitContainer1);
|
||||||
|
this.Name = "MetrologyDlgLevelMeterTab";
|
||||||
|
this.Size = new System.Drawing.Size(650, 400);
|
||||||
|
this.Load += new System.EventHandler(this.MetrologyDlgDiverterTab_Load);
|
||||||
|
this.splitContainer1.Panel1.ResumeLayout(false);
|
||||||
|
this.splitContainer1.Panel2.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
|
||||||
|
this.splitContainer1.ResumeLayout(false);
|
||||||
|
this.calibrationGroupBox.ResumeLayout(false);
|
||||||
|
this.calibrationGroupBox.PerformLayout();
|
||||||
|
this.nameGroupBox.ResumeLayout(false);
|
||||||
|
this.nameGroupBox.PerformLayout();
|
||||||
|
this.testGroupBox.ResumeLayout(false);
|
||||||
|
this.testGroupBox.PerformLayout();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.SplitContainer splitContainer1;
|
||||||
|
private System.Windows.Forms.Label cmpntNameLabel;
|
||||||
|
private Results.Forms.ListViewEx listViewEx;
|
||||||
|
private System.Windows.Forms.GroupBox testGroupBox;
|
||||||
|
private System.Windows.Forms.TextBox correctedTextBox;
|
||||||
|
private System.Windows.Forms.TextBox measuredTextBox;
|
||||||
|
private System.Windows.Forms.Label correctedLabel;
|
||||||
|
private System.Windows.Forms.Label measuredLabel;
|
||||||
|
private System.Windows.Forms.GroupBox nameGroupBox;
|
||||||
|
private System.Windows.Forms.GroupBox calibrationGroupBox;
|
||||||
|
private System.Windows.Forms.TextBox calibValidDateTextBox;
|
||||||
|
private System.Windows.Forms.Label calibValidDateLabel;
|
||||||
|
private System.Windows.Forms.TextBox calibDateTextBox;
|
||||||
|
private System.Windows.Forms.Label calibDateLabel;
|
||||||
|
private System.Windows.Forms.TextBox calibCertificateNrTextBox;
|
||||||
|
private System.Windows.Forms.Label calibCertificateNrLabel;
|
||||||
|
private System.Windows.Forms.Label pressFromToLabel;
|
||||||
|
private System.Windows.Forms.Label tempFromToLabel;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
342
TBF/UiControls/MetrologyDlgDiverterTab.cs
Normal file
342
TBF/UiControls/MetrologyDlgDiverterTab.cs
Normal file
@ -0,0 +1,342 @@
|
|||||||
|
///
|
||||||
|
/// 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 TBF.Resources;
|
||||||
|
|
||||||
|
namespace TBF.UiControls
|
||||||
|
{
|
||||||
|
public partial class MetrologyDlgDiverterTab : UserControl, IMetrologyDlgTab
|
||||||
|
{
|
||||||
|
static readonly ILog log = LogManager.GetLogger(typeof(MetrologyDlgLevelMeterTab));
|
||||||
|
|
||||||
|
/// <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>
|
||||||
|
/// Calibration information configuration
|
||||||
|
/// </summary>
|
||||||
|
public BenchControl.GenericDevices.ICalibInfoCfg CalibInfoCfg;
|
||||||
|
|
||||||
|
/// <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;
|
||||||
|
Control measurementTextBox;
|
||||||
|
Control correctionTextBox;
|
||||||
|
|
||||||
|
|
||||||
|
public MetrologyDlgDiverterTab()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
toBeRemoved = new List<MeasurementCorrection>();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MetrologyDlgDiverterTab_Load(object sender, System.EventArgs e)
|
||||||
|
{
|
||||||
|
if (meterEntity == null) return;
|
||||||
|
|
||||||
|
parent = ParentForm as MetrologyDlg;
|
||||||
|
|
||||||
|
Localize();
|
||||||
|
|
||||||
|
/// Panel1
|
||||||
|
cmpntNameLabel.Text = meterEntity.Name;
|
||||||
|
testGroupBox.Text = Strings.Test_measured_corrected;
|
||||||
|
measuredLabel.Text = Strings.Measured;
|
||||||
|
correctedLabel.Text = Strings.Corrected;
|
||||||
|
measuredTextBox.Text = string.Empty;
|
||||||
|
correctedTextBox.Text = string.Empty;
|
||||||
|
|
||||||
|
/// Panel2
|
||||||
|
measurementTextBox = new TextBox();
|
||||||
|
correctionTextBox = new TextBox();
|
||||||
|
this.Controls.Add(measurementTextBox);
|
||||||
|
this.Controls.Add(correctionTextBox);
|
||||||
|
|
||||||
|
listViewEx.SubItemClicked += new Results.Forms.SubItemEventHandler(listViewEx_SubItemClicked);
|
||||||
|
listViewEx.SubItemRightClicked += new Results.Forms.SubItemEventHandler(listViewEx_SubItemRightClicked);
|
||||||
|
listViewEx.SubItemEndEditing += new Results.Forms.SubItemEndEditingEventHandler(listViewEx_SubItemEndEditing);
|
||||||
|
|
||||||
|
listViewEx.Columns.Add(new ColumnHeader() { Text = Strings.Nr, Width = 60 });
|
||||||
|
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [m3/h]", Strings.Flow), Width = 100 });
|
||||||
|
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [ms]", Strings.Correction), Width = 100 });
|
||||||
|
|
||||||
|
RefreshAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Localize()
|
||||||
|
{
|
||||||
|
nameGroupBox.Text = Strings.Component;
|
||||||
|
|
||||||
|
calibrationGroupBox.Text = Strings.Calibration;
|
||||||
|
calibCertificateNrLabel.Text = Strings.Certificate;
|
||||||
|
calibDateLabel.Text = Strings.Date;
|
||||||
|
calibValidDateLabel.Text = Strings.Valid_until;
|
||||||
|
|
||||||
|
testGroupBox.Text = Strings.Test_measured_corrected;
|
||||||
|
measuredLabel.Text = Strings.Measured;
|
||||||
|
correctedLabel.Text = Strings.Corrected;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RefreshAll()
|
||||||
|
{
|
||||||
|
if (CalibInfoCfg != null)
|
||||||
|
{
|
||||||
|
calibCertificateNrTextBox.Text = CalibInfoCfg.CalibCertificateNr;
|
||||||
|
calibDateTextBox.Text = CalibInfoCfg.CalibDate.ToShortDateString();
|
||||||
|
calibValidDateTextBox.Text = CalibInfoCfg.CalibValidDate.ToShortDateString();
|
||||||
|
}
|
||||||
|
|
||||||
|
listViewEx.Items.Clear();
|
||||||
|
foreach (var corr in MeterEntity.Corrections)
|
||||||
|
{
|
||||||
|
AddOneLVI(corr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddOneLVI(MeasurementCorrection corr)
|
||||||
|
{
|
||||||
|
int nr = listViewEx.Items.Count + 1;
|
||||||
|
ListViewItem lvi = new ListViewItem(nr.ToString());
|
||||||
|
lvi.SubItems.Add(corr.Measurement.ToString());
|
||||||
|
lvi.SubItems.Add((1000 * corr.Correction).ToString());
|
||||||
|
lvi.Tag = corr;
|
||||||
|
listViewEx.Items.Add(lvi);
|
||||||
|
}
|
||||||
|
|
||||||
|
void listViewEx_SubItemClicked(object sender, Results.Forms.SubItemEventArgs e)
|
||||||
|
{
|
||||||
|
if (unlocked && e.SubItem == 1)
|
||||||
|
{
|
||||||
|
listViewEx.StartEditing(measurementTextBox, e.Item, e.SubItem);
|
||||||
|
}
|
||||||
|
else if (unlocked && e.SubItem == 2)
|
||||||
|
{
|
||||||
|
listViewEx.StartEditing(correctionTextBox, e.Item, e.SubItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void listViewEx_SubItemRightClicked(object sender, Results.Forms.SubItemEventArgs e)
|
||||||
|
{
|
||||||
|
if (!unlocked || e.SubItem < 1 || e.SubItem > 2) return;
|
||||||
|
|
||||||
|
if (DialogResult.Yes == MessageBox.Show(Strings.Do_you_want_to_copy_this_value_to_all_cells_below_this_cell,
|
||||||
|
Strings.Confirmation, MessageBoxButtons.YesNo, MessageBoxIcon.Question))
|
||||||
|
{
|
||||||
|
int columnNr = e.SubItem;
|
||||||
|
string value = null;
|
||||||
|
System.Drawing.Color backColor = System.Drawing.Color.White;
|
||||||
|
|
||||||
|
foreach (ListViewItem item in listViewEx.Items)
|
||||||
|
{
|
||||||
|
if (value != null && item.SubItems.Count > columnNr)
|
||||||
|
{
|
||||||
|
item.SubItems[columnNr].Text = value;
|
||||||
|
item.SubItems[columnNr].BackColor = backColor;
|
||||||
|
ParseItem(item, columnNr, value);
|
||||||
|
}
|
||||||
|
else if (item == e.Item)
|
||||||
|
{
|
||||||
|
value = item.SubItems[columnNr].Text;
|
||||||
|
backColor = item.SubItems[columnNr].BackColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void listViewEx_SubItemEndEditing(object sender, Results.Forms.SubItemEndEditingEventArgs e)
|
||||||
|
{
|
||||||
|
if (ParseItem(e.Item, e.SubItem, e.DisplayText)) return;
|
||||||
|
|
||||||
|
/// New value 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 value)
|
||||||
|
{
|
||||||
|
float fvalue;
|
||||||
|
if (subItem == 1 && Utils.TryParseEFloat(value, out fvalue) && fvalue >= 0)
|
||||||
|
{
|
||||||
|
(item.Tag as MeasurementCorrection).Measurement = fvalue;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (subItem == 2 && Utils.TryParseEFloat(value, out fvalue))
|
||||||
|
{
|
||||||
|
(item.Tag as MeasurementCorrection).Correction = fvalue / 1000;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Unlock()
|
||||||
|
{
|
||||||
|
unlocked = true;
|
||||||
|
|
||||||
|
calibCertificateNrTextBox.Enabled = true;
|
||||||
|
calibDateTextBox.Enabled = true;
|
||||||
|
calibValidDateTextBox.Enabled = 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()
|
||||||
|
{
|
||||||
|
if (CalibInfoCfg != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
CalibInfoCfg.CalibCertificateNr = calibCertificateNrTextBox.Text;
|
||||||
|
CalibInfoCfg.CalibDate = DateTime.Parse(calibDateTextBox.Text);
|
||||||
|
CalibInfoCfg.CalibValidDate = DateTime.Parse(calibValidDateTextBox.Text);
|
||||||
|
|
||||||
|
Component modified = CalibInfoCfg.CreateDbEntity();
|
||||||
|
MeterEntity.Parameters = modified.Parameters;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
MessageBox.Show(Strings.Invalid_calib_info_Correct_pls,
|
||||||
|
Strings.Error,
|
||||||
|
MessageBoxButtons.OK,
|
||||||
|
MessageBoxIcon.Exclamation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CancelBtnClicked()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddOne()
|
||||||
|
{
|
||||||
|
MeasurementCorrection corr = new MeasurementCorrection();
|
||||||
|
MeterEntity.Corrections.Add(corr);
|
||||||
|
AddOneLVI(corr);
|
||||||
|
|
||||||
|
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];
|
||||||
|
|
||||||
|
MeasurementCorrection selected = (MeasurementCorrection)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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void measuredTextBox_TextChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
float measured;
|
||||||
|
if (float.TryParse(measuredTextBox.Text,
|
||||||
|
NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign | NumberStyles.AllowExponent,
|
||||||
|
CultureInfo.CurrentCulture,
|
||||||
|
out measured) ||
|
||||||
|
float.TryParse(measuredTextBox.Text,
|
||||||
|
NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign | NumberStyles.AllowExponent,
|
||||||
|
CultureInfo.InvariantCulture,
|
||||||
|
out measured))
|
||||||
|
{
|
||||||
|
double corrected = Config.Formulas.CorrectedValue(measured, meterEntity.Corrections);
|
||||||
|
correctedTextBox.Text = corrected.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetWarningsBeforeSaving(ref Dictionary<string, string> renmInfo)
|
||||||
|
{
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
120
TBF/UiControls/MetrologyDlgDiverterTab.resx
Normal file
120
TBF/UiControls/MetrologyDlgDiverterTab.resx
Normal file
@ -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>
|
||||||
Loading…
Reference in New Issue
Block a user