Refactorization: TBF.UI namespace, no change of function, ver. 2.18.1314

This commit is contained in:
Milan Hanajik
2019-09-17 10:58:44 +02:00
parent 7f8a5c83ed
commit 994568799d
258 changed files with 2791 additions and 4149 deletions
@@ -0,0 +1,22 @@
///
/// Copyright (c) 2013-2015 Sensus Slovensko a.s.
///
using System.Collections.Generic;
using Config.Entities;
namespace TBF.UI.Bench.Metrology
{
interface IMetrologyDlgTab : 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<MeasurementCorrection> ToBeRemoved { get; set; }
}
}
+103
View File
@@ -0,0 +1,103 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
namespace TBF.UI.Bench.Metrology
{
partial class MetrologyDlg
{
/// <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.metrologyTabControl = 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.metrologyTabControl);
//
// 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;
//
// metrologyTabControl
//
this.metrologyTabControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.metrologyTabControl.ItemSize = new System.Drawing.Size(60, 30);
this.metrologyTabControl.Location = new System.Drawing.Point(0, 0);
this.metrologyTabControl.Name = "metrologyTabControl";
this.metrologyTabControl.SelectedIndex = 0;
this.metrologyTabControl.Size = new System.Drawing.Size(863, 344);
this.metrologyTabControl.TabIndex = 0;
this.metrologyTabControl.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;
//
// MetrologyDlg
//
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 = "MetrologyDlg";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Metrology";
this.Load += new System.EventHandler(this.MetrologyDlg_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 metrologyTabControl;
private TBF.UI.Shared.SharedButtons sharedButtons;
}
}
+319
View File
@@ -0,0 +1,319 @@
///
/// Copyright (c) 2013-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.Metrology
{
public partial class MetrologyDlg : Form, IParentOfListViewEx
{
static readonly ILog log = LogManager.GetLogger(typeof(MetrologyDlg));
public IList<Component> cmpntEntities;
ISession session;
public MetrologyDlg()
{
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 MetrologyDlg_Load(object sender, EventArgs e)
{
LoadUISettings();
Text = Strings.Metrology;
int fixedCount = 0;
int balancesCount = 0;
int levelMetersCount = 0;
int divertersCount = 0;
int flowMetersCount = 0;
int pressMetersCount = 0;
int tempMetersCount = 0;
int platinumTempMetersCount = 0;
int evaporationsCount = 0;
session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config);
cmpntEntities = session.QueryOver<Component>()
.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-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 + " ");
MetrologyDlgBalanceTab uiControl = new MetrologyDlgBalanceTab();
uiControl.MeterEntity = cmpnt;
uiControl.BalanceCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.GenericDevices.IScaleCfg;
uiControl.Dock = DockStyle.Fill;
tabPage.Tag = uiControl;
tabPage.Controls.Add(uiControl);
metrologyTabControl.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 + " ");
MetrologyDlgPressMeterTab uiControl = new MetrologyDlgPressMeterTab();
uiControl.MeterEntity = cmpnt;
uiControl.Dock = DockStyle.Fill;
tabPage.Tag = uiControl;
tabPage.Controls.Add(uiControl);
metrologyTabControl.TabPages.Add(tabPage);
}
/// Tab-pages for temperature meters
if (factory is BenchControl.Elde.TempMeter.TempMeterFactory ||
factory is BenchControl.Elde.TempMeterInternal.TempMeterFactory)
{
tempMetersCount++;
TabPage tabPage = new TabPage(" " + cmpnt.Name + " ");
MetrologyDlgTempMeterTab uiControl = new MetrologyDlgTempMeterTab();
uiControl.MeterEntity = cmpnt;
uiControl.Dock = DockStyle.Fill;
tabPage.Tag = uiControl;
tabPage.Controls.Add(uiControl);
metrologyTabControl.TabPages.Add(tabPage);
}
/// Tab-pages for platinum resistance temperature meters
if (factory is BenchControl.Keithley.TempMeter.Factory)
{
platinumTempMetersCount++;
TabPage tabPage = new TabPage(" " + cmpnt.Name + " ");
MetrologyDlgPlatinumResistanceTMeterTab uiControl = new MetrologyDlgPlatinumResistanceTMeterTab();
uiControl.MeterEntity = cmpnt;
uiControl.TempMeterCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.Keithley.TempMeter.TempMeterCfg;
uiControl.Dock = DockStyle.Fill;
tabPage.Tag = uiControl;
tabPage.Controls.Add(uiControl);
metrologyTabControl.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 metrologyTabControl.TabPages)
{
(tabPage.Tag as IMetrologyDlgTab).Unlock();
}
}
private void okButton_Click(object sender, EventArgs e)
{
using (ITransaction transaction = session.BeginTransaction())
{
try
{
foreach (TabPage tabPage in metrologyTabControl.TabPages)
{
IMetrologyDlgTab tab = tabPage.Tag as IMetrologyDlgTab;
tab.OkBtnClicked();
if (!(tabPage.Tag is MetrologyDlgDensityTab))
{
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 metrologyTabControl.TabPages)
{
(tabPage.Tag as IMetrologyDlgTab).CancelBtnClicked();
}
SaveUISettings();
DialogResult = DialogResult.Cancel;
Close();
}
private void SaveUISettings()
{
/// Obtain MetrologyDlg 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.MetrologyDlgMaximized != isMaximized ||
ls.MetrologyDlgLeft != left ||
ls.MetrologyDlgTop != top ||
ls.MetrologyDlgWidth != width ||
ls.MetrologyDlgHeight != height))
{
/// At least one MetrologyDlg dimension differs => Update local settings and save them
ls.MetrologyDlgMaximized = isMaximized;
ls.MetrologyDlgLeft = left;
ls.MetrologyDlgTop = top;
ls.MetrologyDlgWidth = width;
ls.MetrologyDlgHeight = height;
ls.Save();
}
}
private void LoadUISettings()
{
TBF.LocalSettings ls = Program.LocalSettings;
WindowState = (ls.MetrologyDlgMaximized ? FormWindowState.Maximized : FormWindowState.Normal);
Width = (ls.MetrologyDlgWidth > 0) ? ls.MetrologyDlgWidth : 900;
Height = (ls.MetrologyDlgHeight > 0) ? ls.MetrologyDlgHeight : 500;
Left = (ls.MetrologyDlgLeft != 0) ? ls.MetrologyDlgLeft : 200;
Top = (ls.MetrologyDlgTop != 0) ? ls.MetrologyDlgTop : 100;
}
private void addButton_Click(object sender, EventArgs e)
{
(metrologyTabControl.SelectedTab.Tag as IMetrologyDlgTab).AddOne();
}
private void removeButton_Click(object sender, EventArgs e)
{
(metrologyTabControl.SelectedTab.Tag as IMetrologyDlgTab).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);
}
}
}
+120
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>
+398
View File
@@ -0,0 +1,398 @@
///
/// Copyright (c) 2013-2015 Senus Slovensko a.s.
///
namespace TBF.UI.Bench.Metrology
{
partial class MetrologyDlgBalanceTab
{
/// <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.cmpntNameLabel = new System.Windows.Forms.Label();
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.buoancyGroupBox = new System.Windows.Forms.GroupBox();
this.weightStandardDensityTextBox = new System.Windows.Forms.TextBox();
this.weightStandardDensityLabel = new System.Windows.Forms.Label();
this.airDensityTextBox = new System.Windows.Forms.TextBox();
this.airDensityLabel = new System.Windows.Forms.Label();
this.buoyancyHumiTextBox = new System.Windows.Forms.TextBox();
this.buoyancyPressTextBox = new System.Windows.Forms.TextBox();
this.buoyancyTempTextBox = new System.Windows.Forms.TextBox();
this.buoyancyHumiLabel = new System.Windows.Forms.Label();
this.buoyancyPressLabel = new System.Windows.Forms.Label();
this.buoyancyTempLabel = new System.Windows.Forms.Label();
this.nameGroupBox = new System.Windows.Forms.GroupBox();
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 global::Results.Forms.ListViewEx();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.calibrationGroupBox.SuspendLayout();
this.buoancyGroupBox.SuspendLayout();
this.nameGroupBox.SuspendLayout();
this.testGroupBox.SuspendLayout();
this.SuspendLayout();
//
// cmpntNameLabel
//
this.cmpntNameLabel.AutoSize = true;
this.cmpntNameLabel.Location = new System.Drawing.Point(69, 16);
this.cmpntNameLabel.Name = "cmpntNameLabel";
this.cmpntNameLabel.Size = new System.Drawing.Size(64, 13);
this.cmpntNameLabel.TabIndex = 0;
this.cmpntNameLabel.Text = "cmpntName";
//
// 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.buoancyGroupBox);
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(668, 400);
this.splitContainer1.SplitterDistance = 150;
this.splitContainer1.TabIndex = 1;
//
// 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(16, 54);
this.calibrationGroupBox.Name = "calibrationGroupBox";
this.calibrationGroupBox.Size = new System.Drawing.Size(208, 86);
this.calibrationGroupBox.TabIndex = 6;
this.calibrationGroupBox.TabStop = false;
this.calibrationGroupBox.Text = "Calibration";
//
// calibValidDateTextBox
//
this.calibValidDateTextBox.Enabled = false;
this.calibValidDateTextBox.Location = new System.Drawing.Point(120, 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(120, 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(120, 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(54, 13);
this.calibCertificateNrLabel.TabIndex = 10;
this.calibCertificateNrLabel.Text = "Certificate";
//
// buoancyGroupBox
//
this.buoancyGroupBox.Controls.Add(this.weightStandardDensityTextBox);
this.buoancyGroupBox.Controls.Add(this.weightStandardDensityLabel);
this.buoancyGroupBox.Controls.Add(this.airDensityTextBox);
this.buoancyGroupBox.Controls.Add(this.airDensityLabel);
this.buoancyGroupBox.Controls.Add(this.buoyancyHumiTextBox);
this.buoancyGroupBox.Controls.Add(this.buoyancyPressTextBox);
this.buoancyGroupBox.Controls.Add(this.buoyancyTempTextBox);
this.buoancyGroupBox.Controls.Add(this.buoyancyHumiLabel);
this.buoancyGroupBox.Controls.Add(this.buoyancyPressLabel);
this.buoancyGroupBox.Controls.Add(this.buoyancyTempLabel);
this.buoancyGroupBox.Location = new System.Drawing.Point(233, 10);
this.buoancyGroupBox.Name = "buoancyGroupBox";
this.buoancyGroupBox.Size = new System.Drawing.Size(248, 130);
this.buoancyGroupBox.TabIndex = 5;
this.buoancyGroupBox.TabStop = false;
this.buoancyGroupBox.Text = "Buoyancy";
//
// weightStandardDensityTextBox
//
this.weightStandardDensityTextBox.Enabled = false;
this.weightStandardDensityTextBox.Location = new System.Drawing.Point(160, 103);
this.weightStandardDensityTextBox.Name = "weightStandardDensityTextBox";
this.weightStandardDensityTextBox.Size = new System.Drawing.Size(82, 20);
this.weightStandardDensityTextBox.TabIndex = 9;
//
// weightStandardDensityLabel
//
this.weightStandardDensityLabel.AutoSize = true;
this.weightStandardDensityLabel.Location = new System.Drawing.Point(17, 106);
this.weightStandardDensityLabel.Name = "weightStandardDensityLabel";
this.weightStandardDensityLabel.Size = new System.Drawing.Size(133, 13);
this.weightStandardDensityLabel.TabIndex = 8;
this.weightStandardDensityLabel.Text = "Ref. mass density [kg/m3]:";
//
// airDensityTextBox
//
this.airDensityTextBox.Enabled = false;
this.airDensityTextBox.Location = new System.Drawing.Point(160, 81);
this.airDensityTextBox.Name = "airDensityTextBox";
this.airDensityTextBox.Size = new System.Drawing.Size(82, 20);
this.airDensityTextBox.TabIndex = 7;
//
// airDensityLabel
//
this.airDensityLabel.AutoSize = true;
this.airDensityLabel.Location = new System.Drawing.Point(17, 84);
this.airDensityLabel.Name = "airDensityLabel";
this.airDensityLabel.Size = new System.Drawing.Size(95, 13);
this.airDensityLabel.TabIndex = 6;
this.airDensityLabel.Text = "Air density [kg/m3]";
//
// buoyancyHumiTextBox
//
this.buoyancyHumiTextBox.Enabled = false;
this.buoyancyHumiTextBox.Location = new System.Drawing.Point(160, 59);
this.buoyancyHumiTextBox.Name = "buoyancyHumiTextBox";
this.buoyancyHumiTextBox.Size = new System.Drawing.Size(82, 20);
this.buoyancyHumiTextBox.TabIndex = 5;
//
// buoyancyPressTextBox
//
this.buoyancyPressTextBox.Enabled = false;
this.buoyancyPressTextBox.Location = new System.Drawing.Point(160, 37);
this.buoyancyPressTextBox.Name = "buoyancyPressTextBox";
this.buoyancyPressTextBox.Size = new System.Drawing.Size(82, 20);
this.buoyancyPressTextBox.TabIndex = 4;
//
// buoyancyTempTextBox
//
this.buoyancyTempTextBox.Enabled = false;
this.buoyancyTempTextBox.Location = new System.Drawing.Point(160, 15);
this.buoyancyTempTextBox.Name = "buoyancyTempTextBox";
this.buoyancyTempTextBox.Size = new System.Drawing.Size(82, 20);
this.buoyancyTempTextBox.TabIndex = 3;
//
// buoyancyHumiLabel
//
this.buoyancyHumiLabel.AutoSize = true;
this.buoyancyHumiLabel.Location = new System.Drawing.Point(17, 62);
this.buoyancyHumiLabel.Name = "buoyancyHumiLabel";
this.buoyancyHumiLabel.Size = new System.Drawing.Size(72, 13);
this.buoyancyHumiLabel.TabIndex = 2;
this.buoyancyHumiLabel.Text = "Humidity [R%]";
//
// buoyancyPressLabel
//
this.buoyancyPressLabel.AutoSize = true;
this.buoyancyPressLabel.Location = new System.Drawing.Point(17, 40);
this.buoyancyPressLabel.Name = "buoyancyPressLabel";
this.buoyancyPressLabel.Size = new System.Drawing.Size(76, 13);
this.buoyancyPressLabel.TabIndex = 1;
this.buoyancyPressLabel.Text = "Pressure [hPa]";
//
// buoyancyTempLabel
//
this.buoyancyTempLabel.AutoSize = true;
this.buoyancyTempLabel.Location = new System.Drawing.Point(17, 18);
this.buoyancyTempLabel.Name = "buoyancyTempLabel";
this.buoyancyTempLabel.Size = new System.Drawing.Size(83, 13);
this.buoyancyTempLabel.TabIndex = 0;
this.buoyancyTempLabel.Text = "Temperature [C]";
//
// nameGroupBox
//
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(208, 40);
this.nameGroupBox.TabIndex = 4;
this.nameGroupBox.TabStop = false;
this.nameGroupBox.Text = "Component";
//
// 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(490, 10);
this.testGroupBox.Name = "testGroupBox";
this.testGroupBox.Size = new System.Drawing.Size(170, 88);
this.testGroupBox.TabIndex = 3;
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(668, 246);
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);
//
// MetrologyDlgBalanceTab
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.splitContainer1);
this.Name = "MetrologyDlgBalanceTab";
this.Size = new System.Drawing.Size(668, 400);
this.Load += new System.EventHandler(this.MetrologyDlgBalanceTab_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.buoancyGroupBox.ResumeLayout(false);
this.buoancyGroupBox.PerformLayout();
this.nameGroupBox.ResumeLayout(false);
this.nameGroupBox.PerformLayout();
this.testGroupBox.ResumeLayout(false);
this.testGroupBox.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Label cmpntNameLabel;
private System.Windows.Forms.SplitContainer splitContainer1;
private global::Results.Forms.ListViewEx listViewEx;
private System.Windows.Forms.Label measuredLabel;
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.GroupBox buoancyGroupBox;
private System.Windows.Forms.GroupBox nameGroupBox;
private System.Windows.Forms.TextBox buoyancyHumiTextBox;
private System.Windows.Forms.TextBox buoyancyPressTextBox;
private System.Windows.Forms.TextBox buoyancyTempTextBox;
private System.Windows.Forms.Label buoyancyHumiLabel;
private System.Windows.Forms.Label buoyancyPressLabel;
private System.Windows.Forms.Label buoyancyTempLabel;
private System.Windows.Forms.TextBox weightStandardDensityTextBox;
private System.Windows.Forms.Label weightStandardDensityLabel;
private System.Windows.Forms.TextBox airDensityTextBox;
private System.Windows.Forms.Label airDensityLabel;
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;
}
}
@@ -0,0 +1,395 @@
///
/// Copyright (c) 2013-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.Metrology
{
public partial class MetrologyDlgBalanceTab : UserControl, IMetrologyDlgTab
{
static readonly ILog log = LogManager.GetLogger(typeof(MetrologyDlgBalanceTab));
/// <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 BalanceCfg;
/// <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;
Control errorTextBox;
public MetrologyDlgBalanceTab()
{
InitializeComponent();
toBeRemoved = new List<MeasurementCorrection>();
unlocked = false;
}
private void MetrologyDlgBalanceTab_Load(object sender, System.EventArgs e)
{
if (meterEntity == null) return;
parent = ParentForm as MetrologyDlg;
Localize();
/// Panel1
cmpntNameLabel.Text = meterEntity.Name;
measuredTextBox.Text = string.Empty;
correctedTextBox.Text = string.Empty;
/// Panel2
this.Controls.Add(measurementTextBox = new TextBox());
this.Controls.Add(correctionTextBox = new TextBox());
this.Controls.Add(errorTextBox = new TextBox());
listViewEx.SubItemClicked += new SubItemEventHandler(listViewEx_SubItemClicked);
listViewEx.SubItemEndEditing += new SubItemEndEditingEventHandler(listViewEx_SubItemEndEditing);
listViewEx.Columns.Add(new ColumnHeader() { Text = Strings.Nr, Width = 60 });
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.Correction), Width = 100 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [%]", Strings.Error), 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;
buoyancyTempLabel.Text = string.Format("{0} [°C]", Strings.Ambient_temperature);
buoyancyPressLabel.Text = string.Format("{0} [mbar]", Strings.Ambient_pressure);
buoyancyHumiLabel.Text = string.Format("{0} [%]", Strings.Ambient_humidity);
airDensityLabel.Text = Strings.Air_density_kg_m3;
weightStandardDensityLabel.Text = Strings.Ref_mass_dens_kg_m3;
testGroupBox.Text = Strings.Test_measured_corrected;
measuredLabel.Text = Strings.Measured;
correctedLabel.Text = Strings.Corrected;
}
void RefreshAll()
{
if (BalanceCfg != null)
{
calibCertificateNrTextBox.Text = BalanceCfg.CalibCertificateNr;
calibDateTextBox.Text = BalanceCfg.CalibDate.ToShortDateString();
calibValidDateTextBox.Text = BalanceCfg.CalibValidDate.ToShortDateString();
buoyancyTempTextBox.Text = BalanceCfg.BuoyancyTemp.ToString("F2");
buoyancyPressTextBox.Text = BalanceCfg.BuoyancyPress.ToString("F4");
buoyancyHumiTextBox.Text = BalanceCfg.BuoyancyHumi.ToString("F1");
/// airDensityTextBox.Text = //calculate air density
weightStandardDensityTextBox.Text = BalanceCfg.WeightStandardDensity.ToString("F1");
}
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.Tag = corr;
lvi.SubItems.Add(corr.Measurement.ToString());
lvi.SubItems.Add((1000 * corr.Correction).ToString());
if (corr.Measurement == 0)
{
lvi.SubItems.Add(Strings.NaN);
}
else
{
double error = Config.Formulas.ErrorFromVolumes(corr.Measurement, corr.Measurement + corr.Correction);
lvi.SubItems.Add(error.ToString(Config.Utils.SignificantDigitsToFmt(error, 5)));
}
listViewEx.Items.Add(lvi);
}
void listViewEx_SubItemClicked(object sender, 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);
}
else if (unlocked && e.SubItem == 3)
{
listViewEx.StartEditing(correctionTextBox, 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)
{
double dblValue = 0;
if (subItem == 1 && Utils.TryParseEDouble(strValue, out dblValue) && dblValue >= 0)
{
(item.Tag as MeasurementCorrection).Measurement = (float)dblValue;
/// Update error (if possible)
double correction1000;
if (Utils.TryParseEDouble(item.SubItems[2].Text, out correction1000) && (dblValue != 0))
{
double correction = correction1000 / 1000;
double error = Config.Formulas.ErrorFromVolumes(dblValue, dblValue + correction);
item.SubItems[3].Text = error.ToString(Config.Utils.SignificantDigitsToFmt(error, 5));
}
else
{
item.SubItems[3].Text = Strings.NaN;
}
return true;
}
else if (subItem == 2 && Utils.TryParseEDouble(strValue, out dblValue))
{
double correctionInDefaultUnits = dblValue / 1000;
(item.Tag as MeasurementCorrection).Correction = (float)correctionInDefaultUnits;
/// Update error (if possible)
double measurement;
if (Utils.TryParseEDouble(item.SubItems[1].Text, out measurement) && (measurement != 0))
{
double error = Config.Formulas.ErrorFromVolumes(measurement, measurement + correctionInDefaultUnits);
item.SubItems[3].Text = error.ToString(Config.Utils.SignificantDigitsToFmt(error, 5));
}
else
{
item.SubItems[3].Text = Strings.NaN;
}
return true;
}
else if (subItem == 3 && ((strValue == Strings.NaN) || Utils.TryParseEDouble(strValue, out dblValue)))
{
if (strValue == Strings.NaN)
{
}
else
{
double measurement;
if (Utils.TryParseEDouble(item.SubItems[1].Text, out measurement) && measurement != 0)
{
double correction = Config.Formulas.CorrectionFromError(measurement, dblValue);
double correction1000 = 1000 * correction;
item.SubItems[2].Text = correction1000.ToString(Config.Utils.SignificantDigitsToFmt(correction1000, 5));
(item.Tag as MeasurementCorrection).Correction = (float)correction;
}
}
return true;
}
else
{
return false;
}
}
public void Unlock()
{
unlocked = true;
calibCertificateNrTextBox.Enabled = true;
calibDateTextBox.Enabled = true;
calibValidDateTextBox.Enabled = true;
buoyancyTempTextBox.Enabled = true;
buoyancyPressTextBox.Enabled = true;
buoyancyHumiTextBox.Enabled = true;
weightStandardDensityTextBox.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 (BalanceCfg != null)
{
try
{
BalanceCfg.CalibCertificateNr = calibCertificateNrTextBox.Text;
BalanceCfg.CalibDate = DateTime.Parse(calibDateTextBox.Text);
BalanceCfg.CalibValidDate = DateTime.Parse(calibValidDateTextBox.Text);
BalanceCfg.BuoyancyTemp = Utils.ParseSFloat(buoyancyTempTextBox.Text);
BalanceCfg.BuoyancyPress = Utils.ParseUFloat(buoyancyPressTextBox.Text);
BalanceCfg.BuoyancyHumi = Utils.ParseUFloat(buoyancyHumiTextBox.Text);
BalanceCfg.WeightStandardDensity = Utils.ParseUFloat(weightStandardDensityTextBox.Text);
Component modified = BalanceCfg.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()
{
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)
{
}
}
}
@@ -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>
+145
View File
@@ -0,0 +1,145 @@
///
/// Copyright (c) 2013-2015 Senus Slovensko a.s.
///
namespace TBF.UI.Bench.Metrology
{
partial class MetrologyDlgDensityTab
{
/// <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,141 @@
///
/// Copyright (c) 2013-2017 Senus 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.UI.Bench.Metrology
{
public partial class MetrologyDlgDensityTab : UserControl, IMetrologyDlgTab
{
static readonly ILog log = LogManager.GetLogger(typeof(MetrologyDlgDensityTab));
/// <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 null; }
set { }
}
/// <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 MetrologyDlgDensityTab()
{
InitializeComponent();
toBeRemoved = new List<MeasurementCorrection>();
unlocked = false;
}
private void MetrologyDlgDensityTab_Load(object sender, System.EventArgs e)
{
parent = ParentForm as MetrologyDlg;
/// 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 = 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");
}
public void Unlock()
{
unlocked = true;
densityTextBox.Enabled = true;
temperatureTextBox.Enabled = true;
}
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();
}
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,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>
+291
View File
@@ -0,0 +1,291 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
namespace TBF.UI.Bench.Metrology
{
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 global::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 global::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;
}
}
@@ -0,0 +1,344 @@
///
/// 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.Metrology
{
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 SubItemEventHandler(listViewEx_SubItemClicked);
listViewEx.SubItemRightClicked += new SubItemEventHandler(listViewEx_SubItemRightClicked);
listViewEx.SubItemEndEditing += new 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, 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, 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, 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)
{
}
}
}
@@ -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,291 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
namespace TBF.UI.Bench.Metrology
{
partial class MetrologyDlgEvaporationTab
{
/// <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 global::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.MetrologyDlgEvaporationTab_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 global::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;
}
}
@@ -0,0 +1,344 @@
///
/// 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.Metrology
{
public partial class MetrologyDlgEvaporationTab : 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 MetrologyDlgEvaporationTab()
{
InitializeComponent();
toBeRemoved = new List<MeasurementCorrection>();
}
private void MetrologyDlgEvaporationTab_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 SubItemEventHandler(listViewEx_SubItemClicked);
listViewEx.SubItemRightClicked += new SubItemEventHandler(listViewEx_SubItemRightClicked);
listViewEx.SubItemEndEditing += new SubItemEndEditingEventHandler(listViewEx_SubItemEndEditing);
listViewEx.Columns.Add(new ColumnHeader() { Text = Strings.Nr, Width = 60 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [°C]", Strings.Temperature), Width = 100 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [g/hour]", Strings.Evaporation), 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, 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, 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, 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)
{
}
}
}
@@ -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,291 @@
///
/// Copyright (c) 2013-2015 Senus Slovensko a.s.
///
namespace TBF.UI.Bench.Metrology
{
partial class MetrologyDlgFlowMeterTab
{
/// <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 global::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);
//
// MetrologyDlgFlowMeterTab
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.splitContainer1);
this.Name = "MetrologyDlgFlowMeterTab";
this.Size = new System.Drawing.Size(650, 400);
this.Load += new System.EventHandler(this.MetrologyDlgFlowMeterTab_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 global::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;
}
}
@@ -0,0 +1,392 @@
///
/// Copyright (c) 2013-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.Metrology
{
public partial class MetrologyDlgFlowMeterTab : UserControl, IMetrologyDlgTab
{
static readonly ILog log = LogManager.GetLogger(typeof(MetrologyDlgFlowMeterTab));
/// <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.ICalibRangesCfg 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;
Control errorTextBox;
int rangeIx; /// 0 (no range) or 1..5 (range #)
public MetrologyDlgFlowMeterTab() : this(0) {}
public MetrologyDlgFlowMeterTab(int rangeIx1)
{
InitializeComponent();
this.rangeIx = rangeIx1;
toBeRemoved = new List<MeasurementCorrection>();
}
private void MetrologyDlgFlowMeterTab_Load(object sender, System.EventArgs e)
{
if (meterEntity == null) return;
parent = ParentForm as MetrologyDlg;
Localize();
/// Panel1
if (rangeIx == 0)
{
cmpntNameLabel.Text = meterEntity.Name;
}
else
{
cmpntNameLabel.Text = string.Format("{0} Range {1}", meterEntity.Name, rangeIx);
tempFromToLabel.Text = string.Format("{0} {1} {2} {3} °C", Strings.from, CalibInfoCfg.GetTempLo(rangeIx), Strings.to, CalibInfoCfg.GetTempHi(rangeIx));
pressFromToLabel.Text = string.Format("{0} {1} {2} {3} bar", Strings.from, CalibInfoCfg.GetPressLo(rangeIx), Strings.to, CalibInfoCfg.GetPressHi(rangeIx));
}
testGroupBox.Text = Strings.Test_measured_corrected;
measuredLabel.Text = Strings.Measured;
correctedLabel.Text = Strings.Corrected;
measuredTextBox.Text = string.Empty;
correctedTextBox.Text = string.Empty;
/// Panel2
this.Controls.Add(measurementTextBox = new TextBox());
this.Controls.Add(correctionTextBox = new TextBox());
this.Controls.Add(errorTextBox = new TextBox());
listViewEx.SubItemClicked += new SubItemEventHandler(listViewEx_SubItemClicked);
listViewEx.SubItemEndEditing += new 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} [l/h]", Strings.Correction), Width = 100 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [%]", Strings.Error), Width = 100 });
RefreshAll(rangeIx);
}
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(int rangeIx1)
{
if (CalibInfoCfg != null)
{
calibCertificateNrTextBox.Text = CalibInfoCfg.GetCalibCertificate(rangeIx1);
calibDateTextBox.Text = CalibInfoCfg.GetCalibDate(rangeIx1).ToShortDateString();
calibValidDateTextBox.Text = CalibInfoCfg.GetCalibValidDate(rangeIx1).ToShortDateString();
}
listViewEx.Items.Clear();
foreach (var corr in MeterEntity.Corrections)
{
if (corr.RangeIx == rangeIx) AddOneLVI(corr);
}
}
void AddOneLVI(MeasurementCorrection 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.Correction).ToString());
if (corr.Measurement == 0)
{
lvi.SubItems.Add(Strings.NaN);
}
else
{
double error = Config.Formulas.ErrorFromVolumes(corr.Measurement, corr.Measurement + corr.Correction);
lvi.SubItems.Add(error.ToString(Config.Utils.SignificantDigitsToFmt(error, 5)));
}
listViewEx.Items.Add(lvi);
}
void listViewEx_SubItemClicked(object sender, 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);
}
else if (unlocked && e.SubItem == 3)
{
listViewEx.StartEditing(correctionTextBox, 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)
{
double dblValue = 0;
if (subItem == 1 && Utils.TryParseEDouble(strValue, out dblValue) && dblValue >= 0)
{
(item.Tag as MeasurementCorrection).Measurement = (float)dblValue;
/// Update error (if possible)
double correction1000;
if (Utils.TryParseEDouble(item.SubItems[2].Text, out correction1000) && (dblValue != 0))
{
double correction = correction1000 / 1000;
double error = Config.Formulas.ErrorFromVolumes(dblValue, dblValue + correction);
item.SubItems[3].Text = error.ToString(Config.Utils.SignificantDigitsToFmt(error, 5));
}
else
{
item.SubItems[3].Text = Strings.NaN;
}
return true;
}
else if (subItem == 2 && Utils.TryParseEDouble(strValue, out dblValue))
{
double correctionInDefaultUnits = dblValue / 1000;
(item.Tag as MeasurementCorrection).Correction = (float)correctionInDefaultUnits;
/// Update error (if possible)
double measurement;
if (Utils.TryParseEDouble(item.SubItems[1].Text, out measurement) && (measurement != 0))
{
double error = Config.Formulas.ErrorFromVolumes(measurement, measurement + correctionInDefaultUnits);
item.SubItems[3].Text = error.ToString(Config.Utils.SignificantDigitsToFmt(error, 5));
}
else
{
item.SubItems[3].Text = Strings.NaN;
}
return true;
}
else if (subItem == 3 && ((strValue == Strings.NaN) || Utils.TryParseEDouble(strValue, out dblValue)))
{
if (strValue == Strings.NaN)
{
}
else
{
double measurement;
if (Utils.TryParseEDouble(item.SubItems[1].Text, out measurement) && measurement != 0)
{
double correction = Config.Formulas.CorrectionFromError(measurement, dblValue);
double correction1000 = 1000 * correction;
item.SubItems[2].Text = correction1000.ToString(Config.Utils.SignificantDigitsToFmt(correction1000, 5));
(item.Tag as MeasurementCorrection).Correction = (float)correction;
}
}
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.SetCalibCertificate(rangeIx, calibCertificateNrTextBox.Text);
CalibInfoCfg.SetCalibDate(rangeIx, DateTime.Parse(calibDateTextBox.Text));
CalibInfoCfg.SetCalibValidDate(rangeIx, 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(rangeIx);
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(rangeIx);
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)
{
}
}
}
@@ -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,291 @@
///
/// Copyright (c) 2018 Senus Slovensko a.s.
///
namespace TBF.UI.Bench.Metrology
{
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 global::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 global::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;
}
}
@@ -0,0 +1,344 @@
///
/// 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 Results.Forms;
using TBF.Resources;
using TBF.UI.Shared;
namespace TBF.UI.Bench.Metrology
{
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 SubItemEventHandler(listViewEx_SubItemClicked);
listViewEx.SubItemRightClicked += new SubItemEventHandler(listViewEx_SubItemRightClicked);
listViewEx.SubItemEndEditing += new 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, 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, 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, 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)
{
}
}
}
@@ -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,465 @@
///
/// Copyright (c) 2013-2015 Senus Slovensko a.s.
///
namespace TBF.UI.Bench.Metrology
{
partial class MetrologyDlgPlatinumResistanceTMeterTab
{
/// <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.cmpntNameLabel = new System.Windows.Forms.Label();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.radioButton2 = new System.Windows.Forms.RadioButton();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.testGroupBox = new System.Windows.Forms.GroupBox();
this.temperatureTextBox = new System.Windows.Forms.TextBox();
this.resistanceLabel = new System.Windows.Forms.Label();
this.temperatureLabel = new System.Windows.Forms.Label();
this.resistanceTextBox = new System.Windows.Forms.TextBox();
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.its90CalibrationCoefficientsGroupBox = new System.Windows.Forms.GroupBox();
this.c7TextBox = new System.Windows.Forms.TextBox();
this.c7Label = new System.Windows.Forms.Label();
this.b7TextBox = new System.Windows.Forms.TextBox();
this.a7TextBox = new System.Windows.Forms.TextBox();
this.r001cTextBox = new System.Windows.Forms.TextBox();
this.b7Label = new System.Windows.Forms.Label();
this.a7Label = new System.Windows.Forms.Label();
this.r0Label = new System.Windows.Forms.Label();
this.nameGroupBox = new System.Windows.Forms.GroupBox();
this.its27CalibrationCoefficientsGroupBox = new System.Windows.Forms.GroupBox();
this.bTextBox = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.aTextBox = new System.Windows.Forms.TextBox();
this.r0TextBox = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.testGroupBox.SuspendLayout();
this.calibrationGroupBox.SuspendLayout();
this.its90CalibrationCoefficientsGroupBox.SuspendLayout();
this.nameGroupBox.SuspendLayout();
this.its27CalibrationCoefficientsGroupBox.SuspendLayout();
this.SuspendLayout();
//
// cmpntNameLabel
//
this.cmpntNameLabel.AutoSize = true;
this.cmpntNameLabel.Location = new System.Drawing.Point(69, 16);
this.cmpntNameLabel.Name = "cmpntNameLabel";
this.cmpntNameLabel.Size = new System.Drawing.Size(64, 13);
this.cmpntNameLabel.TabIndex = 0;
this.cmpntNameLabel.Text = "cmpntName";
//
// 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.radioButton2);
this.splitContainer1.Panel1.Controls.Add(this.radioButton1);
this.splitContainer1.Panel1.Controls.Add(this.testGroupBox);
this.splitContainer1.Panel1.Controls.Add(this.calibrationGroupBox);
this.splitContainer1.Panel1.Controls.Add(this.its90CalibrationCoefficientsGroupBox);
this.splitContainer1.Panel1.Controls.Add(this.nameGroupBox);
this.splitContainer1.Panel1.Controls.Add(this.its27CalibrationCoefficientsGroupBox);
this.splitContainer1.Size = new System.Drawing.Size(668, 400);
this.splitContainer1.SplitterDistance = 300;
this.splitContainer1.TabIndex = 1;
//
// radioButton2
//
this.radioButton2.AutoSize = true;
this.radioButton2.Location = new System.Drawing.Point(462, 24);
this.radioButton2.Name = "radioButton2";
this.radioButton2.Size = new System.Drawing.Size(187, 17);
this.radioButton2.TabIndex = 11;
this.radioButton2.TabStop = true;
this.radioButton2.Text = "Use ITS-27 calibration coefficients";
this.radioButton2.UseVisualStyleBackColor = true;
//
// radioButton1
//
this.radioButton1.AutoSize = true;
this.radioButton1.Location = new System.Drawing.Point(235, 24);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(187, 17);
this.radioButton1.TabIndex = 10;
this.radioButton1.TabStop = true;
this.radioButton1.Text = "Use ITS-90 calibration coefficients";
this.radioButton1.UseVisualStyleBackColor = true;
//
// testGroupBox
//
this.testGroupBox.Controls.Add(this.temperatureTextBox);
this.testGroupBox.Controls.Add(this.resistanceLabel);
this.testGroupBox.Controls.Add(this.temperatureLabel);
this.testGroupBox.Controls.Add(this.resistanceTextBox);
this.testGroupBox.Location = new System.Drawing.Point(16, 155);
this.testGroupBox.Name = "testGroupBox";
this.testGroupBox.Size = new System.Drawing.Size(208, 77);
this.testGroupBox.TabIndex = 9;
this.testGroupBox.TabStop = false;
this.testGroupBox.Text = "Test";
//
// temperatureTextBox
//
this.temperatureTextBox.Location = new System.Drawing.Point(121, 46);
this.temperatureTextBox.Name = "temperatureTextBox";
this.temperatureTextBox.ReadOnly = true;
this.temperatureTextBox.Size = new System.Drawing.Size(79, 20);
this.temperatureTextBox.TabIndex = 5;
//
// resistanceLabel
//
this.resistanceLabel.AutoSize = true;
this.resistanceLabel.Location = new System.Drawing.Point(16, 23);
this.resistanceLabel.Name = "resistanceLabel";
this.resistanceLabel.Size = new System.Drawing.Size(78, 13);
this.resistanceLabel.TabIndex = 2;
this.resistanceLabel.Text = "Resistance [Ω]";
//
// temperatureLabel
//
this.temperatureLabel.AutoSize = true;
this.temperatureLabel.Location = new System.Drawing.Point(16, 49);
this.temperatureLabel.Name = "temperatureLabel";
this.temperatureLabel.Size = new System.Drawing.Size(87, 13);
this.temperatureLabel.TabIndex = 3;
this.temperatureLabel.Text = "Temperature [°C]";
//
// resistanceTextBox
//
this.resistanceTextBox.Location = new System.Drawing.Point(121, 20);
this.resistanceTextBox.Name = "resistanceTextBox";
this.resistanceTextBox.Size = new System.Drawing.Size(79, 20);
this.resistanceTextBox.TabIndex = 4;
this.resistanceTextBox.TextChanged += new System.EventHandler(this.measuredTextBox_TextChanged);
//
// 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(16, 54);
this.calibrationGroupBox.Name = "calibrationGroupBox";
this.calibrationGroupBox.Size = new System.Drawing.Size(208, 95);
this.calibrationGroupBox.TabIndex = 6;
this.calibrationGroupBox.TabStop = false;
this.calibrationGroupBox.Text = "Calibration";
//
// calibValidDateTextBox
//
this.calibValidDateTextBox.Enabled = false;
this.calibValidDateTextBox.Location = new System.Drawing.Point(105, 65);
this.calibValidDateTextBox.Name = "calibValidDateTextBox";
this.calibValidDateTextBox.Size = new System.Drawing.Size(95, 20);
this.calibValidDateTextBox.TabIndex = 15;
//
// calibValidDateLabel
//
this.calibValidDateLabel.AutoSize = true;
this.calibValidDateLabel.Location = new System.Drawing.Point(17, 68);
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(105, 40);
this.calibDateTextBox.Name = "calibDateTextBox";
this.calibDateTextBox.Size = new System.Drawing.Size(95, 20);
this.calibDateTextBox.TabIndex = 13;
//
// calibDateLabel
//
this.calibDateLabel.AutoSize = true;
this.calibDateLabel.Location = new System.Drawing.Point(17, 43);
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(105, 15);
this.calibCertificateNrTextBox.Name = "calibCertificateNrTextBox";
this.calibCertificateNrTextBox.Size = new System.Drawing.Size(95, 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(54, 13);
this.calibCertificateNrLabel.TabIndex = 10;
this.calibCertificateNrLabel.Text = "Certificate";
//
// its90CalibrationCoefficientsGroupBox
//
this.its90CalibrationCoefficientsGroupBox.Controls.Add(this.c7TextBox);
this.its90CalibrationCoefficientsGroupBox.Controls.Add(this.c7Label);
this.its90CalibrationCoefficientsGroupBox.Controls.Add(this.b7TextBox);
this.its90CalibrationCoefficientsGroupBox.Controls.Add(this.a7TextBox);
this.its90CalibrationCoefficientsGroupBox.Controls.Add(this.r001cTextBox);
this.its90CalibrationCoefficientsGroupBox.Controls.Add(this.b7Label);
this.its90CalibrationCoefficientsGroupBox.Controls.Add(this.a7Label);
this.its90CalibrationCoefficientsGroupBox.Controls.Add(this.r0Label);
this.its90CalibrationCoefficientsGroupBox.Location = new System.Drawing.Point(230, 54);
this.its90CalibrationCoefficientsGroupBox.Name = "its90CalibrationCoefficientsGroupBox";
this.its90CalibrationCoefficientsGroupBox.Size = new System.Drawing.Size(220, 140);
this.its90CalibrationCoefficientsGroupBox.TabIndex = 5;
this.its90CalibrationCoefficientsGroupBox.TabStop = false;
this.its90CalibrationCoefficientsGroupBox.Text = "ITS-90 calibration coefficients";
//
// c7TextBox
//
this.c7TextBox.Enabled = false;
this.c7TextBox.Location = new System.Drawing.Point(82, 104);
this.c7TextBox.Name = "c7TextBox";
this.c7TextBox.Size = new System.Drawing.Size(124, 20);
this.c7TextBox.TabIndex = 7;
//
// c7Label
//
this.c7Label.AutoSize = true;
this.c7Label.Location = new System.Drawing.Point(20, 107);
this.c7Label.Name = "c7Label";
this.c7Label.Size = new System.Drawing.Size(19, 13);
this.c7Label.TabIndex = 6;
this.c7Label.Text = "c7";
//
// b7TextBox
//
this.b7TextBox.Enabled = false;
this.b7TextBox.Location = new System.Drawing.Point(82, 79);
this.b7TextBox.Name = "b7TextBox";
this.b7TextBox.Size = new System.Drawing.Size(124, 20);
this.b7TextBox.TabIndex = 5;
//
// a7TextBox
//
this.a7TextBox.Enabled = false;
this.a7TextBox.Location = new System.Drawing.Point(82, 54);
this.a7TextBox.Name = "a7TextBox";
this.a7TextBox.Size = new System.Drawing.Size(124, 20);
this.a7TextBox.TabIndex = 4;
//
// r001cTextBox
//
this.r001cTextBox.Enabled = false;
this.r001cTextBox.Location = new System.Drawing.Point(82, 29);
this.r001cTextBox.Name = "r001cTextBox";
this.r001cTextBox.Size = new System.Drawing.Size(124, 20);
this.r001cTextBox.TabIndex = 3;
//
// b7Label
//
this.b7Label.AutoSize = true;
this.b7Label.Location = new System.Drawing.Point(20, 82);
this.b7Label.Name = "b7Label";
this.b7Label.Size = new System.Drawing.Size(19, 13);
this.b7Label.TabIndex = 2;
this.b7Label.Text = "b7";
//
// a7Label
//
this.a7Label.AutoSize = true;
this.a7Label.Location = new System.Drawing.Point(20, 57);
this.a7Label.Name = "a7Label";
this.a7Label.Size = new System.Drawing.Size(19, 13);
this.a7Label.TabIndex = 1;
this.a7Label.Text = "a7";
//
// r0Label
//
this.r0Label.AutoSize = true;
this.r0Label.Location = new System.Drawing.Point(20, 32);
this.r0Label.Name = "r0Label";
this.r0Label.Size = new System.Drawing.Size(53, 13);
this.r0Label.TabIndex = 0;
this.r0Label.Text = "R(0.01°C)";
//
// nameGroupBox
//
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(208, 40);
this.nameGroupBox.TabIndex = 4;
this.nameGroupBox.TabStop = false;
this.nameGroupBox.Text = "Component";
//
// its27CalibrationCoefficientsGroupBox
//
this.its27CalibrationCoefficientsGroupBox.Controls.Add(this.bTextBox);
this.its27CalibrationCoefficientsGroupBox.Controls.Add(this.label1);
this.its27CalibrationCoefficientsGroupBox.Controls.Add(this.aTextBox);
this.its27CalibrationCoefficientsGroupBox.Controls.Add(this.r0TextBox);
this.its27CalibrationCoefficientsGroupBox.Controls.Add(this.label2);
this.its27CalibrationCoefficientsGroupBox.Controls.Add(this.label3);
this.its27CalibrationCoefficientsGroupBox.Location = new System.Drawing.Point(459, 54);
this.its27CalibrationCoefficientsGroupBox.Name = "its27CalibrationCoefficientsGroupBox";
this.its27CalibrationCoefficientsGroupBox.Size = new System.Drawing.Size(190, 140);
this.its27CalibrationCoefficientsGroupBox.TabIndex = 3;
this.its27CalibrationCoefficientsGroupBox.TabStop = false;
this.its27CalibrationCoefficientsGroupBox.Text = "ITS-27 calibration coefficients";
//
// bTextBox
//
this.bTextBox.Enabled = false;
this.bTextBox.Location = new System.Drawing.Point(52, 79);
this.bTextBox.Name = "bTextBox";
this.bTextBox.Size = new System.Drawing.Size(124, 20);
this.bTextBox.TabIndex = 13;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(22, 82);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(14, 13);
this.label1.TabIndex = 12;
this.label1.Text = "B";
//
// aTextBox
//
this.aTextBox.Enabled = false;
this.aTextBox.Location = new System.Drawing.Point(52, 54);
this.aTextBox.Name = "aTextBox";
this.aTextBox.Size = new System.Drawing.Size(124, 20);
this.aTextBox.TabIndex = 11;
//
// r0TextBox
//
this.r0TextBox.Enabled = false;
this.r0TextBox.Location = new System.Drawing.Point(52, 29);
this.r0TextBox.Name = "r0TextBox";
this.r0TextBox.Size = new System.Drawing.Size(124, 20);
this.r0TextBox.TabIndex = 10;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(22, 57);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(14, 13);
this.label2.TabIndex = 9;
this.label2.Text = "A";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(22, 32);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(21, 13);
this.label3.TabIndex = 8;
this.label3.Text = "R0";
//
// MetrologyDlgPlatinumResistanceTMeterTab
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.splitContainer1);
this.Name = "MetrologyDlgPlatinumResistanceTMeterTab";
this.Size = new System.Drawing.Size(668, 400);
this.Load += new System.EventHandler(this.MetrologyDlgBalanceTab_Load);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.testGroupBox.ResumeLayout(false);
this.testGroupBox.PerformLayout();
this.calibrationGroupBox.ResumeLayout(false);
this.calibrationGroupBox.PerformLayout();
this.its90CalibrationCoefficientsGroupBox.ResumeLayout(false);
this.its90CalibrationCoefficientsGroupBox.PerformLayout();
this.nameGroupBox.ResumeLayout(false);
this.nameGroupBox.PerformLayout();
this.its27CalibrationCoefficientsGroupBox.ResumeLayout(false);
this.its27CalibrationCoefficientsGroupBox.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Label cmpntNameLabel;
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.Label resistanceLabel;
private System.Windows.Forms.GroupBox its27CalibrationCoefficientsGroupBox;
private System.Windows.Forms.TextBox temperatureTextBox;
private System.Windows.Forms.TextBox resistanceTextBox;
private System.Windows.Forms.Label temperatureLabel;
private System.Windows.Forms.GroupBox its90CalibrationCoefficientsGroupBox;
private System.Windows.Forms.GroupBox nameGroupBox;
private System.Windows.Forms.TextBox b7TextBox;
private System.Windows.Forms.TextBox a7TextBox;
private System.Windows.Forms.TextBox r001cTextBox;
private System.Windows.Forms.Label b7Label;
private System.Windows.Forms.Label a7Label;
private System.Windows.Forms.Label r0Label;
private System.Windows.Forms.TextBox c7TextBox;
private System.Windows.Forms.Label c7Label;
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.GroupBox testGroupBox;
private System.Windows.Forms.TextBox bTextBox;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox aTextBox;
private System.Windows.Forms.TextBox r0TextBox;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.RadioButton radioButton2;
private System.Windows.Forms.RadioButton radioButton1;
}
}
@@ -0,0 +1,231 @@
///
/// Copyright (c) 2016 Senus 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.UI.Bench.Metrology
{
public partial class MetrologyDlgPlatinumResistanceTMeterTab : UserControl, IMetrologyDlgTab
{
static readonly ILog log = LogManager.GetLogger(typeof(MetrologyDlgPlatinumResistanceTMeterTab));
/// <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.Keithley.TempMeter.TempMeterCfg TempMeterCfg;
/// <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 MetrologyDlgPlatinumResistanceTMeterTab()
{
InitializeComponent();
toBeRemoved = new List<MeasurementCorrection>();
unlocked = false;
}
private void MetrologyDlgBalanceTab_Load(object sender, System.EventArgs e)
{
if (meterEntity == null) return;
parent = ParentForm as MetrologyDlg;
Localize();
/// Panel1
cmpntNameLabel.Text = TempMeterCfg.Name;
resistanceTextBox.Text = string.Empty;
temperatureTextBox.Text = string.Empty;
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;
resistanceLabel.Text = string.Format("{0} [Ω]", Strings.Resistance);
temperatureLabel.Text = string.Format("{0} [°C]", Strings.Temperature);
radioButton1.Text = string.Format(Strings.Use_0, Strings.ITS90_calibration_coefficients);
radioButton2.Text = string.Format(Strings.Use_0, Strings.ITS27_calibration_coefficients);
its90CalibrationCoefficientsGroupBox.Text = Strings.ITS90_calibration_coefficients;
its27CalibrationCoefficientsGroupBox.Text = Strings.ITS27_calibration_coefficients;
}
void RefreshAll()
{
if (TempMeterCfg != null)
{
calibCertificateNrTextBox.Text = TempMeterCfg.CalibCertificateNr;
calibDateTextBox.Text = TempMeterCfg.CalibDate.ToShortDateString();
calibValidDateTextBox.Text = TempMeterCfg.CalibValidDate.ToShortDateString();
radioButton1.Checked = TempMeterCfg.UseITS90;
radioButton2.Checked = !TempMeterCfg.UseITS90;
r001cTextBox.Text = TempMeterCfg.R001C.ToString();
a7TextBox.Text = TempMeterCfg.a7.ToString();
b7TextBox.Text = TempMeterCfg.b7.ToString();
c7TextBox.Text = TempMeterCfg.c7.ToString();
r0TextBox.Text = TempMeterCfg.R0.ToString();
aTextBox.Text = TempMeterCfg.A.ToString();
bTextBox.Text = TempMeterCfg.B.ToString();
}
}
public void Unlock()
{
unlocked = true;
calibCertificateNrTextBox.Enabled = true;
calibDateTextBox.Enabled = true;
calibValidDateTextBox.Enabled = true;
radioButton1.Enabled = true;
radioButton2.Enabled = true;
r001cTextBox.Enabled = true;
a7TextBox.Enabled = true;
b7TextBox.Enabled = true;
c7TextBox.Enabled = true;
r0TextBox.Enabled = true;
aTextBox.Enabled = true;
bTextBox.Enabled = true;
}
public void OkBtnClicked()
{
if (TempMeterCfg != null)
{
try
{
TempMeterCfg.CalibCertificateNr = calibCertificateNrTextBox.Text;
TempMeterCfg.CalibDate = DateTime.Parse(calibDateTextBox.Text);
TempMeterCfg.CalibValidDate = DateTime.Parse(calibValidDateTextBox.Text);
TempMeterCfg.UseITS90 = radioButton1.Checked;
TempMeterCfg.R001C = Utils.ParseUDouble(r001cTextBox.Text);
TempMeterCfg.a7 = Utils.ParseEDouble(a7TextBox.Text);
TempMeterCfg.b7 = Utils.ParseEDouble(b7TextBox.Text);
TempMeterCfg.c7 = Utils.ParseEDouble(c7TextBox.Text);
TempMeterCfg.R0 = Utils.ParseUDouble(r0TextBox.Text);
TempMeterCfg.A = Utils.ParseEDouble(aTextBox.Text);
TempMeterCfg.B = Utils.ParseEDouble(bTextBox.Text);
Component modified = TempMeterCfg.CreateDbEntity();
MeterEntity.Parameters = modified.Parameters;
}
catch
{
MessageBox.Show(string.Format(Strings.Invalid_0, Strings.Calibration_coefficients),
Strings.Error,
MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
}
}
}
private void measuredTextBox_TextChanged(object sender, EventArgs e)
{
double resistance;
if (Utils.TryParseUDouble(resistanceTextBox.Text, out resistance))
{
try
{
double temperature;
if (radioButton1.Checked)
{
double R001C = Utils.ParseUDouble(r001cTextBox.Text);
double a7 = Utils.ParseEDouble(a7TextBox.Text);
double b7 = Utils.ParseEDouble(b7TextBox.Text);
double c7 = Utils.ParseEDouble(c7TextBox.Text);
temperature = Config.Formulas.PlatinumResistanceTM_ITS90_R2T(resistance, R001C, a7, b7, c7);
}
else
{
double R0 = Utils.ParseUDouble(r0TextBox.Text);
double a = Utils.ParseEDouble(aTextBox.Text);
double b = Utils.ParseEDouble(bTextBox.Text);
temperature = Config.Formulas.PlatinumResistanceTM_ITS27_R2T(resistance, R0, a, b);
}
temperatureTextBox.Text = temperature.ToString();
}
catch
{
MessageBox.Show(string.Format(Strings.Invalid_0, Strings.Calibration_coefficients),
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,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,183 @@
///
/// Copyright (c) 2013-2015 Senus Slovensko a.s.
///
namespace TBF.UI.Bench.Metrology
{
partial class MetrologyDlgPressMeterTab
{
/// <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.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.componentLabel = 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.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.testGroupBox);
this.splitContainer1.Panel1.Controls.Add(this.componentLabel);
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 = 80;
this.splitContainer1.TabIndex = 2;
//
// 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(245, 7);
this.testGroupBox.Name = "testGroupBox";
this.testGroupBox.Size = new System.Drawing.Size(157, 64);
this.testGroupBox.TabIndex = 4;
this.testGroupBox.TabStop = false;
this.testGroupBox.Text = "Test";
//
// correctedTextBox
//
this.correctedTextBox.Location = new System.Drawing.Point(74, 38);
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(74, 13);
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(7, 41);
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(6, 20);
this.measuredLabel.Name = "measuredLabel";
this.measuredLabel.Size = new System.Drawing.Size(54, 13);
this.measuredLabel.TabIndex = 2;
this.measuredLabel.Text = "Measured";
//
// componentLabel
//
this.componentLabel.AutoSize = true;
this.componentLabel.Location = new System.Drawing.Point(14, 12);
this.componentLabel.Name = "componentLabel";
this.componentLabel.Size = new System.Drawing.Size(64, 13);
this.componentLabel.TabIndex = 1;
this.componentLabel.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, 216);
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);
//
// MetrologyDlgPressMeterTab
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.splitContainer1);
this.Name = "MetrologyDlgPressMeterTab";
this.Size = new System.Drawing.Size(420, 300);
this.Load += new System.EventHandler(this.MetrologyDlgPressMeterTab_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.testGroupBox.ResumeLayout(false);
this.testGroupBox.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.Label componentLabel;
private System.Windows.Forms.Label cmpntNameLabel;
private global::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;
}
}
@@ -0,0 +1,326 @@
///
/// Copyright (c) 2013-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.Metrology
{
public partial class MetrologyDlgPressMeterTab : UserControl, IMetrologyDlgTab
{
static readonly ILog log = LogManager.GetLogger(typeof(MetrologyDlgPressMeterTab));
/// <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<MeasurementCorrection> ToBeRemoved
{
get { return toBeRemoved; }
set { toBeRemoved = value; }
}
IList<MeasurementCorrection> toBeRemoved;
MetrologyDlg parent;
bool unlocked;
Control measurementTextBox;
Control correctionTextBox;
Control errorTextBox;
public MetrologyDlgPressMeterTab()
{
InitializeComponent();
toBeRemoved = new List<MeasurementCorrection>();
}
private void MetrologyDlgPressMeterTab_Load(object sender, System.EventArgs e)
{
if (meterEntity == null) return;
parent = ParentForm as MetrologyDlg;
/// Panel1
cmpntNameLabel.Text = meterEntity.Name;
componentLabel.Text = Strings.Component;
testGroupBox.Text = Strings.Test_measured_corrected;
measuredLabel.Text = Strings.Measured;
correctedLabel.Text = Strings.Corrected;
measuredTextBox.Text = string.Empty;
correctedTextBox.Text = string.Empty;
/// Panel2
this.Controls.Add(measurementTextBox = new TextBox());
this.Controls.Add(correctionTextBox = new TextBox());
this.Controls.Add(errorTextBox = new TextBox());
listViewEx.SubItemClicked += new SubItemEventHandler(listViewEx_SubItemClicked);
listViewEx.SubItemEndEditing += new SubItemEndEditingEventHandler(listViewEx_SubItemEndEditing);
listViewEx.Columns.Add(new ColumnHeader() { Text = Strings.Nr, Width = 60 });
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.Correction), Width = 100 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [%]", Strings.Error), Width = 100 });
RefreshAll();
}
void RefreshAll()
{
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.Tag = corr;
lvi.SubItems.Add(corr.Measurement.ToString());
lvi.SubItems.Add((1000 * corr.Correction).ToString());
if (corr.Measurement == 0)
{
lvi.SubItems.Add(Strings.NaN);
}
else
{
double error = Config.Formulas.ErrorFromVolumes(corr.Measurement, corr.Measurement + corr.Correction);
lvi.SubItems.Add(error.ToString(Config.Utils.SignificantDigitsToFmt(error, 5)));
}
listViewEx.Items.Add(lvi);
}
void listViewEx_SubItemClicked(object sender, 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);
}
else if (unlocked && e.SubItem == 3)
{
listViewEx.StartEditing(correctionTextBox, 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)
{
double dblValue = 0;
if (subItem == 1 && Utils.TryParseEDouble(strValue, out dblValue) && dblValue >= 0)
{
(item.Tag as MeasurementCorrection).Measurement = (float)dblValue;
/// Update error (if possible)
double correction1000;
if (Utils.TryParseEDouble(item.SubItems[2].Text, out correction1000) && (dblValue != 0))
{
double correction = correction1000 / 1000;
double error = Config.Formulas.ErrorFromVolumes(dblValue, dblValue + correction);
item.SubItems[3].Text = error.ToString(Config.Utils.SignificantDigitsToFmt(error, 5));
}
else
{
item.SubItems[3].Text = Strings.NaN;
}
return true;
}
else if (subItem == 2 && Utils.TryParseEDouble(strValue, out dblValue))
{
double correctionInDefaultUnits = dblValue / 1000;
(item.Tag as MeasurementCorrection).Correction = (float)correctionInDefaultUnits;
/// Update error (if possible)
double measurement;
if (Utils.TryParseEDouble(item.SubItems[1].Text, out measurement) && (measurement != 0))
{
double error = Config.Formulas.ErrorFromVolumes(measurement, measurement + correctionInDefaultUnits);
item.SubItems[3].Text = error.ToString(Config.Utils.SignificantDigitsToFmt(error, 5));
}
else
{
item.SubItems[3].Text = Strings.NaN;
}
return true;
}
else if (subItem == 3 && ((strValue == Strings.NaN) || Utils.TryParseEDouble(strValue, out dblValue)))
{
if (strValue == Strings.NaN)
{
}
else
{
double measurement;
if (Utils.TryParseEDouble(item.SubItems[1].Text, out measurement) && measurement != 0)
{
double correction = Config.Formulas.CorrectionFromError(measurement, dblValue);
double correction1000 = 1000 * correction;
item.SubItems[2].Text = correction1000.ToString(Config.Utils.SignificantDigitsToFmt(correction1000, 5));
(item.Tag as MeasurementCorrection).Correction = (float)correction;
}
}
return true;
}
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()
{
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)
{
}
}
}
@@ -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,183 @@
///
/// Copyright (c) 2017 Senus Slovensko a.s.
///
namespace TBF.UI.Bench.Metrology
{
partial class MetrologyDlgTempMeterTab
{
/// <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.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.componentLabel = 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.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.testGroupBox);
this.splitContainer1.Panel1.Controls.Add(this.componentLabel);
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 = 80;
this.splitContainer1.TabIndex = 2;
//
// 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(245, 7);
this.testGroupBox.Name = "testGroupBox";
this.testGroupBox.Size = new System.Drawing.Size(157, 64);
this.testGroupBox.TabIndex = 4;
this.testGroupBox.TabStop = false;
this.testGroupBox.Text = "Test";
//
// correctedTextBox
//
this.correctedTextBox.Location = new System.Drawing.Point(74, 38);
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(74, 13);
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(7, 41);
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(6, 20);
this.measuredLabel.Name = "measuredLabel";
this.measuredLabel.Size = new System.Drawing.Size(54, 13);
this.measuredLabel.TabIndex = 2;
this.measuredLabel.Text = "Measured";
//
// componentLabel
//
this.componentLabel.AutoSize = true;
this.componentLabel.Location = new System.Drawing.Point(14, 12);
this.componentLabel.Name = "componentLabel";
this.componentLabel.Size = new System.Drawing.Size(64, 13);
this.componentLabel.TabIndex = 1;
this.componentLabel.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, 216);
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);
//
// MetrologyDlgTempMeterTab
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.splitContainer1);
this.Name = "MetrologyDlgTempMeterTab";
this.Size = new System.Drawing.Size(420, 300);
this.Load += new System.EventHandler(this.MetrologyDlgTempMeterTab_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.testGroupBox.ResumeLayout(false);
this.testGroupBox.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.Label componentLabel;
private System.Windows.Forms.Label cmpntNameLabel;
private global::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;
}
}
@@ -0,0 +1,326 @@
///
/// Copyright (c) 2017-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.Metrology
{
public partial class MetrologyDlgTempMeterTab : UserControl, IMetrologyDlgTab
{
static readonly ILog log = LogManager.GetLogger(typeof(MetrologyDlgTempMeterTab));
/// <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<MeasurementCorrection> ToBeRemoved
{
get { return toBeRemoved; }
set { toBeRemoved = value; }
}
IList<MeasurementCorrection> toBeRemoved;
MetrologyDlg parent;
bool unlocked;
Control measurementTextBox;
Control correctionTextBox;
Control errorTextBox;
public MetrologyDlgTempMeterTab()
{
InitializeComponent();
toBeRemoved = new List<MeasurementCorrection>();
}
private void MetrologyDlgTempMeterTab_Load(object sender, System.EventArgs e)
{
if (meterEntity == null) return;
parent = ParentForm as MetrologyDlg;
/// Panel1
cmpntNameLabel.Text = meterEntity.Name;
componentLabel.Text = Strings.Component;
testGroupBox.Text = Strings.Test_measured_corrected;
measuredLabel.Text = Strings.Measured;
correctedLabel.Text = Strings.Corrected;
measuredTextBox.Text = string.Empty;
correctedTextBox.Text = string.Empty;
/// Panel2
this.Controls.Add(measurementTextBox = new TextBox());
this.Controls.Add(correctionTextBox = new TextBox());
this.Controls.Add(errorTextBox = new TextBox());
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 = 120 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [1/1000 °C]", Strings.Correction), Width = 150 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [%]", Strings.Error), Width = 100 });
RefreshAll();
}
void RefreshAll()
{
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.Tag = corr;
lvi.SubItems.Add(corr.Measurement.ToString());
lvi.SubItems.Add((1000 * corr.Correction).ToString());
if (corr.Measurement == 0)
{
lvi.SubItems.Add(Strings.NaN);
}
else
{
double error = Config.Formulas.ErrorFromVolumes(corr.Measurement, corr.Measurement + corr.Correction);
lvi.SubItems.Add(error.ToString(Config.Utils.SignificantDigitsToFmt(error, 5)));
}
listViewEx.Items.Add(lvi);
}
void listViewEx_SubItemClicked(object sender, 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);
}
else if (unlocked && e.SubItem == 3)
{
listViewEx.StartEditing(correctionTextBox, 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)
{
double dblValue = 0;
if (subItem == 1 && Utils.TryParseEDouble(strValue, out dblValue) && dblValue >= 0)
{
(item.Tag as MeasurementCorrection).Measurement = (float)dblValue;
/// Update error (if possible)
double correction1000;
if (Utils.TryParseEDouble(item.SubItems[2].Text, out correction1000) && (dblValue != 0))
{
double correction = correction1000 / 1000;
double error = Config.Formulas.ErrorFromVolumes(dblValue, dblValue + correction);
item.SubItems[3].Text = error.ToString(Config.Utils.SignificantDigitsToFmt(error, 5));
}
else
{
item.SubItems[3].Text = Strings.NaN;
}
return true;
}
else if (subItem == 2 && Utils.TryParseEDouble(strValue, out dblValue))
{
double correctionInDefaultUnits = dblValue / 1000;
(item.Tag as MeasurementCorrection).Correction = (float)correctionInDefaultUnits;
/// Update error (if possible)
double measurement;
if (Utils.TryParseEDouble(item.SubItems[1].Text, out measurement) && (measurement != 0))
{
double error = Config.Formulas.ErrorFromVolumes(measurement, measurement + correctionInDefaultUnits);
item.SubItems[3].Text = error.ToString(Config.Utils.SignificantDigitsToFmt(error, 5));
}
else
{
item.SubItems[3].Text = Strings.NaN;
}
return true;
}
else if (subItem == 3 && ((strValue == Strings.NaN) || Utils.TryParseEDouble(strValue, out dblValue)))
{
if (strValue == Strings.NaN)
{
}
else
{
double measurement;
if (Utils.TryParseEDouble(item.SubItems[1].Text, out measurement) && measurement != 0)
{
double correction = Config.Formulas.CorrectionFromError(measurement, dblValue);
double correction1000 = 1000 * correction;
item.SubItems[2].Text = correction1000.ToString(Config.Utils.SignificantDigitsToFmt(correction1000, 5));
(item.Tag as MeasurementCorrection).Correction = (float)correction;
}
}
return true;
}
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()
{
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)
{
}
}
}
@@ -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>