Buoyancy parameters added to the UI: Metrology tabs, BalanceCfg, BalanceDev.

This commit is contained in:
Milan Hanajik 2016-04-25 12:28:21 +02:00
parent ca2705421b
commit df58d05b84
12 changed files with 377 additions and 157 deletions

View File

@ -42,6 +42,9 @@ namespace TBF.BenchControl.GenericDevices
/// </summary>
int EmptyTimeSec { get; }
float BuoyancyTemp { get; } ///
float BuoyancyPress { get; } /// Displayed in Metrology tab page
float BuoyancyHumi { get; } ///
/// <summary>
/// Measurement correction table

View File

@ -0,0 +1,16 @@
///
/// Copyright (c) 2013-2016 Sensus Metering Systems
///
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.GenericDevices
{
public interface IBalanceCfg : IComponentCfg
{
/// Parameters displayed in Metrology tab page
float BuoyancyTemp { get; set; }
float BuoyancyPress { get; set; }
float BuoyancyHumi { get; set; }
}
}

View File

@ -10,7 +10,7 @@ using TBF.BenchControl.Generic;
namespace TBF.BenchControl.MettlerToledo.Multi
{
public class BalanceCfg : ComponentCfgBase, Generic.IComponentCfg
public class BalanceCfg : ComponentCfgBase, GenericDevices.IBalanceCfg
{
public IComponent GetComponent(IList<IComponent> components) { return new BalanceDev(this); }
public IComponentCfgCtrl GetControl() { return new BalanceCfgCtrl(); }
@ -18,12 +18,12 @@ namespace TBF.BenchControl.MettlerToledo.Multi
///
/// Serialized parameters
///
public int IdNr; /// Identification number 1..3
public float Capacity; /// Max. water mass in 'kg' or volume in 'l'
public float Resolution; /// Resolution of the integer value in the serial protocol in 'kg'
public float Empty; /// 'Empty' water mass in 'kg' or volume in 'l'
public int IdNr; /// Identification number 1..3
public float Capacity; /// Max. water mass in 'kg' or volume in 'l'
public float Resolution; /// Resolution of the integer value in the serial protocol in 'kg'
public float Empty; /// 'Empty' water mass in 'kg' or volume in 'l'
public string Format;
public int EmptyTimeSec; /// s
public int EmptyTimeSec; /// s
public int ComPortNr;
public int BaudRate;
@ -32,6 +32,27 @@ namespace TBF.BenchControl.MettlerToledo.Multi
public StopBits StopBits;
public Handshake Handshake;
/// Buoyancy - Displayed in Metrology tab page
private float buoyancyTemp;
private float buoyancyPress;
private float buoyancyHumi;
///
public float BuoyancyTemp
{
get { return buoyancyTemp; }
set { buoyancyTemp = value; }
}
public float BuoyancyPress
{
get { return buoyancyPress; }
set { buoyancyPress = value; }
}
public float BuoyancyHumi
{
get { return buoyancyHumi; }
set { buoyancyHumi = value; }
}
/// Private parameterless constructor invoked by all other (public) constructors
BalanceCfg()
{
@ -51,7 +72,11 @@ namespace TBF.BenchControl.MettlerToledo.Multi
DataBits = 7;
StopBits = System.IO.Ports.StopBits.One;
Handshake = System.IO.Ports.Handshake.XOnXOff;
}
BuoyancyTemp = 20.0f;
BuoyancyPress = 1.0f;
BuoyancyHumi = 40.0f;
}
public BalanceCfg(IComponentFactory factory)
: this()

View File

@ -54,6 +54,11 @@ namespace TBF.BenchControl.MettlerToledo.Multi
public float Capacity { get { return balanceCfg.Capacity; } }
public float Resolution { get { return balanceCfg.Resolution; } }
public int EmptyTimeSec { get { return balanceCfg.EmptyTimeSec; } }
/// Buoyancy
public float BuoyancyTemp { get { return balanceCfg.BuoyancyTemp; } }
public float BuoyancyPress { get { return balanceCfg.BuoyancyPress; } }
public float BuoyancyHumi { get { return balanceCfg.BuoyancyHumi; } }
/// <summary>The state of the mass measurement</summary>
public MsrmntState MsrmntState { get { return msrmntState; } }

View File

@ -10,7 +10,7 @@ using TBF.BenchControl.Generic;
namespace TBF.BenchControl.MettlerToledo.Standard
{
public class BalanceCfg : ComponentCfgBase, Generic.IComponentCfg
public class BalanceCfg : ComponentCfgBase, GenericDevices.IBalanceCfg
{
public IComponent GetComponent(IList<IComponent> components)
{
@ -29,10 +29,32 @@ namespace TBF.BenchControl.MettlerToledo.Standard
public int DataBits;
public StopBits StopBits;
public Handshake Handshake;
public float Capacity; /// Max. water mass in 'kg' or volume in 'l'
public float Empty; /// 'Empty' water mass in 'kg' or volume in 'l'
public float Capacity; /// Max. water mass in 'kg' or volume in 'l'
public float Empty; /// 'Empty' water mass in 'kg' or volume in 'l'
public string Format;
public int EmptyTimeSec; /// s
public int EmptyTimeSec; /// s
/// Buoyancy - Displayed in Metrology tab page
private float buoyancyTemp;
private float buoyancyPress;
private float buoyancyHumi;
///
public float BuoyancyTemp
{
get { return buoyancyTemp; }
set { buoyancyTemp = value; }
}
public float BuoyancyPress
{
get { return buoyancyPress; }
set { buoyancyPress = value; }
}
public float BuoyancyHumi
{
get { return buoyancyHumi; }
set { buoyancyHumi = value; }
}
/// Private parameterless constructor invoked by all other (public) constructors
BalanceCfg()
@ -49,7 +71,10 @@ namespace TBF.BenchControl.MettlerToledo.Standard
Empty = 20.0f;
Format = "F3";
EmptyTimeSec = 180;
}
BuoyancyTemp = 20.0f;
BuoyancyPress = 1.0f;
BuoyancyHumi = 40.0f;
}
public BalanceCfg(IComponentFactory factory)
: this()

View File

@ -51,7 +51,12 @@ namespace TBF.BenchControl.MettlerToledo.Standard
public int BalanceNr { get { return balanceNr; } }
public float Capacity { get { return balanceCfg.Capacity; } }
public int EmptyTimeSec { get { return balanceCfg.EmptyTimeSec; } }
/// Buoyancy
public float BuoyancyTemp { get { return balanceCfg.BuoyancyTemp; } }
public float BuoyancyPress { get { return balanceCfg.BuoyancyPress; } }
public float BuoyancyHumi { get { return balanceCfg.BuoyancyHumi; } }
/// <summary>The state of the mass measurement</summary>
public MsrmntState MsrmntState { get { return msrmntState; } }
protected MsrmntState msrmntState;

View File

@ -69,12 +69,15 @@ namespace TBF
// Balance tab-pages
if (factory is BenchControl.MettlerToledo.Standard.BalanceFactory ||
factory is BenchControl.MettlerToledo.Standard.BalanceNewFactory)
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.IBalanceCfg;
uiControl.Dock = DockStyle.Fill;
tabPage.Tag = uiControl;
tabPage.Controls.Add(uiControl);
@ -121,12 +124,13 @@ namespace TBF
{
IMetrologyDlgTab tab = tabPage.Tag as IMetrologyDlgTab;
tab.OkBtnClicked();
if (!(tabPage.Tag is MetrologyDlgDensityTab))
if (!(tabPage.Tag is MetrologyDlgDensityTab))
{
Config.FluentCommon.SaveToDb(session, tab.MeterEntity);
foreach (var entity in tab.ToBeRemoved) Config.FluentCommon.DeleteFromDb(session, entity);
}
}
}
Program.LocalSettings.MetrologyDlgLeft = Location.X;
Program.LocalSettings.MetrologyDlgTop = Location.Y;

View File

@ -1212,6 +1212,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to At least one of Buoyancy parameters is invalid,\r\ncorrect it please..
/// </summary>
internal static string Invalid_buoyancy_parameter_Correct_pls {
get {
return ResourceManager.GetString("Invalid_buoyancy_parameter_Correct_pls", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Invalid password.
/// </summary>

View File

@ -1216,4 +1216,7 @@
<data name="Continue_in_the_cycle" xml:space="preserve">
<value>Continue in the cycle after this test?</value>
</data>
<data name="Invalid_buoyancy_parameter_Correct_pls" xml:space="preserve">
<value>At least one of Buoyancy parameters is invalid,\r\ncorrect it please.</value>
</data>
</root>

View File

@ -336,6 +336,7 @@
<DependentUpon>ValveCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="BenchControl\Elde\ValveEx\ValveFactory.cs" />
<Compile Include="BenchControl\GenericDevices\IBalanceCfg.cs" />
<Compile Include="BenchControl\GenericDevices\IModbus.cs" />
<Compile Include="BenchControl\GenericDevices\IBenchInfo.cs" />
<Compile Include="BenchControl\GenericDevices\ISimultTestMethod.cs" />

View File

@ -31,152 +31,238 @@ namespace TBF.UiControls
/// </summary>
private void InitializeComponent()
{
this.cmpntNameLabel = new System.Windows.Forms.Label();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.measuredLabel = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.listViewEx = new TBF.UiControls.ListViewEx();
this.testGroupBox = new System.Windows.Forms.GroupBox();
this.correctedLabel = new System.Windows.Forms.Label();
this.measuredTextBox = new System.Windows.Forms.TextBox();
this.correctedTextBox = new System.Windows.Forms.TextBox();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.testGroupBox.SuspendLayout();
this.SuspendLayout();
//
// 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";
//
// 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.label1);
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 = 1;
//
// 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";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(14, 12);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(64, 13);
this.label1.TabIndex = 1;
this.label1.Text = "Component:";
//
// 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);
//
// 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 = 3;
this.testGroupBox.TabStop = false;
this.testGroupBox.Text = "Test";
//
// 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";
//
// 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);
//
// 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;
//
// 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(420, 300);
this.Load += new System.EventHandler(this.MetrologyDlgBalanceTab_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);
this.cmpntNameLabel = new System.Windows.Forms.Label();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.buoancyGroupBox = new System.Windows.Forms.GroupBox();
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 TBF.UiControls.ListViewEx();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.buoancyGroupBox.SuspendLayout();
this.nameGroupBox.SuspendLayout();
this.testGroupBox.SuspendLayout();
this.SuspendLayout();
//
// cmpntNameLabel
//
this.cmpntNameLabel.AutoSize = true;
this.cmpntNameLabel.Location = new System.Drawing.Point(20, 41);
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.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(550, 300);
this.splitContainer1.SplitterDistance = 105;
this.splitContainer1.TabIndex = 1;
//
// buoancyGroupBox
//
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(112, 10);
this.buoancyGroupBox.Name = "buoancyGroupBox";
this.buoancyGroupBox.Size = new System.Drawing.Size(228, 88);
this.buoancyGroupBox.TabIndex = 5;
this.buoancyGroupBox.TabStop = false;
this.buoancyGroupBox.Text = "Buoyancy";
//
// buoyancyHumiTextBox
//
this.buoyancyHumiTextBox.Enabled = false;
this.buoyancyHumiTextBox.Location = new System.Drawing.Point(140, 61);
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(140, 38);
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(140, 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, 64);
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, 41);
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(90, 88);
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(346, 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 = "Test correction";
//
// correctedTextBox
//
this.correctedTextBox.Location = new System.Drawing.Point(91, 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(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(18, 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(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(550, 191);
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(550, 300);
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.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 System.Windows.Forms.Label label1;
private System.Windows.Forms.SplitContainer splitContainer1;
private 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;
}
}

View File

@ -26,6 +26,11 @@ namespace TBF.UiControls
}
Component meterEntity;
/// <summary>
/// Balance configuration (with buoyancy parameters)
/// </summary>
public BenchControl.GenericDevices.IBalanceCfg BalanceCfg;
/// <summary>
/// A list of 'measurement-correction' pairs to be deleted from the database on OK.
/// </summary>
@ -54,12 +59,10 @@ namespace TBF.UiControls
parent = ParentForm as MetrologyDlg;
/// Panel1
cmpntNameLabel.Text = meterEntity.Name;
Localize();
testGroupBox.Text = Strings.Test_measured_corrected;
measuredLabel.Text = Strings.Measured;
correctedLabel.Text = Strings.Corrected;
/// Panel1
cmpntNameLabel.Text = meterEntity.Name;
measuredTextBox.Text = string.Empty;
correctedTextBox.Text = string.Empty;
@ -79,8 +82,26 @@ namespace TBF.UiControls
RefreshAll();
}
void Localize()
{
buoyancyTempLabel.Text = Strings.Ambient_temperature_;
buoyancyPressLabel.Text = Strings.Ambient_pressure_;
buoyancyHumiLabel.Text = Strings.Ambient_humidity_;
testGroupBox.Text = Strings.Test_measured_corrected;
measuredLabel.Text = Strings.Measured;
correctedLabel.Text = Strings.Corrected;
}
void RefreshAll()
{
if (BalanceCfg != null)
{
buoyancyTempTextBox.Text = BalanceCfg.BuoyancyTemp.ToString("F2");
buoyancyPressTextBox.Text = BalanceCfg.BuoyancyPress.ToString("F4");
buoyancyHumiTextBox.Text = BalanceCfg.BuoyancyHumi.ToString("F1");
}
listViewEx.Items.Clear();
foreach (var corr in MeterEntity.Corrections) AddOneLVI(corr);
}
@ -129,6 +150,10 @@ namespace TBF.UiControls
{
unlocked = true;
buoyancyTempTextBox.Enabled = true;
buoyancyPressTextBox.Enabled = true;
buoyancyHumiTextBox.Enabled = true;
if (listViewEx.SelectedItems.Count == 1)
{
int ix = listViewEx.SelectedIndices[0];
@ -140,7 +165,20 @@ namespace TBF.UiControls
public void OkBtnClicked()
{
}
try
{
BalanceCfg.BuoyancyTemp = Utils.ParseSFloat(buoyancyTempTextBox.Text);
BalanceCfg.BuoyancyPress = Utils.ParseUFloat(buoyancyPressTextBox.Text);
BalanceCfg.BuoyancyHumi = Utils.ParseUFloat(buoyancyHumiTextBox.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()
{