Files
tbf/TBF/UI/Bench/Uncertainties/UncertntDlgBuoyancyTab.cs
T

133 lines
2.9 KiB
C#

///
/// 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)
{
}
}
}