MetrologyDlgLevelMeterTab added.

This commit is contained in:
Milan Hanajik 2018-11-12 18:35:47 +01:00
parent f48a71ce12
commit 872409870e
16 changed files with 851 additions and 38 deletions

View File

@ -12,11 +12,14 @@ namespace Config.Entities
public virtual float Measurement { get; set; }
public virtual float Correction { get; set; }
public MeasurementCorrection() { }
public MeasurementCorrection()
{
RangeIx = 0;
}
public MeasurementCorrection(int rangeIx)
{
RangeIx = rangeIx;
RangeIx = rangeIx;
}
}
}

View File

@ -9,7 +9,7 @@ using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Elde.FlowMeter
{
public class FlowMeterCfg : ComponentCfgBase, GenericDevices.ICalibInfoCfg, IChildComponentCfg
public class FlowMeterCfg : ComponentCfgBase, GenericDevices.ICalibRangesCfg, IChildComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(FlowMeterCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }

View File

@ -1,30 +1,18 @@
///
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
///
/// Copyright (c) 2018 Sensus Metering Systems
///
using System;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.GenericDevices
{
public interface ICalibInfoCfg : IComponentCfg
{
public interface ICalibInfoCfg : IComponentCfg
{
///
/// Access to parameters displayed in Metrology tab page
/// Parameters displayed in Metrology tab page
///
bool RangeEnabled(int rangeIx1);
double GetTempLo(int rangeIx1);
double GetTempHi(int rangeIx1);
double GetPressLo(int rangeIx1);
double GetPressHi(int rangeIx1);
string GetCalibCertificate(int rangeIx1); /// Get calibration certificate number
DateTime GetCalibDate(int rangeIx1); /// Get the date of calibration
DateTime GetCalibValidDate(int rangeIx1); /// Get calibration valid until (date)
void SetCalibCertificate(int rangeIx1, string certificate); /// Set calibration certificate number
void SetCalibDate(int rangeIx1, DateTime date); /// Get the date of calibration
void SetCalibValidDate(int rangeIx1, DateTime date); /// Get calibration valid until (date)
string CalibCertificateNr { get; set; } /// calibration certificate number
DateTime CalibDate { get; set; } /// date of calibration
DateTime CalibValidDate { get; set; } /// calibration valid until (date)
}
}

View File

@ -0,0 +1,30 @@
///
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
///
using System;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.GenericDevices
{
public interface ICalibRangesCfg : IComponentCfg
{
///
/// Access to parameters displayed in Metrology tab page
///
bool RangeEnabled(int rangeIx1);
double GetTempLo(int rangeIx1);
double GetTempHi(int rangeIx1);
double GetPressLo(int rangeIx1);
double GetPressHi(int rangeIx1);
string GetCalibCertificate(int rangeIx1); /// Get calibration certificate number
DateTime GetCalibDate(int rangeIx1); /// Get the date of calibration
DateTime GetCalibValidDate(int rangeIx1); /// Get calibration valid until (date)
void SetCalibCertificate(int rangeIx1, string certificate); /// Set calibration certificate number
void SetCalibDate(int rangeIx1, DateTime date); /// Get the date of calibration
void SetCalibValidDate(int rangeIx1, DateTime date); /// Get calibration valid until (date)
}
}

View File

@ -6,7 +6,7 @@ using TBF.BenchControl.Generic;
namespace TBF.BenchControl.GenericDevices
{
public interface IScaleCfg : IComponentCfg
public interface IScaleCfg : ICalibInfoCfg
{
///
/// Parameters displayed in Metrology tab page
@ -14,11 +14,7 @@ namespace TBF.BenchControl.GenericDevices
float BuoyancyTemp { get; set; } /// ambient temperature in [degree C]
float BuoyancyPress { get; set; } /// ambient pressure in [100000 Pa]
float BuoyancyHumi { get; set; } /// ambient relative humidity in [%]
float WeightStandardDensity { get; set; } /// density of the weight standard used to calibrate the scale [kg/m3]
string CalibCertificateNr { get; set; } /// calibration certificate number
DateTime CalibDate { get; set; } /// date of calibration
DateTime CalibValidDate { get; set; } /// calibration valid until (date)
float WeightStandardDensity { get; set; } /// density of the weight standard used to calibrate the scale [kg/m3]
}
}

View File

@ -144,7 +144,7 @@ namespace TBF.BenchControl.Output.DB.SaveFlowmeterCorrections
session.SaveOrUpdate(mc);
}
ICalibInfoCfg cfg = TbfComponents.CmpntCfgFromCmpntEntity(cmpnt) as ICalibInfoCfg;
ICalibRangesCfg cfg = TbfComponents.CmpntCfgFromCmpntEntity(cmpnt) as ICalibRangesCfg;
if (cfg != null)
{
cfg.SetCalibDate(rangeIx, DateTime.Now);

View File

@ -47,6 +47,7 @@ namespace TBF
int fixedCount = 0;
int balancesCount = 0;
int levelMetersCount = 0;
int flowMetersCount = 0;
int pressMetersCount = 0;
int tempMetersCount = 0;
@ -70,7 +71,7 @@ namespace TBF
{
BenchControl.Generic.IComponentFactory factory = TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName);
// Balance tab-pages
/// Balance tab-pages
if (factory is BenchControl.MettlerToledo.Standard.BalanceFactory ||
factory is BenchControl.MettlerToledo.Standard.BalanceOldFactory ||
factory is BenchControl.MettlerToledo.Standard.BalanceNewFactory ||
@ -87,7 +88,21 @@ namespace TBF
metrologyTabControl.TabPages.Add(tabPage);
}
// Flowmeter tab-pages
/// Level meters for tanks tab-pages
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)
{
BenchControl.Elde.FlowMeter.FlowMeterCfg flowMeterCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.Elde.FlowMeter.FlowMeterCfg;
@ -100,7 +115,7 @@ namespace TBF
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.ICalibInfoCfg;
uiControl.CalibInfoCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.GenericDevices.ICalibRangesCfg;
uiControl.Dock = DockStyle.Fill;
tabPage.Tag = uiControl;
tabPage.Controls.Add(uiControl);
@ -109,7 +124,7 @@ namespace TBF
}
}
// Pressure meter tab-pages
/// Pressure meter tab-pages
if (factory is BenchControl.Elde.PressureMeter.PressureMeterFactory)
{
pressMetersCount++;
@ -122,7 +137,7 @@ namespace TBF
metrologyTabControl.TabPages.Add(tabPage);
}
// Temperature meter tab-pages
/// Temperature meter tab-pages
if (factory is BenchControl.Elde.TempMeter.TempMeterFactory ||
factory is BenchControl.Elde.TempMeterInternal.TempMeterFactory)
{
@ -136,7 +151,7 @@ namespace TBF
metrologyTabControl.TabPages.Add(tabPage);
}
// Platinum resistance temperature meter tab-pages
/// Platinum resistance temperature meter tab-pages
if (factory is BenchControl.Keithley.TempMeter.Factory)
{
platinumTempMetersCount++;

View File

@ -2058,6 +2058,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Level.
/// </summary>
internal static string Level {
get {
return ResourceManager.GetString("Level", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Live.
/// </summary>

View File

@ -1335,4 +1335,7 @@
<data name="Missing_a_tank_with_volume_measurement" xml:space="preserve">
<value>Chybí nádrž s měřením objemu</value>
</data>
<data name="Level" xml:space="preserve">
<value>Hladina</value>
</data>
</root>

View File

@ -1873,4 +1873,7 @@
<data name="Missing_a_tank_with_volume_measurement" xml:space="preserve">
<value>Missing a tank with volume measurement</value>
</data>
<data name="Level" xml:space="preserve">
<value>Level</value>
</data>
</root>

View File

@ -144,4 +144,7 @@
<data name="RFID_communication_failed" xml:space="preserve">
<value>Zlyhala RFID komunikácia</value>
</data>
<data name="Level" xml:space="preserve">
<value>Hladina</value>
</data>
</root>

View File

@ -515,6 +515,7 @@
<DependentUpon>ValveCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="BenchControl\Elde\ValveEx\ValveFactory.cs" />
<Compile Include="BenchControl\GenericDevices\ICalibInfoCfg.cs" />
<Compile Include="BenchControl\GenericDevices\IHart.cs" />
<Compile Include="BenchControl\GenericDevices\IHasTestName.cs" />
<Compile Include="BenchControl\GenericDevices\ICameraDisplay.cs" />
@ -524,7 +525,7 @@
<Compile Include="BenchControl\GenericDevices\IPlotter.cs" />
<Compile Include="BenchControl\GenericDevices\IRoiForFixedStart.cs" />
<Compile Include="BenchControl\GenericDevices\IScaleCfg.cs" />
<Compile Include="BenchControl\GenericDevices\ICalibInfoCfg.cs" />
<Compile Include="BenchControl\GenericDevices\ICalibRangesCfg.cs" />
<Compile Include="BenchControl\GenericDevices\IHasHeatMtrStatesForm.cs" />
<Compile Include="BenchControl\GenericDevices\IModbus.cs" />
<Compile Include="BenchControl\GenericDevices\IBenchInfo.cs" />
@ -2055,6 +2056,12 @@
<Compile Include="UiControls\MetrologyDlgPressMeterTab.Designer.cs">
<DependentUpon>MetrologyDlgPressMeterTab.cs</DependentUpon>
</Compile>
<Compile Include="UiControls\MetrologyDlgLevelMeterTab.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UiControls\MetrologyDlgLevelMeterTab.Designer.cs">
<DependentUpon>MetrologyDlgLevelMeterTab.cs</DependentUpon>
</Compile>
<Compile Include="UiControls\MetrologyDlgTempMeterTab.cs">
<SubType>UserControl</SubType>
</Compile>
@ -2910,6 +2917,9 @@
<EmbeddedResource Include="UiControls\MetrologyDlgPressMeterTab.resx">
<DependentUpon>MetrologyDlgPressMeterTab.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UiControls\MetrologyDlgLevelMeterTab.resx">
<DependentUpon>MetrologyDlgLevelMeterTab.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UiControls\MetrologyDlgTempMeterTab.resx">
<DependentUpon>MetrologyDlgTempMeterTab.cs</DependentUpon>
</EmbeddedResource>

View File

@ -29,7 +29,7 @@ namespace TBF.UiControls
/// <summary>
/// Calibration information configuration
/// </summary>
public BenchControl.GenericDevices.ICalibInfoCfg CalibInfoCfg;
public BenchControl.GenericDevices.ICalibRangesCfg CalibInfoCfg;
/// <summary>
/// A list of 'measurement-correction' pairs to be deleted from the database on OK.

View File

@ -0,0 +1,291 @@
///
/// Copyright (c) 2018 Sensus Metering Systems
///
namespace TBF.UiControls
{
partial class MetrologyDlgLevelMeterTab
{
/// <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.MetrologyDlgLevelMeterTab_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;
}
}

View File

@ -0,0 +1,342 @@
///
/// Copyright (c) 2018 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 MetrologyDlgLevelMeterTab : 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 MetrologyDlgLevelMeterTab()
{
InitializeComponent();
toBeRemoved = new List<MeasurementCorrection>();
}
private void MetrologyDlgLevelMeterTab_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} [mm]", Strings.Level), Width = 100 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [mm]", 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((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;
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)
{
}
}
}

View 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>