Uncertainty under construction, Results DB TestRslt table modified
This commit is contained in:
@@ -77,20 +77,6 @@ namespace TBF.UI.Bench.Uncertainties
|
||||
uncertaintiesTabControl.TabPages.Add(tabPage);
|
||||
}
|
||||
|
||||
/// Tab-page buoyancy
|
||||
if (factory is BenchControl.DataContainers.Buoyancy.ComponentFactory)
|
||||
{
|
||||
fixedCount++;
|
||||
TabPage tabPage = new TabPage(" Buoyancy ");
|
||||
UncertntDlgBuoyancyTab uiControl = new UncertntDlgBuoyancyTab();
|
||||
uiControl.MeterEntity = cmpnt;
|
||||
uiControl.BuoyancyCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.DataContainers.Buoyancy.ComponentCfg;
|
||||
uiControl.Dock = DockStyle.Fill;
|
||||
tabPage.Tag = uiControl;
|
||||
tabPage.Controls.Add(uiControl);
|
||||
uncertaintiesTabControl.TabPages.Add(tabPage);
|
||||
}
|
||||
|
||||
/// Tab-pages for scales
|
||||
if (factory is BenchControl.MettlerToledo.Standard.BalanceFactory ||
|
||||
factory is BenchControl.MettlerToledo.Standard.BalanceOldFactory ||
|
||||
|
||||
@@ -1,132 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Senus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.UI.Bench.Uncertainties
|
||||
{
|
||||
public partial class UncertntDlgBuoyancyTab : UserControl, IUncetaintiesDlgTab
|
||||
{
|
||||
static readonly ILog log = LogManager.GetLogger(typeof(UncertntDlgBuoyancyTab));
|
||||
|
||||
/// <summary>
|
||||
/// Component entity that has a list of 'measurement-correction' pairs
|
||||
/// to be updated in the database on OK.
|
||||
/// </summary>
|
||||
public Component MeterEntity
|
||||
{
|
||||
get { return meterEntity; }
|
||||
set { meterEntity = value; }
|
||||
}
|
||||
Component meterEntity;
|
||||
|
||||
/// <summary>
|
||||
/// Buoyancy configuration
|
||||
/// </summary>
|
||||
public BenchControl.DataContainers.Buoyancy.ComponentCfg BuoyancyCfg;
|
||||
|
||||
/// <summary>
|
||||
/// A list of 'measurement-correction' pairs to be deleted from the database on OK.
|
||||
/// </summary>
|
||||
public IList<Uncertainty> ToBeRemoved
|
||||
{
|
||||
get { return toBeRemoved; }
|
||||
set { toBeRemoved = value; }
|
||||
}
|
||||
IList<Uncertainty> toBeRemoved;
|
||||
|
||||
UncertaintiesDlg parent;
|
||||
bool unlocked;
|
||||
|
||||
public UncertntDlgBuoyancyTab()
|
||||
{
|
||||
InitializeComponent();
|
||||
toBeRemoved = new List<Uncertainty>();
|
||||
unlocked = false;
|
||||
}
|
||||
|
||||
private void MetrologyDlgBuoyancyTab_Load(object sender, System.EventArgs e)
|
||||
{
|
||||
if (meterEntity == null) return;
|
||||
|
||||
parent = ParentForm as UncertaintiesDlg;
|
||||
|
||||
/// Panel1
|
||||
buoyancyLabel.Text = "Buoyancy";
|
||||
|
||||
/// Panel2
|
||||
|
||||
RefreshAll();
|
||||
}
|
||||
|
||||
void RefreshAll()
|
||||
{
|
||||
buoyancyTextBox.Text = Config.Data.Buoyancy.ToString("F5");
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
unlocked = true;
|
||||
|
||||
buoyancyTextBox.Enabled = true;
|
||||
}
|
||||
|
||||
public void OkBtnClicked()
|
||||
{
|
||||
if (BuoyancyCfg != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
double buoyancy = Utils.ParseUDouble(buoyancyTextBox.Text);
|
||||
|
||||
global::Results.WMeterRsltItemSpec.Buoyancy =
|
||||
Config.Data.Buoyancy = BuoyancyCfg.Buoyancy = buoyancy;
|
||||
|
||||
Component modified = BuoyancyCfg.CreateDbEntity();
|
||||
MeterEntity.Parameters = modified.Parameters;
|
||||
}
|
||||
catch
|
||||
{
|
||||
MessageBox.Show(Strings.Invalid_buoyancy_parameter_Correct_pls,
|
||||
Strings.Error,
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Exclamation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void CancelBtnClicked()
|
||||
{
|
||||
}
|
||||
|
||||
public void AddOne()
|
||||
{
|
||||
}
|
||||
|
||||
public void RemoveSelected()
|
||||
{
|
||||
}
|
||||
|
||||
public void MoveUpSelected()
|
||||
{
|
||||
}
|
||||
|
||||
public void MoveDownSelected()
|
||||
{
|
||||
}
|
||||
|
||||
public string GetWarningsBeforeSaving(ref Dictionary<string, string> renmInfo)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Senus Slovensko a.s.
|
||||
///
|
||||
namespace TBF.UI.Bench.Uncertainties
|
||||
{
|
||||
partial class UncertntDlgBuoyancyTab
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.buoyancyTextBox = new System.Windows.Forms.TextBox();
|
||||
this.buoyancyLabel = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// splitContainer1
|
||||
//
|
||||
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
|
||||
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
|
||||
this.splitContainer1.Name = "splitContainer1";
|
||||
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
//
|
||||
// splitContainer1.Panel1
|
||||
//
|
||||
this.splitContainer1.Panel1.Controls.Add(this.buoyancyTextBox);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.buoyancyLabel);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(420, 300);
|
||||
this.splitContainer1.SplitterDistance = 120;
|
||||
this.splitContainer1.TabIndex = 1;
|
||||
//
|
||||
// buoyancyTextBox
|
||||
//
|
||||
this.buoyancyTextBox.Enabled = false;
|
||||
this.buoyancyTextBox.Location = new System.Drawing.Point(189, 51);
|
||||
this.buoyancyTextBox.Name = "buoyancyTextBox";
|
||||
this.buoyancyTextBox.Size = new System.Drawing.Size(110, 20);
|
||||
this.buoyancyTextBox.TabIndex = 1;
|
||||
//
|
||||
// buoyancyLabel
|
||||
//
|
||||
this.buoyancyLabel.AutoSize = true;
|
||||
this.buoyancyLabel.Location = new System.Drawing.Point(41, 54);
|
||||
this.buoyancyLabel.Name = "buoyancyLabel";
|
||||
this.buoyancyLabel.Size = new System.Drawing.Size(54, 13);
|
||||
this.buoyancyLabel.TabIndex = 0;
|
||||
this.buoyancyLabel.Text = "Buoyancy";
|
||||
//
|
||||
// MetrologyDlgBuoyancyTab
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.splitContainer1);
|
||||
this.Name = "MetrologyDlgBuoyancyTab";
|
||||
this.Size = new System.Drawing.Size(420, 300);
|
||||
this.Load += new System.EventHandler(this.MetrologyDlgBuoyancyTab_Load);
|
||||
this.splitContainer1.Panel1.ResumeLayout(false);
|
||||
this.splitContainer1.Panel1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
|
||||
this.splitContainer1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.SplitContainer splitContainer1;
|
||||
private System.Windows.Forms.TextBox buoyancyTextBox;
|
||||
private System.Windows.Forms.Label buoyancyLabel;
|
||||
}
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,16 +1,19 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Senus Slovensko a.s.
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
using Results.Forms;
|
||||
using TBF.Resources;
|
||||
using TBF.UI.Shared;
|
||||
|
||||
namespace TBF.UI.Bench.Uncertainties
|
||||
{
|
||||
public partial class UncertntDlgDensityTab : UserControl, IUncetaintiesDlgTab
|
||||
public partial class UncertntDlgDensityTab : UserControl, IUncetaintiesDlgTab
|
||||
{
|
||||
static readonly ILog log = LogManager.GetLogger(typeof(UncertntDlgDensityTab));
|
||||
|
||||
@@ -18,95 +21,164 @@ namespace TBF.UI.Bench.Uncertainties
|
||||
/// 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; }
|
||||
}
|
||||
Component meterEntity;
|
||||
get { return meterEntity; }
|
||||
set { meterEntity = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Density configuration
|
||||
/// Balance configuration (with buoyancy parameters)
|
||||
/// </summary>
|
||||
public BenchControl.DataContainers.Density.ComponentCfg DensityCfg;
|
||||
|
||||
/// <summary>
|
||||
/// A list of 'measurement-correction' pairs to be deleted from the database on OK.
|
||||
/// </summary>
|
||||
public IList<Uncertainty> ToBeRemoved
|
||||
public IList<Uncertainty> ToBeRemoved
|
||||
{
|
||||
get { return toBeRemoved; }
|
||||
set { toBeRemoved = value; }
|
||||
}
|
||||
IList<Uncertainty> toBeRemoved;
|
||||
IList<Uncertainty> toBeRemoved;
|
||||
|
||||
UncertaintiesDlg parent;
|
||||
UncertaintiesDlg parent;
|
||||
bool unlocked;
|
||||
Control[] textBoxes;
|
||||
|
||||
public UncertntDlgDensityTab()
|
||||
{
|
||||
InitializeComponent();
|
||||
toBeRemoved = new List<Uncertainty>();
|
||||
unlocked = false;
|
||||
toBeRemoved = new List<Uncertainty>();
|
||||
}
|
||||
|
||||
private void MetrologyDlgDensityTab_Load(object sender, System.EventArgs e)
|
||||
private void UncertntDlgTempMeterTab_Load(object sender, System.EventArgs e)
|
||||
{
|
||||
if (meterEntity == null) return;
|
||||
if (meterEntity == null) return;
|
||||
|
||||
parent = ParentForm as UncertaintiesDlg;
|
||||
|
||||
/// Panel1
|
||||
densityLabel.Text = string.Format("{0} [{1}]", Strings.Density, Config.Unit.kgpm3.ToDescription());
|
||||
temperatureLabel.Text = string.Format("{0} [{1}]", Strings.At_temperature, Config.Unit.C.ToDescription());
|
||||
densityCorrLabel.Text = string.Format("{0} [{1}]", Strings.Density_correction, Config.Unit.kgpm3.ToDescription());
|
||||
cmpntLabel.Text = Strings.Component;
|
||||
cmpntNameLabel.Text = meterEntity.Name;
|
||||
|
||||
/// Panel2
|
||||
listViewEx.SubItemClicked += new SubItemEventHandler(listViewEx_SubItemClicked);
|
||||
listViewEx.SubItemEndEditing += new SubItemEndEditingEventHandler(listViewEx_SubItemEndEditing);
|
||||
|
||||
listViewEx.Columns.Add(new ColumnHeader() { Text = Strings.Nr, Width = 40 });
|
||||
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [°C]", Strings.Temperature), Width = 100 });
|
||||
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [g/m3]", Strings.Main_uncertainty), Width = 120 });
|
||||
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [g/m3]", Strings.Resolution), Width = 100 });
|
||||
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [g/m3/year]", Strings.Drift_per_year), Width = 120 });
|
||||
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [g/m3]", Strings.Conditions), Width = 100 });
|
||||
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [g/m3]", Strings.Uncertainty_of_correction), Width = 160 });
|
||||
|
||||
textBoxes = new TextBox[listViewEx.Columns.Count];
|
||||
for (int i = 1; i < textBoxes.Length; i++)
|
||||
{
|
||||
this.Controls.Add(textBoxes[i] = new TextBox());
|
||||
}
|
||||
|
||||
RefreshAll();
|
||||
}
|
||||
|
||||
void RefreshAll()
|
||||
{
|
||||
densityTextBox.Text = Config.Data.RealDensity.ToString("F4");
|
||||
temperatureTextBox.Text = Config.Data.AtTemperature.ToString("F2");
|
||||
densityCorrTextBox.Text = Config.Formulas.DensityCorrection(Config.Data.RealDensity, Config.Data.AtTemperature).ToString("F5");
|
||||
listViewEx.Items.Clear();
|
||||
foreach (var uncrtnty in MeterEntity.Uncertainties) AddOneLVI(uncrtnty);
|
||||
}
|
||||
|
||||
void AddOneLVI(Uncertainty corr)
|
||||
{
|
||||
int nr = listViewEx.Items.Count + 1;
|
||||
ListViewItem lvi = new ListViewItem(nr.ToString());
|
||||
lvi.Tag = corr;
|
||||
lvi.SubItems.Add(corr.Measurement.ToString());
|
||||
lvi.SubItems.Add((1000 * corr.MainUncertainty).ToString());
|
||||
lvi.SubItems.Add((1000 * corr.Resolution).ToString());
|
||||
lvi.SubItems.Add((1000 * corr.DriftPerYr).ToString());
|
||||
lvi.SubItems.Add((1000 * corr.Conditions).ToString());
|
||||
lvi.SubItems.Add((1000 * corr.UncertaintyOfCorrection).ToString());
|
||||
|
||||
listViewEx.Items.Add(lvi);
|
||||
}
|
||||
|
||||
void listViewEx_SubItemClicked(object sender, SubItemEventArgs e)
|
||||
{
|
||||
if (unlocked && (e.SubItem >= 1) && (e.SubItem < listViewEx.Columns.Count))
|
||||
{
|
||||
/// This is not the first column
|
||||
listViewEx.StartEditing(textBoxes[e.SubItem], e.Item, e.SubItem);
|
||||
}
|
||||
}
|
||||
|
||||
void listViewEx_SubItemEndEditing(object sender, SubItemEndEditingEventArgs e)
|
||||
{
|
||||
if (ParseItem(e.Item, e.SubItem, e.DisplayText)) return;
|
||||
|
||||
/// New value is NOK, revert the original text
|
||||
e.DisplayText = e.Item.Text;
|
||||
e.Cancel = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parse text of a ListViewItem
|
||||
/// </summary>
|
||||
/// <returns>true = value parsed OK</returns>
|
||||
bool ParseItem(ListViewItem item, int subItem, string strValue)
|
||||
{
|
||||
Uncertainty uncrtnty = item.Tag as Uncertainty;
|
||||
double dblValue = 0;
|
||||
if ((uncrtnty != null) && Utils.TryParseEDouble(strValue, out dblValue) && (dblValue >= 0))
|
||||
{
|
||||
double inDefaultUnits = dblValue / 1000;
|
||||
switch (subItem)
|
||||
{
|
||||
case 1:
|
||||
uncrtnty.Measurement = (float)dblValue;
|
||||
return true;
|
||||
case 2:
|
||||
uncrtnty.MainUncertainty = (float)inDefaultUnits;
|
||||
return true;
|
||||
case 3:
|
||||
uncrtnty.Resolution = (float)inDefaultUnits;
|
||||
return true;
|
||||
case 4:
|
||||
uncrtnty.DriftPerYr = (float)inDefaultUnits;
|
||||
return true;
|
||||
case 5:
|
||||
uncrtnty.Conditions = (float)inDefaultUnits;
|
||||
return true;
|
||||
case 6:
|
||||
uncrtnty.UncertaintyOfCorrection = (float)inDefaultUnits;
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
unlocked = true;
|
||||
|
||||
densityTextBox.Enabled = true;
|
||||
temperatureTextBox.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 (DensityCfg != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
double realDensity = Utils.ParseUDouble(densityTextBox.Text);
|
||||
double atTemperature = Utils.ParseUDouble(temperatureTextBox.Text);
|
||||
|
||||
global::Results.WMeterRsltItemSpec.RealDensity =
|
||||
Config.Data.RealDensity = DensityCfg.RealDensity = realDensity;
|
||||
|
||||
global::Results.WMeterRsltItemSpec.AtTemperature =
|
||||
Config.Data.AtTemperature = DensityCfg.AtTemperature = atTemperature;
|
||||
|
||||
Component modified = DensityCfg.CreateDbEntity();
|
||||
MeterEntity.Parameters = modified.Parameters;
|
||||
}
|
||||
catch
|
||||
{
|
||||
MessageBox.Show(Strings.Invalid_density_parameter_Correct_pls,
|
||||
Strings.Error,
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Exclamation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void CancelBtnClicked()
|
||||
@@ -115,10 +187,38 @@ namespace TBF.UI.Bench.Uncertainties
|
||||
|
||||
public void AddOne()
|
||||
{
|
||||
Uncertainty uncrtnty = new Uncertainty();
|
||||
MeterEntity.Uncertainties.Add(uncrtnty);
|
||||
AddOneLVI(uncrtnty);
|
||||
|
||||
listViewEx.Focus();
|
||||
listViewEx.SelectedItems.Clear();
|
||||
listViewEx.Items[listViewEx.Items.Count - 1].Selected = true;
|
||||
listViewEx.Items[listViewEx.Items.Count - 1].EnsureVisible();
|
||||
}
|
||||
|
||||
public void RemoveSelected()
|
||||
{
|
||||
if (listViewEx.SelectedItems.Count != 1) return;
|
||||
|
||||
int removeItemNr = listViewEx.SelectedIndices[0];
|
||||
|
||||
Uncertainty selected =
|
||||
(Uncertainty)listViewEx.SelectedItems[0].Tag;
|
||||
if (selected.Id != 0) toBeRemoved.Add(selected);
|
||||
MeterEntity.Corrections.RemoveAt(removeItemNr);
|
||||
RefreshAll();
|
||||
|
||||
if (removeItemNr < listViewEx.Items.Count)
|
||||
{
|
||||
listViewEx.Focus();
|
||||
listViewEx.Items[removeItemNr].Selected = true;
|
||||
listViewEx.Items[removeItemNr].EnsureVisible();
|
||||
}
|
||||
else
|
||||
{
|
||||
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.None);
|
||||
}
|
||||
}
|
||||
|
||||
public void MoveUpSelected()
|
||||
@@ -129,6 +229,34 @@ namespace TBF.UI.Bench.Uncertainties
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Event handler that indicates the selected item position
|
||||
/// and updates 'Remove', 'Up' and 'Down' buttons in the parent dialog.
|
||||
/// </summary>
|
||||
private void listViewEx_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (listViewEx.SelectedItems.Count != 1)
|
||||
{
|
||||
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.None);
|
||||
}
|
||||
else if (listViewEx.Items.Count == 1)
|
||||
{
|
||||
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.FirstAndLast);
|
||||
}
|
||||
else if (listViewEx.SelectedIndices[0] == 0)
|
||||
{
|
||||
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.First);
|
||||
}
|
||||
else if (listViewEx.SelectedIndices[0] == (listViewEx.Items.Count - 1))
|
||||
{
|
||||
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.Last);
|
||||
}
|
||||
else
|
||||
{
|
||||
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.Middle);
|
||||
}
|
||||
}
|
||||
|
||||
public string GetWarningsBeforeSaving(ref Dictionary<string, string> renmInfo)
|
||||
{
|
||||
return string.Empty;
|
||||
@@ -137,26 +265,5 @@ namespace TBF.UI.Bench.Uncertainties
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+47
-70
@@ -32,14 +32,12 @@ namespace TBF.UI.Bench.Uncertainties
|
||||
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();
|
||||
this.cmpntLabel = new System.Windows.Forms.Label();
|
||||
this.cmpntNameLabel = new System.Windows.Forms.Label();
|
||||
this.listViewEx = new global::Results.Forms.ListViewEx();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
this.splitContainer1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@@ -53,79 +51,60 @@ namespace TBF.UI.Bench.Uncertainties
|
||||
//
|
||||
// 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.Panel1.Controls.Add(this.cmpntLabel);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.cmpntNameLabel);
|
||||
//
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.listViewEx);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(420, 300);
|
||||
this.splitContainer1.SplitterDistance = 120;
|
||||
this.splitContainer1.TabIndex = 1;
|
||||
this.splitContainer1.SplitterDistance = 40;
|
||||
this.splitContainer1.TabIndex = 2;
|
||||
//
|
||||
// densityCorrTextBox
|
||||
// componentLabel
|
||||
//
|
||||
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;
|
||||
this.cmpntLabel.AutoSize = true;
|
||||
this.cmpntLabel.Location = new System.Drawing.Point(14, 12);
|
||||
this.cmpntLabel.Name = "componentLabel";
|
||||
this.cmpntLabel.Size = new System.Drawing.Size(64, 13);
|
||||
this.cmpntLabel.TabIndex = 1;
|
||||
this.cmpntLabel.Text = "Component:";
|
||||
//
|
||||
// densityCorrLabel
|
||||
// cmpntNameLabel
|
||||
//
|
||||
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]";
|
||||
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";
|
||||
//
|
||||
// temperatureTextBox
|
||||
// listViewEx
|
||||
//
|
||||
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);
|
||||
this.listViewEx.AllowColumnReorder = true;
|
||||
this.listViewEx.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.listViewEx.DoubleClickActivation = false;
|
||||
this.listViewEx.FullRowSelect = true;
|
||||
this.listViewEx.GridLines = true;
|
||||
this.listViewEx.Location = new System.Drawing.Point(0, 0);
|
||||
this.listViewEx.Name = "listViewEx";
|
||||
this.listViewEx.Size = new System.Drawing.Size(420, 256);
|
||||
this.listViewEx.TabIndex = 0;
|
||||
this.listViewEx.UseCompatibleStateImageBehavior = false;
|
||||
this.listViewEx.View = System.Windows.Forms.View.Details;
|
||||
this.listViewEx.SelectedIndexChanged += new System.EventHandler(this.listViewEx_SelectedIndexChanged);
|
||||
//
|
||||
// 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
|
||||
// UncertntDlgDensityTab
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.splitContainer1);
|
||||
this.Name = "MetrologyDlgDensityTab";
|
||||
this.Name = "UncertntDlgDensityTab";
|
||||
this.Size = new System.Drawing.Size(420, 300);
|
||||
this.Load += new System.EventHandler(this.MetrologyDlgDensityTab_Load);
|
||||
this.Load += new System.EventHandler(this.UncertntDlgTempMeterTab_Load);
|
||||
this.splitContainer1.Panel1.ResumeLayout(false);
|
||||
this.splitContainer1.Panel1.PerformLayout();
|
||||
this.splitContainer1.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
|
||||
this.splitContainer1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
@@ -135,11 +114,9 @@ namespace TBF.UI.Bench.Uncertainties
|
||||
#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;
|
||||
private System.Windows.Forms.Label cmpntLabel;
|
||||
private System.Windows.Forms.Label cmpntNameLabel;
|
||||
private global::Results.Forms.ListViewEx listViewEx;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user