2019-09-18 07:09:00 +00:00
|
|
|
|
///
|
2023-10-17 13:50:12 +00:00
|
|
|
|
/// Copyright (c) 2013-2023 Senus Slovensko a.s.
|
2019-09-18 07:09:00 +00:00
|
|
|
|
///
|
|
|
|
|
|
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));
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Component entity that has a list of 'measurement-correction' pairs
|
|
|
|
|
|
/// to be updated in the database on OK.
|
|
|
|
|
|
/// </summary>
|
2021-08-26 10:32:58 +00:00
|
|
|
|
public Component MeterEntity { get; set; }
|
2019-09-18 07:09:00 +00:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Buoyancy configuration
|
|
|
|
|
|
/// </summary>
|
2021-10-26 09:23:57 +00:00
|
|
|
|
public Rig.DataContainers.Buoyancy.ComponentCfg BuoyancyCfg;
|
2019-09-18 07:09:00 +00:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// A list of 'measurement-correction' pairs to be deleted from the database on OK.
|
|
|
|
|
|
/// </summary>
|
2021-08-26 10:32:58 +00:00
|
|
|
|
public IList<MeasurementCorrection> ToBeRemoved { get; set; }
|
2019-09-18 07:09:00 +00:00
|
|
|
|
|
|
|
|
|
|
MetrologyDlg parent;
|
2021-08-26 10:32:58 +00:00
|
|
|
|
bool valuesModified;
|
2019-09-18 07:09:00 +00:00
|
|
|
|
|
|
|
|
|
|
public MetrologyDlgBuoyancyTab()
|
|
|
|
|
|
{
|
|
|
|
|
|
InitializeComponent();
|
2021-08-26 10:32:58 +00:00
|
|
|
|
ToBeRemoved = new List<MeasurementCorrection>();
|
|
|
|
|
|
valuesModified = false;
|
2019-09-18 07:09:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void MetrologyDlgBuoyancyTab_Load(object sender, System.EventArgs e)
|
|
|
|
|
|
{
|
2021-08-26 10:32:58 +00:00
|
|
|
|
if (MeterEntity == null) return;
|
2019-09-18 07:09:00 +00:00
|
|
|
|
|
|
|
|
|
|
parent = ParentForm as MetrologyDlg;
|
|
|
|
|
|
|
|
|
|
|
|
/// Panel1
|
|
|
|
|
|
buoyancyLabel.Text = "Buoyancy";
|
|
|
|
|
|
|
|
|
|
|
|
/// Panel2
|
|
|
|
|
|
|
|
|
|
|
|
RefreshAll();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void RefreshAll()
|
|
|
|
|
|
{
|
2021-08-26 10:32:58 +00:00
|
|
|
|
buoyancyTextBox.Text = BuoyancyCfg.Buoyancy.ToString();
|
2019-09-18 07:09:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Unlock()
|
|
|
|
|
|
{
|
|
|
|
|
|
buoyancyTextBox.Enabled = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void OkBtnClicked()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (BuoyancyCfg != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
2021-08-26 10:32:58 +00:00
|
|
|
|
if (valuesModified)
|
|
|
|
|
|
{
|
|
|
|
|
|
Config.Data.Buoyancy = BuoyancyCfg.Buoyancy = Utils.ParseUDouble(buoyancyTextBox.Text);
|
|
|
|
|
|
}
|
2019-09-18 07:09:00 +00:00
|
|
|
|
|
|
|
|
|
|
Component modified = BuoyancyCfg.CreateDbEntity();
|
|
|
|
|
|
MeterEntity.Parameters = modified.Parameters;
|
|
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
MessageBox.Show(Strings.Invalid_buoyancy_parameter_Correct_pls,
|
|
|
|
|
|
Strings.Error,
|
|
|
|
|
|
MessageBoxButtons.OK,
|
|
|
|
|
|
MessageBoxIcon.Exclamation);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-08-26 10:32:58 +00:00
|
|
|
|
public void CancelBtnClicked() { }
|
|
|
|
|
|
public void AddOne() { }
|
|
|
|
|
|
public void RemoveSelected() { }
|
|
|
|
|
|
public void MoveUpSelected() { }
|
|
|
|
|
|
public void MoveDownSelected() { }
|
2019-09-18 07:09:00 +00:00
|
|
|
|
|
|
|
|
|
|
public string GetWarningsBeforeSaving(ref Dictionary<string, string> renmInfo)
|
|
|
|
|
|
{
|
|
|
|
|
|
return string.Empty;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
2021-02-08 09:06:25 +00:00
|
|
|
|
|
2021-08-26 10:32:58 +00:00
|
|
|
|
private void buoyancyTextBox_TextChanged(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
valuesModified = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-02-08 09:06:25 +00:00
|
|
|
|
public void SaveEntityToDB(NHibernate.ISession session)
|
|
|
|
|
|
{
|
|
|
|
|
|
session.SaveOrUpdate(MeterEntity);
|
|
|
|
|
|
}
|
2019-09-18 07:09:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|