Bug fixes in MetrologyDlgDensityTab and MetrologyDlgBuoyancyTab.
This commit is contained in:
parent
c1860ab31c
commit
adf7a44a54
@ -62,6 +62,7 @@ namespace TBF.UI.Bench.Metrology
|
|||||||
this.buoyancyTextBox.Name = "buoyancyTextBox";
|
this.buoyancyTextBox.Name = "buoyancyTextBox";
|
||||||
this.buoyancyTextBox.Size = new System.Drawing.Size(110, 20);
|
this.buoyancyTextBox.Size = new System.Drawing.Size(110, 20);
|
||||||
this.buoyancyTextBox.TabIndex = 1;
|
this.buoyancyTextBox.TabIndex = 1;
|
||||||
|
this.buoyancyTextBox.TextChanged += new System.EventHandler(this.buoyancyTextBox_TextChanged);
|
||||||
//
|
//
|
||||||
// buoyancyLabel
|
// buoyancyLabel
|
||||||
//
|
//
|
||||||
|
|||||||
@ -18,12 +18,7 @@ namespace TBF.UI.Bench.Metrology
|
|||||||
/// Component entity that has a list of 'measurement-correction' pairs
|
/// Component entity that has a list of 'measurement-correction' pairs
|
||||||
/// to be updated in the database on OK.
|
/// to be updated in the database on OK.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Component MeterEntity
|
public Component MeterEntity { get; set; }
|
||||||
{
|
|
||||||
get { return meterEntity; }
|
|
||||||
set { meterEntity = value; }
|
|
||||||
}
|
|
||||||
Component meterEntity;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Buoyancy configuration
|
/// Buoyancy configuration
|
||||||
@ -33,26 +28,21 @@ namespace TBF.UI.Bench.Metrology
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// A list of 'measurement-correction' pairs to be deleted from the database on OK.
|
/// A list of 'measurement-correction' pairs to be deleted from the database on OK.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IList<MeasurementCorrection> ToBeRemoved
|
public IList<MeasurementCorrection> ToBeRemoved { get; set; }
|
||||||
{
|
|
||||||
get { return toBeRemoved; }
|
|
||||||
set { toBeRemoved = value; }
|
|
||||||
}
|
|
||||||
IList<MeasurementCorrection> toBeRemoved;
|
|
||||||
|
|
||||||
MetrologyDlg parent;
|
MetrologyDlg parent;
|
||||||
bool unlocked;
|
bool valuesModified;
|
||||||
|
|
||||||
public MetrologyDlgBuoyancyTab()
|
public MetrologyDlgBuoyancyTab()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
toBeRemoved = new List<MeasurementCorrection>();
|
ToBeRemoved = new List<MeasurementCorrection>();
|
||||||
unlocked = false;
|
valuesModified = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MetrologyDlgBuoyancyTab_Load(object sender, System.EventArgs e)
|
private void MetrologyDlgBuoyancyTab_Load(object sender, System.EventArgs e)
|
||||||
{
|
{
|
||||||
if (meterEntity == null) return;
|
if (MeterEntity == null) return;
|
||||||
|
|
||||||
parent = ParentForm as MetrologyDlg;
|
parent = ParentForm as MetrologyDlg;
|
||||||
|
|
||||||
@ -66,13 +56,11 @@ namespace TBF.UI.Bench.Metrology
|
|||||||
|
|
||||||
void RefreshAll()
|
void RefreshAll()
|
||||||
{
|
{
|
||||||
buoyancyTextBox.Text = Config.Data.Buoyancy.ToString("F5");
|
buoyancyTextBox.Text = BuoyancyCfg.Buoyancy.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Unlock()
|
public void Unlock()
|
||||||
{
|
{
|
||||||
unlocked = true;
|
|
||||||
|
|
||||||
buoyancyTextBox.Enabled = true;
|
buoyancyTextBox.Enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,9 +70,10 @@ namespace TBF.UI.Bench.Metrology
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
double buoyancy = Utils.ParseUDouble(buoyancyTextBox.Text);
|
if (valuesModified)
|
||||||
|
{
|
||||||
Config.Data.Buoyancy = BuoyancyCfg.Buoyancy = buoyancy;
|
Config.Data.Buoyancy = BuoyancyCfg.Buoyancy = Utils.ParseUDouble(buoyancyTextBox.Text);
|
||||||
|
}
|
||||||
|
|
||||||
Component modified = BuoyancyCfg.CreateDbEntity();
|
Component modified = BuoyancyCfg.CreateDbEntity();
|
||||||
MeterEntity.Parameters = modified.Parameters;
|
MeterEntity.Parameters = modified.Parameters;
|
||||||
@ -99,25 +88,11 @@ namespace TBF.UI.Bench.Metrology
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CancelBtnClicked()
|
public void CancelBtnClicked() { }
|
||||||
{
|
public void AddOne() { }
|
||||||
}
|
public void RemoveSelected() { }
|
||||||
|
public void MoveUpSelected() { }
|
||||||
public void AddOne()
|
public void MoveDownSelected() { }
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RemoveSelected()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void MoveUpSelected()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void MoveDownSelected()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GetWarningsBeforeSaving(ref Dictionary<string, string> renmInfo)
|
public string GetWarningsBeforeSaving(ref Dictionary<string, string> renmInfo)
|
||||||
{
|
{
|
||||||
@ -128,6 +103,11 @@ namespace TBF.UI.Bench.Metrology
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void buoyancyTextBox_TextChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
valuesModified = true;
|
||||||
|
}
|
||||||
|
|
||||||
public void SaveEntityToDB(NHibernate.ISession session)
|
public void SaveEntityToDB(NHibernate.ISession session)
|
||||||
{
|
{
|
||||||
session.SaveOrUpdate(MeterEntity);
|
session.SaveOrUpdate(MeterEntity);
|
||||||
|
|||||||
@ -18,12 +18,7 @@ namespace TBF.UI.Bench.Metrology
|
|||||||
/// Component entity that has a list of 'measurement-correction' pairs
|
/// Component entity that has a list of 'measurement-correction' pairs
|
||||||
/// to be updated in the database on OK.
|
/// to be updated in the database on OK.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Component MeterEntity
|
public Component MeterEntity { get; set; }
|
||||||
{
|
|
||||||
get { return meterEntity; }
|
|
||||||
set { meterEntity = value; }
|
|
||||||
}
|
|
||||||
Component meterEntity;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Density configuration
|
/// Density configuration
|
||||||
@ -33,15 +28,11 @@ namespace TBF.UI.Bench.Metrology
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// A list of 'measurement-correction' pairs to be deleted from the database on OK.
|
/// A list of 'measurement-correction' pairs to be deleted from the database on OK.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IList<MeasurementCorrection> ToBeRemoved
|
public IList<MeasurementCorrection> ToBeRemoved { get; set; }
|
||||||
{
|
|
||||||
get { return toBeRemoved; }
|
|
||||||
set { toBeRemoved = value; }
|
|
||||||
}
|
|
||||||
IList<MeasurementCorrection> toBeRemoved;
|
|
||||||
|
|
||||||
MetrologyDlg parent;
|
MetrologyDlg parent;
|
||||||
bool unlocked;
|
bool unlocked;
|
||||||
|
bool valuesModified;
|
||||||
|
|
||||||
public MetrologyDlgDensityTab()
|
public MetrologyDlgDensityTab()
|
||||||
{
|
{
|
||||||
@ -50,13 +41,13 @@ namespace TBF.UI.Bench.Metrology
|
|||||||
calibDateTimePicker.MinDate = Constants.MinDate;
|
calibDateTimePicker.MinDate = Constants.MinDate;
|
||||||
calibExpirationDateTimePicker.CustomFormat = Constants.DateFormat;
|
calibExpirationDateTimePicker.CustomFormat = Constants.DateFormat;
|
||||||
calibExpirationDateTimePicker.MinDate = Constants.MinDate;
|
calibExpirationDateTimePicker.MinDate = Constants.MinDate;
|
||||||
toBeRemoved = new List<MeasurementCorrection>();
|
ToBeRemoved = new List<MeasurementCorrection>();
|
||||||
unlocked = false;
|
valuesModified = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MetrologyDlgDensityTab_Load(object sender, System.EventArgs e)
|
private void MetrologyDlgDensityTab_Load(object sender, System.EventArgs e)
|
||||||
{
|
{
|
||||||
if (meterEntity == null) return;
|
if (MeterEntity == null) return;
|
||||||
|
|
||||||
parent = ParentForm as MetrologyDlg;
|
parent = ParentForm as MetrologyDlg;
|
||||||
|
|
||||||
@ -84,9 +75,9 @@ namespace TBF.UI.Bench.Metrology
|
|||||||
{
|
{
|
||||||
if (DensityCfg != null)
|
if (DensityCfg != null)
|
||||||
{
|
{
|
||||||
densityTextBox.Text = Config.Data.RealDensity.ToString("F4");
|
densityTextBox.Text = DensityCfg.RealDensity.ToString();
|
||||||
temperatureTextBox.Text = Config.Data.AtTemperature.ToString("F2");
|
temperatureTextBox.Text = DensityCfg.AtTemperature.ToString();
|
||||||
densityCorrTextBox.Text = Config.Formulas.DensityCorrection(Config.Data.RealDensity, Config.Data.AtTemperature).ToString("F5");
|
densityCorrTextBox.Text = Config.Formulas.DensityCorrection(DensityCfg.RealDensity, DensityCfg.AtTemperature).ToString("F5");
|
||||||
calibCertificateNrTextBox.Text = DensityCfg.CalibCertificateNr;
|
calibCertificateNrTextBox.Text = DensityCfg.CalibCertificateNr;
|
||||||
calibDateTimePicker.Value = (DensityCfg.CalibDate < Constants.MinDate) ? Constants.MinDate : DensityCfg.CalibDate;
|
calibDateTimePicker.Value = (DensityCfg.CalibDate < Constants.MinDate) ? Constants.MinDate : DensityCfg.CalibDate;
|
||||||
calibExpirationDateTimePicker.Value = (DensityCfg.CalibValidDate < Constants.MinDate) ? Constants.MinDate : DensityCfg.CalibValidDate;
|
calibExpirationDateTimePicker.Value = (DensityCfg.CalibValidDate < Constants.MinDate) ? Constants.MinDate : DensityCfg.CalibValidDate;
|
||||||
@ -95,8 +86,6 @@ namespace TBF.UI.Bench.Metrology
|
|||||||
|
|
||||||
public void Unlock()
|
public void Unlock()
|
||||||
{
|
{
|
||||||
unlocked = true;
|
|
||||||
|
|
||||||
densityTextBox.Enabled = true;
|
densityTextBox.Enabled = true;
|
||||||
temperatureTextBox.Enabled = true;
|
temperatureTextBox.Enabled = true;
|
||||||
calibCertificateNrTextBox.Enabled = true;
|
calibCertificateNrTextBox.Enabled = true;
|
||||||
@ -110,11 +99,11 @@ namespace TBF.UI.Bench.Metrology
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
double realDensity = Utils.ParseUDouble(densityTextBox.Text);
|
if (valuesModified)
|
||||||
double atTemperature = Utils.ParseUDouble(temperatureTextBox.Text);
|
{
|
||||||
|
Config.Data.RealDensity = DensityCfg.RealDensity = Utils.ParseUDouble(densityTextBox.Text);
|
||||||
Config.Data.RealDensity = DensityCfg.RealDensity = realDensity;
|
Config.Data.AtTemperature = DensityCfg.AtTemperature = Utils.ParseUDouble(temperatureTextBox.Text);
|
||||||
Config.Data.AtTemperature = DensityCfg.AtTemperature = atTemperature;
|
}
|
||||||
|
|
||||||
DensityCfg.CalibCertificateNr = calibCertificateNrTextBox.Text;
|
DensityCfg.CalibCertificateNr = calibCertificateNrTextBox.Text;
|
||||||
DensityCfg.CalibDate = calibDateTimePicker.Value.Date;
|
DensityCfg.CalibDate = calibDateTimePicker.Value.Date;
|
||||||
@ -133,25 +122,11 @@ namespace TBF.UI.Bench.Metrology
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CancelBtnClicked()
|
public void CancelBtnClicked() { }
|
||||||
{
|
public void AddOne() { }
|
||||||
}
|
public void RemoveSelected() { }
|
||||||
|
public void MoveUpSelected() { }
|
||||||
public void AddOne()
|
public void MoveDownSelected() { }
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RemoveSelected()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void MoveUpSelected()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void MoveDownSelected()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GetWarningsBeforeSaving(ref Dictionary<string, string> renmInfo)
|
public string GetWarningsBeforeSaving(ref Dictionary<string, string> renmInfo)
|
||||||
{
|
{
|
||||||
@ -165,12 +140,14 @@ namespace TBF.UI.Bench.Metrology
|
|||||||
private void densityTextBox_TextChanged(object sender, EventArgs e)
|
private void densityTextBox_TextChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
UpdateDensityCorrectionDisplay();
|
UpdateDensityCorrectionDisplay();
|
||||||
|
valuesModified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void temperatureTextBox_TextChanged(object sender, EventArgs e)
|
private void temperatureTextBox_TextChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
UpdateDensityCorrectionDisplay();
|
UpdateDensityCorrectionDisplay();
|
||||||
}
|
valuesModified = true;
|
||||||
|
}
|
||||||
|
|
||||||
void UpdateDensityCorrectionDisplay()
|
void UpdateDensityCorrectionDisplay()
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user