2015-04-15 18:32:56 +00:00
|
|
|
|
///
|
2019-05-10 10:32:13 +00:00
|
|
|
|
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
|
2015-04-15 18:32:56 +00:00
|
|
|
|
///
|
|
|
|
|
|
using System;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Globalization;
|
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
using log4net;
|
2015-12-04 16:17:20 +00:00
|
|
|
|
using Config.Entities;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
using TBF.Resources;
|
|
|
|
|
|
|
|
|
|
|
|
namespace TBF.UiControls
|
|
|
|
|
|
{
|
|
|
|
|
|
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>
|
2015-12-04 16:17:20 +00:00
|
|
|
|
Component meterEntity;
|
|
|
|
|
|
public Component MeterEntity
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
|
|
|
|
|
get { return meterEntity; }
|
|
|
|
|
|
set { meterEntity = value; }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2016-04-28 10:47:23 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Calibration information configuration
|
|
|
|
|
|
/// </summary>
|
2018-11-12 17:35:47 +00:00
|
|
|
|
public BenchControl.GenericDevices.ICalibRangesCfg CalibInfoCfg;
|
2016-04-28 10:47:23 +00:00
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// A list of 'measurement-correction' pairs to be deleted from the database on OK.
|
|
|
|
|
|
/// </summary>
|
2015-12-04 16:17:20 +00:00
|
|
|
|
public IList<MeasurementCorrection> ToBeRemoved
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
|
|
|
|
|
get { return toBeRemoved; }
|
|
|
|
|
|
set { toBeRemoved = value; }
|
|
|
|
|
|
}
|
2015-12-04 16:17:20 +00:00
|
|
|
|
IList<MeasurementCorrection> toBeRemoved;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
MetrologyDlg parent;
|
|
|
|
|
|
bool unlocked;
|
|
|
|
|
|
Control measurementTextBox;
|
|
|
|
|
|
Control correctionTextBox;
|
2019-05-10 10:32:13 +00:00
|
|
|
|
Control errorTextBox;
|
2018-01-24 13:16:38 +00:00
|
|
|
|
int rangeIx; /// 0 (no range) or 1..5 (range #)
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2018-01-24 13:16:38 +00:00
|
|
|
|
|
|
|
|
|
|
public MetrologyDlgFlowMeterTab() : this(0) {}
|
|
|
|
|
|
|
|
|
|
|
|
public MetrologyDlgFlowMeterTab(int rangeIx1)
|
|
|
|
|
|
{
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
this.rangeIx = rangeIx1;
|
|
|
|
|
|
toBeRemoved = new List<MeasurementCorrection>();
|
|
|
|
|
|
}
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
private void MetrologyDlgFlowMeterTab_Load(object sender, System.EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (meterEntity == null) return;
|
|
|
|
|
|
|
|
|
|
|
|
parent = ParentForm as MetrologyDlg;
|
|
|
|
|
|
|
2016-04-28 10:47:23 +00:00
|
|
|
|
Localize();
|
|
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
/// Panel1
|
2018-01-24 13:16:38 +00:00
|
|
|
|
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));
|
|
|
|
|
|
}
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
testGroupBox.Text = Strings.Test_measured_corrected;
|
|
|
|
|
|
measuredLabel.Text = Strings.Measured;
|
|
|
|
|
|
correctedLabel.Text = Strings.Corrected;
|
|
|
|
|
|
measuredTextBox.Text = string.Empty;
|
|
|
|
|
|
correctedTextBox.Text = string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
/// Panel2
|
2019-05-10 10:32:13 +00:00
|
|
|
|
this.Controls.Add(measurementTextBox = new TextBox());
|
|
|
|
|
|
this.Controls.Add(correctionTextBox = new TextBox());
|
|
|
|
|
|
this.Controls.Add(errorTextBox = new TextBox());
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2016-08-19 08:43:48 +00:00
|
|
|
|
listViewEx.SubItemClicked += new Results.Forms.SubItemEventHandler(listViewEx_SubItemClicked);
|
|
|
|
|
|
listViewEx.SubItemEndEditing += new Results.Forms.SubItemEndEditingEventHandler(listViewEx_SubItemEndEditing);
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
listViewEx.Columns.Add(new ColumnHeader() { Text = Strings.Nr, Width = 60 });
|
2018-04-17 13:02:49 +00:00
|
|
|
|
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 });
|
2019-05-10 10:32:13 +00:00
|
|
|
|
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [%]", Strings.Error), Width = 100 });
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2018-01-24 13:16:38 +00:00
|
|
|
|
RefreshAll(rangeIx);
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2016-04-28 10:47:23 +00:00
|
|
|
|
void Localize()
|
|
|
|
|
|
{
|
|
|
|
|
|
nameGroupBox.Text = Strings.Component;
|
2016-05-18 17:19:31 +00:00
|
|
|
|
|
|
|
|
|
|
calibrationGroupBox.Text = Strings.Calibration;
|
|
|
|
|
|
calibCertificateNrLabel.Text = Strings.Certificate;
|
|
|
|
|
|
calibDateLabel.Text = Strings.Date;
|
|
|
|
|
|
calibValidDateLabel.Text = Strings.Valid_until;
|
|
|
|
|
|
|
2016-04-28 10:47:23 +00:00
|
|
|
|
testGroupBox.Text = Strings.Test_measured_corrected;
|
|
|
|
|
|
measuredLabel.Text = Strings.Measured;
|
|
|
|
|
|
correctedLabel.Text = Strings.Corrected;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-01-24 13:16:38 +00:00
|
|
|
|
void RefreshAll(int rangeIx1)
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
2016-04-28 10:47:23 +00:00
|
|
|
|
if (CalibInfoCfg != null)
|
|
|
|
|
|
{
|
2018-01-24 13:16:38 +00:00
|
|
|
|
calibCertificateNrTextBox.Text = CalibInfoCfg.GetCalibCertificate(rangeIx1);
|
|
|
|
|
|
calibDateTextBox.Text = CalibInfoCfg.GetCalibDate(rangeIx1).ToShortDateString();
|
|
|
|
|
|
calibValidDateTextBox.Text = CalibInfoCfg.GetCalibValidDate(rangeIx1).ToShortDateString();
|
2016-04-28 10:47:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
listViewEx.Items.Clear();
|
2018-01-24 13:16:38 +00:00
|
|
|
|
foreach (var corr in MeterEntity.Corrections)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (corr.RangeIx == rangeIx) AddOneLVI(corr);
|
|
|
|
|
|
}
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2015-12-04 16:17:20 +00:00
|
|
|
|
void AddOneLVI(MeasurementCorrection corr)
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
|
|
|
|
|
int nr = listViewEx.Items.Count + 1;
|
|
|
|
|
|
ListViewItem lvi = new ListViewItem(nr.ToString());
|
2019-05-10 10:32:13 +00:00
|
|
|
|
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);
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2016-08-19 08:43:48 +00:00
|
|
|
|
void listViewEx_SubItemClicked(object sender, Results.Forms.SubItemEventArgs e)
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
|
|
|
|
|
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);
|
|
|
|
|
|
}
|
2019-05-10 10:32:13 +00:00
|
|
|
|
else if (unlocked && e.SubItem == 3)
|
2016-08-15 09:23:00 +00:00
|
|
|
|
{
|
2019-05-10 10:32:13 +00:00
|
|
|
|
listViewEx.StartEditing(correctionTextBox, e.Item, e.SubItem);
|
2016-08-15 09:23:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2016-08-19 08:43:48 +00:00
|
|
|
|
void listViewEx_SubItemEndEditing(object sender, Results.Forms.SubItemEndEditingEventArgs e)
|
2016-08-15 09:23:00 +00:00
|
|
|
|
{
|
|
|
|
|
|
if (ParseItem(e.Item, e.SubItem, e.DisplayText)) return;
|
|
|
|
|
|
|
2019-05-10 10:32:13 +00:00
|
|
|
|
/// New value is NOK, revert the original text
|
2016-08-15 09:23:00 +00:00
|
|
|
|
e.DisplayText = e.Item.Text;
|
|
|
|
|
|
e.Cancel = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Parse text of a ListViewItem
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns>true = value parsed OK</returns>
|
2019-05-10 10:32:13 +00:00
|
|
|
|
bool ParseItem(ListViewItem item, int subItem, string strValue)
|
2016-08-15 09:23:00 +00:00
|
|
|
|
{
|
2019-05-10 10:32:13 +00:00
|
|
|
|
double dblValue = 0;
|
|
|
|
|
|
if (subItem == 1 && Utils.TryParseEDouble(strValue, out dblValue) && dblValue >= 0)
|
2016-08-15 09:23:00 +00:00
|
|
|
|
{
|
2019-05-10 10:32:13 +00:00
|
|
|
|
(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;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2016-08-15 09:23:00 +00:00
|
|
|
|
return true;
|
|
|
|
|
|
}
|
2019-05-10 10:32:13 +00:00
|
|
|
|
else if (subItem == 2 && Utils.TryParseEDouble(strValue, out dblValue))
|
2016-08-15 09:23:00 +00:00
|
|
|
|
{
|
2019-05-10 10:32:13 +00:00
|
|
|
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2016-08-15 09:23:00 +00:00
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
public void Unlock()
|
|
|
|
|
|
{
|
|
|
|
|
|
unlocked = true;
|
|
|
|
|
|
|
2016-04-28 10:47:23 +00:00
|
|
|
|
calibCertificateNrTextBox.Enabled = true;
|
|
|
|
|
|
calibDateTextBox.Enabled = true;
|
|
|
|
|
|
calibValidDateTextBox.Enabled = true;
|
|
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
if (listViewEx.SelectedItems.Count == 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
int ix = listViewEx.SelectedIndices[0];
|
|
|
|
|
|
listViewEx.Focus();
|
|
|
|
|
|
listViewEx.Items[ix].Selected = true;
|
|
|
|
|
|
listViewEx.Items[ix].EnsureVisible();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void OkBtnClicked()
|
|
|
|
|
|
{
|
2016-04-28 10:47:23 +00:00
|
|
|
|
if (CalibInfoCfg != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
2018-01-24 13:16:38 +00:00
|
|
|
|
CalibInfoCfg.SetCalibCertificate(rangeIx, calibCertificateNrTextBox.Text);
|
|
|
|
|
|
CalibInfoCfg.SetCalibDate(rangeIx, DateTime.Parse(calibDateTextBox.Text));
|
|
|
|
|
|
CalibInfoCfg.SetCalibValidDate(rangeIx, DateTime.Parse(calibValidDateTextBox.Text));
|
2016-04-28 10:47:23 +00:00
|
|
|
|
|
|
|
|
|
|
Component modified = CalibInfoCfg.CreateDbEntity();
|
|
|
|
|
|
MeterEntity.Parameters = modified.Parameters;
|
|
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
2016-05-28 11:40:58 +00:00
|
|
|
|
MessageBox.Show(Strings.Invalid_calib_info_Correct_pls,
|
|
|
|
|
|
Strings.Error,
|
|
|
|
|
|
MessageBoxButtons.OK,
|
|
|
|
|
|
MessageBoxIcon.Exclamation);
|
2016-04-28 10:47:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
public void CancelBtnClicked()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void AddOne()
|
|
|
|
|
|
{
|
2018-01-24 13:16:38 +00:00
|
|
|
|
MeasurementCorrection corr = new MeasurementCorrection(rangeIx);
|
2014-07-28 07:54:35 +00:00
|
|
|
|
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];
|
|
|
|
|
|
|
2018-01-24 13:16:38 +00:00
|
|
|
|
MeasurementCorrection selected = (MeasurementCorrection)listViewEx.SelectedItems[0].Tag;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
if (selected.Id != 0) toBeRemoved.Add(selected);
|
|
|
|
|
|
MeterEntity.Corrections.RemoveAt(removeItemNr);
|
2018-01-24 13:16:38 +00:00
|
|
|
|
RefreshAll(rangeIx);
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
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))
|
|
|
|
|
|
{
|
2018-04-10 14:10:44 +00:00
|
|
|
|
double corrected = Config.Formulas.CorrectedValue(measured, meterEntity.Corrections);
|
2014-07-28 07:54:35 +00:00
|
|
|
|
correctedTextBox.Text = corrected.ToString();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2017-05-25 08:39:15 +00:00
|
|
|
|
|
2017-05-25 14:33:44 +00:00
|
|
|
|
public string GetWarningsBeforeSaving(ref Dictionary<string, string> renmInfo)
|
2017-05-25 08:39:15 +00:00
|
|
|
|
{
|
|
|
|
|
|
return string.Empty;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-05-25 14:33:44 +00:00
|
|
|
|
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
|
2017-05-25 08:39:15 +00:00
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|