/// /// Copyright (c) 2013-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.Metrology { public partial class MetrologyDlgBuoyancyTab : UserControl, IMetrologyDlgTab { static readonly ILog log = LogManager.GetLogger(typeof(MetrologyDlgBuoyancyTab)); /// /// Component entity that has a list of 'measurement-correction' pairs /// to be updated in the database on OK. /// public Component MeterEntity { get { return meterEntity; } set { meterEntity = value; } } Component meterEntity; /// /// Buoyancy configuration /// public BenchControl.DataContainers.Buoyancy.ComponentCfg BuoyancyCfg; /// /// A list of 'measurement-correction' pairs to be deleted from the database on OK. /// public IList ToBeRemoved { get { return toBeRemoved; } set { toBeRemoved = value; } } IList toBeRemoved; MetrologyDlg parent; bool unlocked; public MetrologyDlgBuoyancyTab() { InitializeComponent(); toBeRemoved = new List(); unlocked = false; } private void MetrologyDlgBuoyancyTab_Load(object sender, System.EventArgs e) { if (meterEntity == null) return; parent = ParentForm as MetrologyDlg; /// 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); 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 renmInfo) { return string.Empty; } public void UpdateRelatedItems(Dictionary renameInfo) { } } }