TBF.UI.Bench.Uncertainties : Modifications, 3 tab pages completed, 2 in preparation.

This commit is contained in:
Milan Hanajik
2019-09-18 18:49:11 +02:00
parent 74f8c44783
commit 90b760075c
22 changed files with 2549 additions and 120 deletions
+36
View File
@@ -1356,6 +1356,15 @@ namespace TBF.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Drift per year.
/// </summary>
internal static string Drift_per_year {
get {
return ResourceManager.GetString("Drift_per_year", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Leak duration [s]. /// Looks up a localized string similar to Leak duration [s].
/// </summary> /// </summary>
@@ -2319,6 +2328,15 @@ namespace TBF.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Main uncertainty.
/// </summary>
internal static string Main_uncertainty {
get {
return ResourceManager.GetString("Main_uncertainty", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Main Water Meter. /// Looks up a localized string similar to Main Water Meter.
/// </summary> /// </summary>
@@ -4092,6 +4110,15 @@ namespace TBF.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Resolution.
/// </summary>
internal static string Resolution {
get {
return ResourceManager.GetString("Resolution", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to You must restart to apply these changes. /// Looks up a localized string similar to You must restart to apply these changes.
/// </summary> /// </summary>
@@ -5517,6 +5544,15 @@ namespace TBF.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Uncertainty of correction.
/// </summary>
internal static string Uncertainty_of_correction {
get {
return ResourceManager.GetString("Uncertainty_of_correction", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Uncertainty [%]. /// Looks up a localized string similar to Uncertainty [%].
/// </summary> /// </summary>
+12
View File
@@ -1488,4 +1488,16 @@
<data name="Program_must_be_closed" xml:space="preserve"> <data name="Program_must_be_closed" xml:space="preserve">
<value>Program musí být uzavřen.</value> <value>Program musí být uzavřen.</value>
</data> </data>
<data name="Drift_per_year" xml:space="preserve">
<value>Drift za rok</value>
</data>
<data name="Main_uncertainty" xml:space="preserve">
<value>Hlavní neurčitost</value>
</data>
<data name="Resolution" xml:space="preserve">
<value>Rozlišení</value>
</data>
<data name="Uncertainty_of_correction" xml:space="preserve">
<value>Neurčitost korekce</value>
</data>
</root> </root>
+12
View File
@@ -2065,4 +2065,16 @@
<data name="Invalid_density_parameter_Correct_pls" xml:space="preserve"> <data name="Invalid_density_parameter_Correct_pls" xml:space="preserve">
<value>Invalid density parameters.\r\nCorrect them please.</value> <value>Invalid density parameters.\r\nCorrect them please.</value>
</data> </data>
<data name="Drift_per_year" xml:space="preserve">
<value>Drift per year</value>
</data>
<data name="Main_uncertainty" xml:space="preserve">
<value>Main uncertainty</value>
</data>
<data name="Resolution" xml:space="preserve">
<value>Resolution</value>
</data>
<data name="Uncertainty_of_correction" xml:space="preserve">
<value>Uncertainty of correction</value>
</data>
</root> </root>
+46
View File
@@ -2089,6 +2089,37 @@
<Compile Include="UI\Bench\Transitions\VirtualBenchStepsCtrl.cs"> <Compile Include="UI\Bench\Transitions\VirtualBenchStepsCtrl.cs">
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>
<Compile Include="UI\Bench\Uncertainties\IUncetaintiesDlgTab.cs" />
<Compile Include="UI\Bench\Uncertainties\UncertntDlgBuoyancyTab.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UI\Bench\Uncertainties\UncertntDlgBuoyancyTab.designer.cs">
<DependentUpon>UncertntDlgBuoyancyTab.cs</DependentUpon>
</Compile>
<Compile Include="UI\Bench\Uncertainties\UncertntDlgDensityTab.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UI\Bench\Uncertainties\UncertntDlgDensityTab.designer.cs">
<DependentUpon>UncertntDlgDensityTab.cs</DependentUpon>
</Compile>
<Compile Include="UI\Bench\Uncertainties\UncertntDlgScaleTab.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UI\Bench\Uncertainties\UncertntDlgScaleTab.designer.cs">
<DependentUpon>UncertntDlgScaleTab.cs</DependentUpon>
</Compile>
<Compile Include="UI\Bench\Uncertainties\UncertntDlgPressMeterTab.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UI\Bench\Uncertainties\UncertntDlgPressMeterTab.designer.cs">
<DependentUpon>UncertntDlgPressMeterTab.cs</DependentUpon>
</Compile>
<Compile Include="UI\Bench\Uncertainties\UncertntDlgTempMeterTab.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UI\Bench\Uncertainties\UncertntDlgTempMeterTab.designer.cs">
<DependentUpon>UncertntDlgTempMeterTab.cs</DependentUpon>
</Compile>
<Compile Include="UI\Bench\Uncertainties\UncertaintiesDlg.cs"> <Compile Include="UI\Bench\Uncertainties\UncertaintiesDlg.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
@@ -3063,6 +3094,21 @@
<EmbeddedResource Include="UI\Bench\Transitions\TransitionsDlg.resx"> <EmbeddedResource Include="UI\Bench\Transitions\TransitionsDlg.resx">
<DependentUpon>TransitionsDlg.cs</DependentUpon> <DependentUpon>TransitionsDlg.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="UI\Bench\Uncertainties\UncertntDlgBuoyancyTab.resx">
<DependentUpon>UncertntDlgBuoyancyTab.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Bench\Uncertainties\UncertntDlgDensityTab.resx">
<DependentUpon>UncertntDlgDensityTab.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Bench\Uncertainties\UncertntDlgScaleTab.resx">
<DependentUpon>UncertntDlgScaleTab.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Bench\Uncertainties\UncertntDlgPressMeterTab.resx">
<DependentUpon>UncertntDlgPressMeterTab.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Bench\Uncertainties\UncertntDlgTempMeterTab.resx">
<DependentUpon>UncertntDlgTempMeterTab.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Bench\Uncertainties\UncertaintiesDlg.resx"> <EmbeddedResource Include="UI\Bench\Uncertainties\UncertaintiesDlg.resx">
<DependentUpon>UncertaintiesDlg.cs</DependentUpon> <DependentUpon>UncertaintiesDlg.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
@@ -0,0 +1,22 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System.Collections.Generic;
using Config.Entities;
namespace TBF.UI.Bench.Uncertainties
{
interface IUncetaintiesDlgTab : TBF.UI.Shared.ITabWithListViewEx
{
/// <summary>
/// Component entity that has a list of 'measurement-correction' pairs
/// to be updated in the database on OK.
/// </summary>
Component MeterEntity { get; set; }
/// <summary>
/// A list of 'measurement-correction' pairs to be deleted from the database on OK.
/// </summary>
IList<Uncertainty> ToBeRemoved { get; set; }
}
}
+108 -105
View File
@@ -10,7 +10,6 @@ using Config.Entities;
using TBF.BenchControl; using TBF.BenchControl;
using TBF.Resources; using TBF.Resources;
using TBF.UI.Shared; using TBF.UI.Shared;
using TBF.UI.Bench.Metrology; /// TODO: Remove
namespace TBF.UI.Bench.Uncertainties namespace TBF.UI.Bench.Uncertainties
{ {
@@ -40,7 +39,7 @@ namespace TBF.UI.Bench.Uncertainties
sharedButtons.RemoveClicked += removeButton_Click; sharedButtons.RemoveClicked += removeButton_Click;
} }
private void MetrologyDlg_Load(object sender, EventArgs e) private void UncertaintiesDlg_Load(object sender, EventArgs e)
{ {
LoadUISettings(); LoadUISettings();
@@ -53,7 +52,6 @@ namespace TBF.UI.Bench.Uncertainties
int flowMetersCount = 0; int flowMetersCount = 0;
int pressMetersCount = 0; int pressMetersCount = 0;
int tempMetersCount = 0; int tempMetersCount = 0;
int platinumTempMetersCount = 0;
int evaporationsCount = 0; int evaporationsCount = 0;
session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config); session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config);
@@ -61,19 +59,38 @@ namespace TBF.UI.Bench.Uncertainties
.OrderBy(x => x. ItemNr).Asc .OrderBy(x => x. ItemNr).Asc
.List(); .List();
// Density tab-page
fixedCount++;
TabPage dstyTabPage = new TabPage(" " + Strings.Density + " ");
MetrologyDlgDensityTab uiCtl = new MetrologyDlgDensityTab();
uiCtl.Dock = DockStyle.Fill;
dstyTabPage.Tag = uiCtl;
dstyTabPage.Controls.Add(uiCtl);
metrologyTabControl.TabPages.Add(dstyTabPage);
foreach (var cmpnt in cmpntEntities) foreach (var cmpnt in cmpntEntities)
{ {
BenchControl.Generic.IComponentFactory factory = TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName); BenchControl.Generic.IComponentFactory factory = TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName);
/// Tab-page density
if (factory is BenchControl.DataContainers.Density.ComponentFactory)
{
fixedCount++;
TabPage tabPage = new TabPage(" " + Strings.Density + " ");
UncertntDlgDensityTab uiControl = new UncertntDlgDensityTab();
uiControl.MeterEntity = cmpnt;
uiControl.DensityCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.DataContainers.Density.ComponentCfg;
uiControl.Dock = DockStyle.Fill;
tabPage.Tag = uiControl;
tabPage.Controls.Add(uiControl);
uncertaintiesTabControl.TabPages.Add(tabPage);
}
/// Tab-page buoyancy
if (factory is BenchControl.DataContainers.Buoyancy.ComponentFactory)
{
fixedCount++;
TabPage tabPage = new TabPage(" Buoyancy ");
UncertntDlgBuoyancyTab uiControl = new UncertntDlgBuoyancyTab();
uiControl.MeterEntity = cmpnt;
uiControl.BuoyancyCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.DataContainers.Buoyancy.ComponentCfg;
uiControl.Dock = DockStyle.Fill;
tabPage.Tag = uiControl;
tabPage.Controls.Add(uiControl);
uncertaintiesTabControl.TabPages.Add(tabPage);
}
/// Tab-pages for scales /// Tab-pages for scales
if (factory is BenchControl.MettlerToledo.Standard.BalanceFactory || if (factory is BenchControl.MettlerToledo.Standard.BalanceFactory ||
factory is BenchControl.MettlerToledo.Standard.BalanceOldFactory || factory is BenchControl.MettlerToledo.Standard.BalanceOldFactory ||
@@ -82,36 +99,36 @@ namespace TBF.UI.Bench.Uncertainties
{ {
balancesCount++; balancesCount++;
TabPage tabPage = new TabPage(" " + cmpnt.Name + " "); TabPage tabPage = new TabPage(" " + cmpnt.Name + " ");
MetrologyDlgBalanceTab uiControl = new MetrologyDlgBalanceTab(); UncertntDlgScaleTab uiControl = new UncertntDlgScaleTab();
uiControl.MeterEntity = cmpnt; uiControl.MeterEntity = cmpnt;
uiControl.BalanceCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.GenericDevices.IScaleCfg; uiControl.ScaleCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.GenericDevices.IScaleCfg;
uiControl.Dock = DockStyle.Fill; uiControl.Dock = DockStyle.Fill;
tabPage.Tag = uiControl; tabPage.Tag = uiControl;
tabPage.Controls.Add(uiControl); tabPage.Controls.Add(uiControl);
metrologyTabControl.TabPages.Add(tabPage); uncertaintiesTabControl.TabPages.Add(tabPage);
} }
/// Tab-pages for flowmeters ///// Tab-pages for flowmeters
if (factory is BenchControl.Elde.FlowMeter.FlowMeterFactory) //if (factory is BenchControl.Elde.FlowMeter.FlowMeterFactory)
{ //{
BenchControl.Elde.FlowMeter.FlowMeterCfg flowMeterCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.Elde.FlowMeter.FlowMeterCfg; // BenchControl.Elde.FlowMeter.FlowMeterCfg flowMeterCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.Elde.FlowMeter.FlowMeterCfg;
for (int r = 0; r <= 5; r++) // for (int r = 0; r <= 5; r++)
{ // {
if (flowMeterCfg.RangeEnabled(r)) // if (flowMeterCfg.RangeEnabled(r))
{ // {
flowMetersCount++; // flowMetersCount++;
TabPage tabPage = new TabPage(string.Format(((r == 0) ? " {0} " : " {0} r{1} "), cmpnt.Name, r)); // TabPage tabPage = new TabPage(string.Format(((r == 0) ? " {0} " : " {0} r{1} "), cmpnt.Name, r));
MetrologyDlgFlowMeterTab uiControl = new MetrologyDlgFlowMeterTab(r); // MetrologyDlgFlowMeterTab uiControl = new MetrologyDlgFlowMeterTab(r);
uiControl.MeterEntity = cmpnt; // uiControl.MeterEntity = cmpnt;
uiControl.CalibInfoCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.GenericDevices.ICalibRangesCfg; // uiControl.CalibInfoCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.GenericDevices.ICalibRangesCfg;
uiControl.Dock = DockStyle.Fill; // uiControl.Dock = DockStyle.Fill;
tabPage.Tag = uiControl; // tabPage.Tag = uiControl;
tabPage.Controls.Add(uiControl); // tabPage.Controls.Add(uiControl);
metrologyTabControl.TabPages.Add(tabPage); // metrologyTabControl.TabPages.Add(tabPage);
} // }
} // }
} //}
/// Tab-pages for pressure meters /// Tab-pages for pressure meters
if (factory is BenchControl.Elde.PressureMeter.PressureMeterFactory || if (factory is BenchControl.Elde.PressureMeter.PressureMeterFactory ||
@@ -120,91 +137,78 @@ namespace TBF.UI.Bench.Uncertainties
{ {
pressMetersCount++; pressMetersCount++;
TabPage tabPage = new TabPage(" " + cmpnt.Name + " "); TabPage tabPage = new TabPage(" " + cmpnt.Name + " ");
MetrologyDlgPressMeterTab uiControl = new MetrologyDlgPressMeterTab(); UncertntDlgPressMeterTab uiControl = new UncertntDlgPressMeterTab();
uiControl.MeterEntity = cmpnt; uiControl.MeterEntity = cmpnt;
uiControl.Dock = DockStyle.Fill; uiControl.Dock = DockStyle.Fill;
tabPage.Tag = uiControl; tabPage.Tag = uiControl;
tabPage.Controls.Add(uiControl); tabPage.Controls.Add(uiControl);
metrologyTabControl.TabPages.Add(tabPage); uncertaintiesTabControl.TabPages.Add(tabPage);
} }
/// Tab-pages for temperature meters /// Tab-pages for temperature meters (incl. platinum temp. meter with Keithley)
if (factory is BenchControl.Elde.TempMeter.TempMeterFactory || if (factory is BenchControl.Elde.TempMeter.TempMeterFactory ||
factory is BenchControl.Elde.TempMeterInternal.TempMeterFactory) factory is BenchControl.Elde.TempMeterInternal.TempMeterFactory ||
factory is BenchControl.Keithley.TempMeter.Factory)
{ {
tempMetersCount++; tempMetersCount++;
TabPage tabPage = new TabPage(" " + cmpnt.Name + " "); TabPage tabPage = new TabPage(" " + cmpnt.Name + " ");
MetrologyDlgTempMeterTab uiControl = new MetrologyDlgTempMeterTab(); UncertntDlgTempMeterTab uiControl = new UncertntDlgTempMeterTab();
uiControl.MeterEntity = cmpnt; uiControl.MeterEntity = cmpnt;
uiControl.Dock = DockStyle.Fill; uiControl.Dock = DockStyle.Fill;
tabPage.Tag = uiControl; tabPage.Tag = uiControl;
tabPage.Controls.Add(uiControl); tabPage.Controls.Add(uiControl);
metrologyTabControl.TabPages.Add(tabPage); uncertaintiesTabControl.TabPages.Add(tabPage);
} }
/// Tab-pages for platinum resistance temperature meters ///// Tab-pages for diverters
if (factory is BenchControl.Keithley.TempMeter.Factory) //if (factory is BenchControl.Elde.Diverter.DiverterFactory)
{ //{
platinumTempMetersCount++; // divertersCount++;
TabPage tabPage = new TabPage(" " + cmpnt.Name + " "); // TabPage tabPage = new TabPage(" " + cmpnt.Name + " ");
MetrologyDlgPlatinumResistanceTMeterTab uiControl = new MetrologyDlgPlatinumResistanceTMeterTab(); // MetrologyDlgDiverterTab uiControl = new MetrologyDlgDiverterTab();
uiControl.MeterEntity = cmpnt; // uiControl.MeterEntity = cmpnt;
uiControl.TempMeterCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.Keithley.TempMeter.TempMeterCfg; // uiControl.CalibInfoCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.GenericDevices.ICalibInfoCfg;
uiControl.Dock = DockStyle.Fill; // uiControl.Dock = DockStyle.Fill;
tabPage.Tag = uiControl; // tabPage.Tag = uiControl;
tabPage.Controls.Add(uiControl); // tabPage.Controls.Add(uiControl);
metrologyTabControl.TabPages.Add(tabPage); // metrologyTabControl.TabPages.Add(tabPage);
} //}
/// Tab-pages for diverters ///// Tab-pages for level meters inside water tanks
if (factory is BenchControl.Elde.Diverter.DiverterFactory) //if (factory is BenchControl.Hart.Nivotrack.Factory)
{ //{
divertersCount++; // levelMetersCount++;
TabPage tabPage = new TabPage(" " + cmpnt.Name + " "); // TabPage tabPage = new TabPage(" " + cmpnt.Name + " ");
MetrologyDlgDiverterTab uiControl = new MetrologyDlgDiverterTab(); // MetrologyDlgLevelMeterTab uiControl = new MetrologyDlgLevelMeterTab();
uiControl.MeterEntity = cmpnt; // uiControl.MeterEntity = cmpnt;
uiControl.CalibInfoCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.GenericDevices.ICalibInfoCfg; // uiControl.CalibInfoCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.GenericDevices.ICalibInfoCfg;
uiControl.Dock = DockStyle.Fill; // uiControl.Dock = DockStyle.Fill;
tabPage.Tag = uiControl; // tabPage.Tag = uiControl;
tabPage.Controls.Add(uiControl); // tabPage.Controls.Add(uiControl);
metrologyTabControl.TabPages.Add(tabPage); // metrologyTabControl.TabPages.Add(tabPage);
} //}
/// Tab-pages for level meters inside water tanks ///// Tab-pages for water tank evaporation rates
if (factory is BenchControl.Hart.Nivotrack.Factory) //if (factory is BenchControl.Various.Evaporation.Factory)
{ //{
levelMetersCount++; // evaporationsCount++;
TabPage tabPage = new TabPage(" " + cmpnt.Name + " "); // TabPage tabPage = new TabPage(" " + cmpnt.Name + " ");
MetrologyDlgLevelMeterTab uiControl = new MetrologyDlgLevelMeterTab(); // MetrologyDlgEvaporationTab uiControl = new MetrologyDlgEvaporationTab();
uiControl.MeterEntity = cmpnt; // uiControl.MeterEntity = cmpnt;
uiControl.CalibInfoCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.GenericDevices.ICalibInfoCfg; // uiControl.CalibInfoCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.GenericDevices.ICalibInfoCfg;
uiControl.Dock = DockStyle.Fill; // uiControl.Dock = DockStyle.Fill;
tabPage.Tag = uiControl; // tabPage.Tag = uiControl;
tabPage.Controls.Add(uiControl); // tabPage.Controls.Add(uiControl);
metrologyTabControl.TabPages.Add(tabPage); // metrologyTabControl.TabPages.Add(tabPage);
} //}
/// Tab-pages for water tank evaporation rates
if (factory is BenchControl.Various.Evaporation.Factory)
{
evaporationsCount++;
TabPage tabPage = new TabPage(" " + cmpnt.Name + " ");
MetrologyDlgEvaporationTab uiControl = new MetrologyDlgEvaporationTab();
uiControl.MeterEntity = cmpnt;
uiControl.CalibInfoCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.GenericDevices.ICalibInfoCfg;
uiControl.Dock = DockStyle.Fill;
tabPage.Tag = uiControl;
tabPage.Controls.Add(uiControl);
metrologyTabControl.TabPages.Add(tabPage);
}
} }
} }
private void unlockButton_Click(object sender, EventArgs e) private void unlockButton_Click(object sender, EventArgs e)
{ {
foreach (TabPage tabPage in metrologyTabControl.TabPages) foreach (TabPage tabPage in uncertaintiesTabControl.TabPages)
{ {
(tabPage.Tag as IMetrologyDlgTab).Unlock(); (tabPage.Tag as IUncetaintiesDlgTab).Unlock();
} }
} }
@@ -214,13 +218,12 @@ namespace TBF.UI.Bench.Uncertainties
{ {
try try
{ {
foreach (TabPage tabPage in metrologyTabControl.TabPages) foreach (TabPage tabPage in uncertaintiesTabControl.TabPages)
{ {
IMetrologyDlgTab tab = tabPage.Tag as IMetrologyDlgTab; IUncetaintiesDlgTab tab = tabPage.Tag as IUncetaintiesDlgTab;
tab.OkBtnClicked(); if (tab != null)
if (!(tabPage.Tag is MetrologyDlgDensityTab))
{ {
tab.OkBtnClicked();
session.SaveOrUpdate(tab.MeterEntity); session.SaveOrUpdate(tab.MeterEntity);
foreach (var entity in tab.ToBeRemoved) session.Delete(entity); foreach (var entity in tab.ToBeRemoved) session.Delete(entity);
} }
@@ -243,9 +246,9 @@ namespace TBF.UI.Bench.Uncertainties
private void cancelButton_Click(object sender, EventArgs e) private void cancelButton_Click(object sender, EventArgs e)
{ {
foreach (TabPage tabPage in metrologyTabControl.TabPages) foreach (TabPage tabPage in uncertaintiesTabControl.TabPages)
{ {
(tabPage.Tag as IMetrologyDlgTab).CancelBtnClicked(); (tabPage.Tag as IUncetaintiesDlgTab).CancelBtnClicked();
} }
SaveUISettings(); SaveUISettings();
@@ -292,12 +295,12 @@ namespace TBF.UI.Bench.Uncertainties
private void addButton_Click(object sender, EventArgs e) private void addButton_Click(object sender, EventArgs e)
{ {
(metrologyTabControl.SelectedTab.Tag as IMetrologyDlgTab).AddOne(); (uncertaintiesTabControl.SelectedTab.Tag as IUncetaintiesDlgTab).AddOne();
} }
private void removeButton_Click(object sender, EventArgs e) private void removeButton_Click(object sender, EventArgs e)
{ {
(metrologyTabControl.SelectedTab.Tag as IMetrologyDlgTab).RemoveSelected(); (uncertaintiesTabControl.SelectedTab.Tag as IUncetaintiesDlgTab).RemoveSelected();
} }
public void UpdateButtonStates(SharedButtons.SelectedItemPos selectedItemPos) public void UpdateButtonStates(SharedButtons.SelectedItemPos selectedItemPos)
+15 -15
View File
@@ -32,7 +32,7 @@ namespace TBF.UI.Bench.Uncertainties
private void InitializeComponent() private void InitializeComponent()
{ {
this.splitContainer = new System.Windows.Forms.SplitContainer(); this.splitContainer = new System.Windows.Forms.SplitContainer();
this.metrologyTabControl = new System.Windows.Forms.TabControl(); this.uncertaintiesTabControl = new System.Windows.Forms.TabControl();
this.sharedButtons = new TBF.UI.Shared.SharedButtons(); this.sharedButtons = new TBF.UI.Shared.SharedButtons();
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
this.splitContainer.Panel1.SuspendLayout(); this.splitContainer.Panel1.SuspendLayout();
@@ -49,7 +49,7 @@ namespace TBF.UI.Bench.Uncertainties
// //
// splitContainer.Panel1 // splitContainer.Panel1
// //
this.splitContainer.Panel1.Controls.Add(this.metrologyTabControl); this.splitContainer.Panel1.Controls.Add(this.uncertaintiesTabControl);
// //
// splitContainer.Panel2 // splitContainer.Panel2
// //
@@ -58,16 +58,16 @@ namespace TBF.UI.Bench.Uncertainties
this.splitContainer.SplitterDistance = 863; this.splitContainer.SplitterDistance = 863;
this.splitContainer.TabIndex = 0; this.splitContainer.TabIndex = 0;
// //
// metrologyTabControl // uncertaintiesTabControl
// //
this.metrologyTabControl.Dock = System.Windows.Forms.DockStyle.Fill; this.uncertaintiesTabControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.metrologyTabControl.ItemSize = new System.Drawing.Size(60, 30); this.uncertaintiesTabControl.ItemSize = new System.Drawing.Size(60, 30);
this.metrologyTabControl.Location = new System.Drawing.Point(0, 0); this.uncertaintiesTabControl.Location = new System.Drawing.Point(0, 0);
this.metrologyTabControl.Name = "metrologyTabControl"; this.uncertaintiesTabControl.Name = "uncertaintiesTabControl";
this.metrologyTabControl.SelectedIndex = 0; this.uncertaintiesTabControl.SelectedIndex = 0;
this.metrologyTabControl.Size = new System.Drawing.Size(863, 344); this.uncertaintiesTabControl.Size = new System.Drawing.Size(863, 344);
this.metrologyTabControl.TabIndex = 0; this.uncertaintiesTabControl.TabIndex = 0;
this.metrologyTabControl.SelectedIndexChanged += new System.EventHandler(this.metrologyTabControl_SelectedIndexChanged); this.uncertaintiesTabControl.SelectedIndexChanged += new System.EventHandler(this.metrologyTabControl_SelectedIndexChanged);
// //
// sharedButtons // sharedButtons
// //
@@ -76,16 +76,16 @@ namespace TBF.UI.Bench.Uncertainties
this.sharedButtons.Size = new System.Drawing.Size(100, 400); this.sharedButtons.Size = new System.Drawing.Size(100, 400);
this.sharedButtons.TabIndex = 0; this.sharedButtons.TabIndex = 0;
// //
// UncertaintyDlg // UncertaintiesDlg
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(965, 344); this.ClientSize = new System.Drawing.Size(965, 344);
this.Controls.Add(this.splitContainer); this.Controls.Add(this.splitContainer);
this.Name = "UncertaintyDlg"; this.Name = "UncertaintiesDlg";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Uncertainty"; this.Text = "Uncertainty";
this.Load += new System.EventHandler(this.MetrologyDlg_Load); this.Load += new System.EventHandler(this.UncertaintiesDlg_Load);
this.splitContainer.Panel1.ResumeLayout(false); this.splitContainer.Panel1.ResumeLayout(false);
this.splitContainer.Panel2.ResumeLayout(false); this.splitContainer.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
@@ -97,7 +97,7 @@ namespace TBF.UI.Bench.Uncertainties
#endregion #endregion
private System.Windows.Forms.SplitContainer splitContainer; private System.Windows.Forms.SplitContainer splitContainer;
private System.Windows.Forms.TabControl metrologyTabControl; private System.Windows.Forms.TabControl uncertaintiesTabControl;
private TBF.UI.Shared.SharedButtons sharedButtons; private TBF.UI.Shared.SharedButtons sharedButtons;
} }
} }
@@ -0,0 +1,132 @@
///
/// 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)
{
}
}
}
@@ -0,0 +1,97 @@
///
/// Copyright (c) 2019 Senus Slovensko a.s.
///
namespace TBF.UI.Bench.Uncertainties
{
partial class UncertntDlgBuoyancyTab
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.buoyancyTextBox = new System.Windows.Forms.TextBox();
this.buoyancyLabel = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.buoyancyTextBox);
this.splitContainer1.Panel1.Controls.Add(this.buoyancyLabel);
this.splitContainer1.Size = new System.Drawing.Size(420, 300);
this.splitContainer1.SplitterDistance = 120;
this.splitContainer1.TabIndex = 1;
//
// buoyancyTextBox
//
this.buoyancyTextBox.Enabled = false;
this.buoyancyTextBox.Location = new System.Drawing.Point(189, 51);
this.buoyancyTextBox.Name = "buoyancyTextBox";
this.buoyancyTextBox.Size = new System.Drawing.Size(110, 20);
this.buoyancyTextBox.TabIndex = 1;
//
// buoyancyLabel
//
this.buoyancyLabel.AutoSize = true;
this.buoyancyLabel.Location = new System.Drawing.Point(41, 54);
this.buoyancyLabel.Name = "buoyancyLabel";
this.buoyancyLabel.Size = new System.Drawing.Size(54, 13);
this.buoyancyLabel.TabIndex = 0;
this.buoyancyLabel.Text = "Buoyancy";
//
// MetrologyDlgBuoyancyTab
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.splitContainer1);
this.Name = "MetrologyDlgBuoyancyTab";
this.Size = new System.Drawing.Size(420, 300);
this.Load += new System.EventHandler(this.MetrologyDlgBuoyancyTab_Load);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.TextBox buoyancyTextBox;
private System.Windows.Forms.Label buoyancyLabel;
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,162 @@
///
/// 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 UncertntDlgDensityTab : UserControl, IUncetaintiesDlgTab
{
static readonly ILog log = LogManager.GetLogger(typeof(UncertntDlgDensityTab));
/// <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>
/// Density configuration
/// </summary>
public BenchControl.DataContainers.Density.ComponentCfg DensityCfg;
/// <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 UncertntDlgDensityTab()
{
InitializeComponent();
toBeRemoved = new List<Uncertainty>();
unlocked = false;
}
private void MetrologyDlgDensityTab_Load(object sender, System.EventArgs e)
{
if (meterEntity == null) return;
parent = ParentForm as UncertaintiesDlg;
/// Panel1
densityLabel.Text = string.Format("{0} [{1}]", Strings.Density, Config.Unit.kgpm3.ToDescription());
temperatureLabel.Text = string.Format("{0} [{1}]", Strings.At_temperature, Config.Unit.C.ToDescription());
densityCorrLabel.Text = string.Format("{0} [{1}]", Strings.Density_correction, Config.Unit.kgpm3.ToDescription());
/// Panel2
RefreshAll();
}
void RefreshAll()
{
densityTextBox.Text = Config.Data.RealDensity.ToString("F4");
temperatureTextBox.Text = Config.Data.AtTemperature.ToString("F2");
densityCorrTextBox.Text = Config.Formulas.DensityCorrection(Config.Data.RealDensity, Config.Data.AtTemperature).ToString("F5");
}
public void Unlock()
{
unlocked = true;
densityTextBox.Enabled = true;
temperatureTextBox.Enabled = true;
}
public void OkBtnClicked()
{
if (DensityCfg != null)
{
try
{
double realDensity = Utils.ParseUDouble(densityTextBox.Text);
double atTemperature = Utils.ParseUDouble(temperatureTextBox.Text);
global::Results.WMeterRsltItemSpec.RealDensity =
Config.Data.RealDensity = DensityCfg.RealDensity = realDensity;
global::Results.WMeterRsltItemSpec.AtTemperature =
Config.Data.AtTemperature = DensityCfg.AtTemperature = atTemperature;
Component modified = DensityCfg.CreateDbEntity();
MeterEntity.Parameters = modified.Parameters;
}
catch
{
MessageBox.Show(Strings.Invalid_density_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)
{
}
private void densityTextBox_TextChanged(object sender, EventArgs e)
{
UpdateDensityCorrectionDisplay();
}
private void temperatureTextBox_TextChanged(object sender, EventArgs e)
{
UpdateDensityCorrectionDisplay();
}
void UpdateDensityCorrectionDisplay()
{
double density;
double temp;
if (Utils.TryParseUDouble(densityTextBox.Text, out density) &&
Utils.TryParseUDouble(temperatureTextBox.Text, out temp))
{
densityCorrTextBox.Text = Config.Formulas.DensityCorrection(density, temp).ToString();
}
}
}
}
@@ -0,0 +1,145 @@
///
/// Copyright (c) 2019 Senus Slovensko a.s.
///
namespace TBF.UI.Bench.Uncertainties
{
partial class UncertntDlgDensityTab
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.densityCorrTextBox = new System.Windows.Forms.TextBox();
this.densityCorrLabel = new System.Windows.Forms.Label();
this.temperatureTextBox = new System.Windows.Forms.TextBox();
this.temperatureLabel = new System.Windows.Forms.Label();
this.densityTextBox = new System.Windows.Forms.TextBox();
this.densityLabel = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.densityCorrTextBox);
this.splitContainer1.Panel1.Controls.Add(this.densityCorrLabel);
this.splitContainer1.Panel1.Controls.Add(this.temperatureTextBox);
this.splitContainer1.Panel1.Controls.Add(this.temperatureLabel);
this.splitContainer1.Panel1.Controls.Add(this.densityTextBox);
this.splitContainer1.Panel1.Controls.Add(this.densityLabel);
this.splitContainer1.Size = new System.Drawing.Size(420, 300);
this.splitContainer1.SplitterDistance = 120;
this.splitContainer1.TabIndex = 1;
//
// densityCorrTextBox
//
this.densityCorrTextBox.Enabled = false;
this.densityCorrTextBox.Location = new System.Drawing.Point(185, 86);
this.densityCorrTextBox.Name = "densityCorrTextBox";
this.densityCorrTextBox.Size = new System.Drawing.Size(110, 20);
this.densityCorrTextBox.TabIndex = 5;
//
// densityCorrLabel
//
this.densityCorrLabel.AutoSize = true;
this.densityCorrLabel.Location = new System.Drawing.Point(37, 89);
this.densityCorrLabel.Name = "densityCorrLabel";
this.densityCorrLabel.Size = new System.Drawing.Size(132, 13);
this.densityCorrLabel.TabIndex = 4;
this.densityCorrLabel.Text = "Density correction [kg/m3]";
//
// temperatureTextBox
//
this.temperatureTextBox.Enabled = false;
this.temperatureTextBox.Location = new System.Drawing.Point(185, 43);
this.temperatureTextBox.Name = "temperatureTextBox";
this.temperatureTextBox.Size = new System.Drawing.Size(110, 20);
this.temperatureTextBox.TabIndex = 3;
this.temperatureTextBox.TextChanged += new System.EventHandler(this.temperatureTextBox_TextChanged);
//
// temperatureLabel
//
this.temperatureLabel.AutoSize = true;
this.temperatureLabel.Location = new System.Drawing.Point(37, 46);
this.temperatureLabel.Name = "temperatureLabel";
this.temperatureLabel.Size = new System.Drawing.Size(112, 13);
this.temperatureLabel.TabIndex = 2;
this.temperatureLabel.Text = "@Temperature [degC]";
//
// densityTextBox
//
this.densityTextBox.Enabled = false;
this.densityTextBox.Location = new System.Drawing.Point(185, 17);
this.densityTextBox.Name = "densityTextBox";
this.densityTextBox.Size = new System.Drawing.Size(110, 20);
this.densityTextBox.TabIndex = 1;
this.densityTextBox.TextChanged += new System.EventHandler(this.densityTextBox_TextChanged);
//
// densityLabel
//
this.densityLabel.AutoSize = true;
this.densityLabel.Location = new System.Drawing.Point(37, 20);
this.densityLabel.Name = "densityLabel";
this.densityLabel.Size = new System.Drawing.Size(82, 13);
this.densityLabel.TabIndex = 0;
this.densityLabel.Text = "Density [kg/m3]";
//
// MetrologyDlgDensityTab
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.splitContainer1);
this.Name = "MetrologyDlgDensityTab";
this.Size = new System.Drawing.Size(420, 300);
this.Load += new System.EventHandler(this.MetrologyDlgDensityTab_Load);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.TextBox temperatureTextBox;
private System.Windows.Forms.Label temperatureLabel;
private System.Windows.Forms.TextBox densityTextBox;
private System.Windows.Forms.Label densityLabel;
private System.Windows.Forms.TextBox densityCorrTextBox;
private System.Windows.Forms.Label densityCorrLabel;
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,264 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Windows.Forms;
using log4net;
using Config.Entities;
using Results.Forms;
using TBF.Resources;
using TBF.UI.Shared;
namespace TBF.UI.Bench.Uncertainties
{
public partial class UncertntDlgPressMeterTab : UserControl, IUncetaintiesDlgTab
{
static readonly ILog log = LogManager.GetLogger(typeof(UncertntDlgPressMeterTab));
/// <summary>
/// Component entity that has a list of 'measurement-correction' pairs
/// to be updated in the database on OK.
/// </summary>
Component meterEntity;
public Component MeterEntity
{
get { return meterEntity; }
set { meterEntity = value; }
}
/// <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;
Control[] textBoxes;
public UncertntDlgPressMeterTab()
{
InitializeComponent();
toBeRemoved = new List<Uncertainty>();
}
private void UncertntDlgPressMeterTab_Load(object sender, System.EventArgs e)
{
if (meterEntity == null) return;
parent = ParentForm as UncertaintiesDlg;
/// Panel1
cmpntLabel.Text = Strings.Component;
cmpntNameLabel.Text = meterEntity.Name;
/// Panel2
listViewEx.SubItemClicked += new SubItemEventHandler(listViewEx_SubItemClicked);
listViewEx.SubItemEndEditing += new SubItemEndEditingEventHandler(listViewEx_SubItemEndEditing);
listViewEx.Columns.Add(new ColumnHeader() { Text = Strings.Nr, Width = 40 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [bar]", Strings.Pressure), Width = 100 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [mbar]", Strings.Main_uncertainty), Width = 120 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [mbar]", Strings.Resolution), Width = 100 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [mbar/year]", Strings.Drift_per_year), Width = 120 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [mbar]", Strings.Conditions), Width = 100 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [mbar]", Strings.Uncertainty_of_correction), Width = 160 });
textBoxes = new TextBox[listViewEx.Columns.Count];
for (int i = 1; i < textBoxes.Length; i++)
{
this.Controls.Add(textBoxes[i] = new TextBox());
}
RefreshAll();
}
void RefreshAll()
{
listViewEx.Items.Clear();
foreach (var uncrtnty in MeterEntity.Uncertainties) AddOneLVI(uncrtnty);
}
void AddOneLVI(Uncertainty corr)
{
int nr = listViewEx.Items.Count + 1;
ListViewItem lvi = new ListViewItem(nr.ToString());
lvi.Tag = corr;
lvi.SubItems.Add(corr.Measurement.ToString());
lvi.SubItems.Add((1000 * corr.MainUncertainty).ToString());
lvi.SubItems.Add((1000 * corr.Resolution).ToString());
lvi.SubItems.Add((1000 * corr.DriftPerYr).ToString());
lvi.SubItems.Add((1000 * corr.Conditions).ToString());
lvi.SubItems.Add((1000 * corr.UncertaintyOfCorrection).ToString());
listViewEx.Items.Add(lvi);
}
void listViewEx_SubItemClicked(object sender, SubItemEventArgs e)
{
if (unlocked && (e.SubItem >= 1) && (e.SubItem < listViewEx.Columns.Count))
{
/// This is not the first column
listViewEx.StartEditing(textBoxes[e.SubItem], e.Item, e.SubItem);
}
}
void listViewEx_SubItemEndEditing(object sender, SubItemEndEditingEventArgs e)
{
if (ParseItem(e.Item, e.SubItem, e.DisplayText)) return;
/// New value is NOK, revert the original text
e.DisplayText = e.Item.Text;
e.Cancel = true;
}
/// <summary>
/// Parse text of a ListViewItem
/// </summary>
/// <returns>true = value parsed OK</returns>
bool ParseItem(ListViewItem item, int subItem, string strValue)
{
Uncertainty uncrtnty = item.Tag as Uncertainty;
double dblValue = 0;
if ((uncrtnty != null) && Utils.TryParseEDouble(strValue, out dblValue) && (dblValue >= 0))
{
double inDefaultUnits = dblValue / 1000;
switch (subItem)
{
case 1:
uncrtnty.Measurement = (float)dblValue;
return true;
case 2:
uncrtnty.MainUncertainty = (float)inDefaultUnits;
return true;
case 3:
uncrtnty.Resolution = (float)inDefaultUnits;
return true;
case 4:
uncrtnty.DriftPerYr = (float)inDefaultUnits;
return true;
case 5:
uncrtnty.Conditions = (float)inDefaultUnits;
return true;
case 6:
uncrtnty.UncertaintyOfCorrection = (float)inDefaultUnits;
return true;
default:
return false;
}
}
else
{
return false;
}
}
public void Unlock()
{
unlocked = true;
if (listViewEx.SelectedItems.Count == 1)
{
int ix = listViewEx.SelectedIndices[0];
listViewEx.Focus();
listViewEx.Items[ix].Selected = true;
listViewEx.Items[ix].EnsureVisible();
}
}
public void OkBtnClicked()
{
}
public void CancelBtnClicked()
{
}
public void AddOne()
{
Uncertainty uncrtnty = new Uncertainty();
MeterEntity.Uncertainties.Add(uncrtnty);
AddOneLVI(uncrtnty);
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];
Uncertainty selected =
(Uncertainty)listViewEx.SelectedItems[0].Tag;
if (selected.Id != 0) toBeRemoved.Add(selected);
MeterEntity.Corrections.RemoveAt(removeItemNr);
RefreshAll();
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);
}
}
public string GetWarningsBeforeSaving(ref Dictionary<string, string> renmInfo)
{
return string.Empty;
}
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
{
}
}
}
@@ -0,0 +1,122 @@
///
/// Copyright (c) 2019 Senus Slovensko a.s.
///
namespace TBF.UI.Bench.Uncertainties
{
partial class UncertntDlgPressMeterTab
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.cmpntLabel = new System.Windows.Forms.Label();
this.cmpntNameLabel = new System.Windows.Forms.Label();
this.listViewEx = new global::Results.Forms.ListViewEx();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.cmpntLabel);
this.splitContainer1.Panel1.Controls.Add(this.cmpntNameLabel);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.listViewEx);
this.splitContainer1.Size = new System.Drawing.Size(420, 300);
this.splitContainer1.SplitterDistance = 40;
this.splitContainer1.TabIndex = 2;
//
// componentLabel
//
this.cmpntLabel.AutoSize = true;
this.cmpntLabel.Location = new System.Drawing.Point(14, 12);
this.cmpntLabel.Name = "componentLabel";
this.cmpntLabel.Size = new System.Drawing.Size(64, 13);
this.cmpntLabel.TabIndex = 1;
this.cmpntLabel.Text = "Component:";
//
// cmpntNameLabel
//
this.cmpntNameLabel.AutoSize = true;
this.cmpntNameLabel.Location = new System.Drawing.Point(97, 12);
this.cmpntNameLabel.Name = "cmpntNameLabel";
this.cmpntNameLabel.Size = new System.Drawing.Size(88, 13);
this.cmpntNameLabel.TabIndex = 0;
this.cmpntNameLabel.Text = "componentName";
//
// listViewEx
//
this.listViewEx.AllowColumnReorder = true;
this.listViewEx.Dock = System.Windows.Forms.DockStyle.Fill;
this.listViewEx.DoubleClickActivation = false;
this.listViewEx.FullRowSelect = true;
this.listViewEx.GridLines = true;
this.listViewEx.Location = new System.Drawing.Point(0, 0);
this.listViewEx.Name = "listViewEx";
this.listViewEx.Size = new System.Drawing.Size(420, 256);
this.listViewEx.TabIndex = 0;
this.listViewEx.UseCompatibleStateImageBehavior = false;
this.listViewEx.View = System.Windows.Forms.View.Details;
this.listViewEx.SelectedIndexChanged += new System.EventHandler(this.listViewEx_SelectedIndexChanged);
//
// UncertntDlgPressMeterTab
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.splitContainer1);
this.Name = "UncertntDlgPressMeterTab";
this.Size = new System.Drawing.Size(420, 300);
this.Load += new System.EventHandler(this.UncertntDlgPressMeterTab_Load);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel1.PerformLayout();
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.Label cmpntLabel;
private System.Windows.Forms.Label cmpntNameLabel;
private global::Results.Forms.ListViewEx listViewEx;
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,269 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Windows.Forms;
using log4net;
using Config.Entities;
using Results.Forms;
using TBF.Resources;
using TBF.UI.Shared;
namespace TBF.UI.Bench.Uncertainties
{
public partial class UncertntDlgScaleTab : UserControl, IUncetaintiesDlgTab
{
static readonly ILog log = LogManager.GetLogger(typeof(UncertntDlgScaleTab));
/// <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>
/// Balance configuration (with buoyancy parameters)
/// </summary>
public BenchControl.GenericDevices.IScaleCfg ScaleCfg;
/// <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;
Control[] textBoxes;
public UncertntDlgScaleTab()
{
InitializeComponent();
toBeRemoved = new List<Uncertainty>();
unlocked = false;
}
private void UncertntDlgScaleTab_Load(object sender, System.EventArgs e)
{
if (meterEntity == null) return;
parent = ParentForm as UncertaintiesDlg;
/// Panel1
cmpntLabel.Text = Strings.Component;
cmpntNameLabel.Text = meterEntity.Name;
/// Panel2
listViewEx.SubItemClicked += new SubItemEventHandler(listViewEx_SubItemClicked);
listViewEx.SubItemEndEditing += new SubItemEndEditingEventHandler(listViewEx_SubItemEndEditing);
listViewEx.Columns.Add(new ColumnHeader() { Text = Strings.Nr, Width = 40 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [kg]", Strings.Mass), Width = 100 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [g]", Strings.Main_uncertainty), Width = 120 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [g]", Strings.Resolution), Width = 100 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [g/year]", Strings.Drift_per_year), Width = 120 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [g]", Strings.Conditions), Width = 100 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [g]", Strings.Uncertainty_of_correction), Width = 160 });
textBoxes = new TextBox[listViewEx.Columns.Count];
for (int i = 1; i < textBoxes.Length; i++)
{
this.Controls.Add(textBoxes[i] = new TextBox());
}
RefreshAll();
}
void RefreshAll()
{
listViewEx.Items.Clear();
foreach (var uncrtnty in MeterEntity.Uncertainties) AddOneLVI(uncrtnty);
}
void AddOneLVI(Uncertainty corr)
{
int nr = listViewEx.Items.Count + 1;
ListViewItem lvi = new ListViewItem(nr.ToString());
lvi.Tag = corr;
lvi.SubItems.Add(corr.Measurement.ToString());
lvi.SubItems.Add((1000 * corr.MainUncertainty).ToString());
lvi.SubItems.Add((1000 * corr.Resolution).ToString());
lvi.SubItems.Add((1000 * corr.DriftPerYr).ToString());
lvi.SubItems.Add((1000 * corr.Conditions).ToString());
lvi.SubItems.Add((1000 * corr.UncertaintyOfCorrection).ToString());
listViewEx.Items.Add(lvi);
}
void listViewEx_SubItemClicked(object sender, SubItemEventArgs e)
{
if (unlocked && (e.SubItem >= 1) && (e.SubItem < listViewEx.Columns.Count))
{
/// This is not the first column
listViewEx.StartEditing(textBoxes[e.SubItem], e.Item, e.SubItem);
}
}
void listViewEx_SubItemEndEditing(object sender, SubItemEndEditingEventArgs e)
{
if (ParseItem(e.Item, e.SubItem, e.DisplayText)) return;
/// New value is NOK, revert the original text
e.DisplayText = e.Item.Text;
e.Cancel = true;
}
/// <summary>
/// Parse text of a ListViewItem
/// </summary>
/// <returns>true = value parsed OK</returns>
bool ParseItem(ListViewItem item, int subItem, string strValue)
{
Uncertainty uncrtnty = item.Tag as Uncertainty;
double dblValue = 0;
if ((uncrtnty != null) && Utils.TryParseEDouble(strValue, out dblValue) && (dblValue >= 0))
{
double inDefaultUnits = dblValue / 1000;
switch (subItem)
{
case 1:
uncrtnty.Measurement = (float)dblValue;
return true;
case 2:
uncrtnty.MainUncertainty = (float)inDefaultUnits;
return true;
case 3:
uncrtnty.Resolution = (float)inDefaultUnits;
return true;
case 4:
uncrtnty.DriftPerYr = (float)inDefaultUnits;
return true;
case 5:
uncrtnty.Conditions = (float)inDefaultUnits;
return true;
case 6:
uncrtnty.UncertaintyOfCorrection = (float)inDefaultUnits;
return true;
default:
return false;
}
}
else
{
return false;
}
}
public void Unlock()
{
unlocked = true;
if (listViewEx.SelectedItems.Count == 1)
{
int ix = listViewEx.SelectedIndices[0];
listViewEx.Focus();
listViewEx.Items[ix].Selected = true;
listViewEx.Items[ix].EnsureVisible();
}
}
public void OkBtnClicked()
{
}
public void CancelBtnClicked()
{
}
public void AddOne()
{
Uncertainty uncrtnty = new Uncertainty();
MeterEntity.Uncertainties.Add(uncrtnty);
AddOneLVI(uncrtnty);
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];
Uncertainty selected = listViewEx.SelectedItems[0].Tag as Uncertainty;
if ((selected != null) && (selected.Id != 0)) toBeRemoved.Add(selected);
MeterEntity.Uncertainties.RemoveAt(removeItemNr);
RefreshAll();
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);
}
}
public string GetWarningsBeforeSaving(ref Dictionary<string, string> renmInfo)
{
return string.Empty;
}
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
{
}
}
}
+121
View File
@@ -0,0 +1,121 @@
///
/// Copyright (c) 2019 Senus Slovensko a.s.
///
namespace TBF.UI.Bench.Uncertainties
{
partial class UncertntDlgScaleTab
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.listViewEx = new global::Results.Forms.ListViewEx();
this.cmpntLabel = new System.Windows.Forms.Label();
this.cmpntNameLabel = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.cmpntLabel);
this.splitContainer1.Panel1.Controls.Add(this.cmpntNameLabel);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.listViewEx);
this.splitContainer1.Size = new System.Drawing.Size(668, 400);
this.splitContainer1.SplitterDistance = 40;
this.splitContainer1.TabIndex = 1;
//
// listViewEx
//
this.listViewEx.AllowColumnReorder = true;
this.listViewEx.Dock = System.Windows.Forms.DockStyle.Fill;
this.listViewEx.DoubleClickActivation = false;
this.listViewEx.FullRowSelect = true;
this.listViewEx.GridLines = true;
this.listViewEx.Location = new System.Drawing.Point(0, 0);
this.listViewEx.Name = "listViewEx";
this.listViewEx.Size = new System.Drawing.Size(668, 356);
this.listViewEx.TabIndex = 0;
this.listViewEx.UseCompatibleStateImageBehavior = false;
this.listViewEx.View = System.Windows.Forms.View.Details;
this.listViewEx.SelectedIndexChanged += new System.EventHandler(this.listViewEx_SelectedIndexChanged);
//
// componentLabel
//
this.cmpntLabel.AutoSize = true;
this.cmpntLabel.Location = new System.Drawing.Point(14, 12);
this.cmpntLabel.Name = "componentLabel";
this.cmpntLabel.Size = new System.Drawing.Size(64, 13);
this.cmpntLabel.TabIndex = 3;
this.cmpntLabel.Text = "Component:";
//
// cmpntNameLabel
//
this.cmpntNameLabel.AutoSize = true;
this.cmpntNameLabel.Location = new System.Drawing.Point(97, 12);
this.cmpntNameLabel.Name = "cmpntNameLabel";
this.cmpntNameLabel.Size = new System.Drawing.Size(88, 13);
this.cmpntNameLabel.TabIndex = 2;
this.cmpntNameLabel.Text = "componentName";
//
// UncertntDlgScaleTab
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.splitContainer1);
this.Name = "UncertntDlgScaleTab";
this.Size = new System.Drawing.Size(668, 400);
this.Load += new System.EventHandler(this.UncertntDlgScaleTab_Load);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel1.PerformLayout();
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private global::Results.Forms.ListViewEx listViewEx;
private System.Windows.Forms.Label cmpntLabel;
private System.Windows.Forms.Label cmpntNameLabel;
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,264 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Windows.Forms;
using log4net;
using Config.Entities;
using Results.Forms;
using TBF.Resources;
using TBF.UI.Shared;
namespace TBF.UI.Bench.Uncertainties
{
public partial class UncertntDlgTempMeterTab : UserControl, IUncetaintiesDlgTab
{
static readonly ILog log = LogManager.GetLogger(typeof(UncertntDlgTempMeterTab));
/// <summary>
/// Component entity that has a list of 'measurement-correction' pairs
/// to be updated in the database on OK.
/// </summary>
Component meterEntity;
public Component MeterEntity
{
get { return meterEntity; }
set { meterEntity = value; }
}
/// <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;
Control[] textBoxes;
public UncertntDlgTempMeterTab()
{
InitializeComponent();
toBeRemoved = new List<Uncertainty>();
}
private void UncertntDlgTempMeterTab_Load(object sender, System.EventArgs e)
{
if (meterEntity == null) return;
parent = ParentForm as UncertaintiesDlg;
/// Panel1
cmpntLabel.Text = Strings.Component;
cmpntNameLabel.Text = meterEntity.Name;
/// Panel2
listViewEx.SubItemClicked += new SubItemEventHandler(listViewEx_SubItemClicked);
listViewEx.SubItemEndEditing += new SubItemEndEditingEventHandler(listViewEx_SubItemEndEditing);
listViewEx.Columns.Add(new ColumnHeader() { Text = Strings.Nr, Width = 40 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [°C]", Strings.Temperature), Width = 100 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [1/1000 °C]", Strings.Main_uncertainty), Width = 120 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [1/1000 °C]", Strings.Resolution), Width = 100 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [1/1000 °C/year]", Strings.Drift_per_year), Width = 120 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [1/1000 °C]", Strings.Conditions), Width = 100 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [1/1000 °C]", Strings.Uncertainty_of_correction), Width = 160 });
textBoxes = new TextBox[listViewEx.Columns.Count];
for (int i = 1; i < textBoxes.Length; i++)
{
this.Controls.Add(textBoxes[i] = new TextBox());
}
RefreshAll();
}
void RefreshAll()
{
listViewEx.Items.Clear();
foreach (var uncrtnty in MeterEntity.Uncertainties) AddOneLVI(uncrtnty);
}
void AddOneLVI(Uncertainty corr)
{
int nr = listViewEx.Items.Count + 1;
ListViewItem lvi = new ListViewItem(nr.ToString());
lvi.Tag = corr;
lvi.SubItems.Add(corr.Measurement.ToString());
lvi.SubItems.Add((1000 * corr.MainUncertainty).ToString());
lvi.SubItems.Add((1000 * corr.Resolution).ToString());
lvi.SubItems.Add((1000 * corr.DriftPerYr).ToString());
lvi.SubItems.Add((1000 * corr.Conditions).ToString());
lvi.SubItems.Add((1000 * corr.UncertaintyOfCorrection).ToString());
listViewEx.Items.Add(lvi);
}
void listViewEx_SubItemClicked(object sender, SubItemEventArgs e)
{
if (unlocked && (e.SubItem >= 1) && (e.SubItem < listViewEx.Columns.Count))
{
/// This is not the first column
listViewEx.StartEditing(textBoxes[e.SubItem], e.Item, e.SubItem);
}
}
void listViewEx_SubItemEndEditing(object sender, SubItemEndEditingEventArgs e)
{
if (ParseItem(e.Item, e.SubItem, e.DisplayText)) return;
/// New value is NOK, revert the original text
e.DisplayText = e.Item.Text;
e.Cancel = true;
}
/// <summary>
/// Parse text of a ListViewItem
/// </summary>
/// <returns>true = value parsed OK</returns>
bool ParseItem(ListViewItem item, int subItem, string strValue)
{
Uncertainty uncrtnty = item.Tag as Uncertainty;
double dblValue = 0;
if ((uncrtnty != null) && Utils.TryParseEDouble(strValue, out dblValue) && (dblValue >= 0))
{
double inDefaultUnits = dblValue / 1000;
switch (subItem)
{
case 1:
uncrtnty.Measurement = (float)dblValue;
return true;
case 2:
uncrtnty.MainUncertainty = (float)inDefaultUnits;
return true;
case 3:
uncrtnty.Resolution = (float)inDefaultUnits;
return true;
case 4:
uncrtnty.DriftPerYr = (float)inDefaultUnits;
return true;
case 5:
uncrtnty.Conditions = (float)inDefaultUnits;
return true;
case 6:
uncrtnty.UncertaintyOfCorrection = (float)inDefaultUnits;
return true;
default:
return false;
}
}
else
{
return false;
}
}
public void Unlock()
{
unlocked = true;
if (listViewEx.SelectedItems.Count == 1)
{
int ix = listViewEx.SelectedIndices[0];
listViewEx.Focus();
listViewEx.Items[ix].Selected = true;
listViewEx.Items[ix].EnsureVisible();
}
}
public void OkBtnClicked()
{
}
public void CancelBtnClicked()
{
}
public void AddOne()
{
Uncertainty uncrtnty = new Uncertainty();
MeterEntity.Uncertainties.Add(uncrtnty);
AddOneLVI(uncrtnty);
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];
Uncertainty selected =
(Uncertainty)listViewEx.SelectedItems[0].Tag;
if (selected.Id != 0) toBeRemoved.Add(selected);
MeterEntity.Corrections.RemoveAt(removeItemNr);
RefreshAll();
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);
}
}
public string GetWarningsBeforeSaving(ref Dictionary<string, string> renmInfo)
{
return string.Empty;
}
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
{
}
}
}
@@ -0,0 +1,122 @@
///
/// Copyright (c) 2019 Senus Slovensko a.s.
///
namespace TBF.UI.Bench.Uncertainties
{
partial class UncertntDlgTempMeterTab
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.cmpntLabel = new System.Windows.Forms.Label();
this.cmpntNameLabel = new System.Windows.Forms.Label();
this.listViewEx = new global::Results.Forms.ListViewEx();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.cmpntLabel);
this.splitContainer1.Panel1.Controls.Add(this.cmpntNameLabel);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.listViewEx);
this.splitContainer1.Size = new System.Drawing.Size(420, 300);
this.splitContainer1.SplitterDistance = 40;
this.splitContainer1.TabIndex = 2;
//
// componentLabel
//
this.cmpntLabel.AutoSize = true;
this.cmpntLabel.Location = new System.Drawing.Point(14, 12);
this.cmpntLabel.Name = "componentLabel";
this.cmpntLabel.Size = new System.Drawing.Size(64, 13);
this.cmpntLabel.TabIndex = 1;
this.cmpntLabel.Text = "Component:";
//
// cmpntNameLabel
//
this.cmpntNameLabel.AutoSize = true;
this.cmpntNameLabel.Location = new System.Drawing.Point(97, 12);
this.cmpntNameLabel.Name = "cmpntNameLabel";
this.cmpntNameLabel.Size = new System.Drawing.Size(88, 13);
this.cmpntNameLabel.TabIndex = 0;
this.cmpntNameLabel.Text = "componentName";
//
// listViewEx
//
this.listViewEx.AllowColumnReorder = true;
this.listViewEx.Dock = System.Windows.Forms.DockStyle.Fill;
this.listViewEx.DoubleClickActivation = false;
this.listViewEx.FullRowSelect = true;
this.listViewEx.GridLines = true;
this.listViewEx.Location = new System.Drawing.Point(0, 0);
this.listViewEx.Name = "listViewEx";
this.listViewEx.Size = new System.Drawing.Size(420, 256);
this.listViewEx.TabIndex = 0;
this.listViewEx.UseCompatibleStateImageBehavior = false;
this.listViewEx.View = System.Windows.Forms.View.Details;
this.listViewEx.SelectedIndexChanged += new System.EventHandler(this.listViewEx_SelectedIndexChanged);
//
// UncertntDlgTempMeterTab
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.splitContainer1);
this.Name = "UncertntDlgTempMeterTab";
this.Size = new System.Drawing.Size(420, 300);
this.Load += new System.EventHandler(this.UncertntDlgTempMeterTab_Load);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel1.PerformLayout();
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.Label cmpntLabel;
private System.Windows.Forms.Label cmpntNameLabel;
private global::Results.Forms.ListViewEx listViewEx;
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>