Output.FileWriters.Basic.HeatMeters

This commit is contained in:
Milan Hanajik 2016-10-11 14:55:16 +02:00
parent f866f5fb2c
commit 1fc129117f
10 changed files with 81 additions and 30 deletions

View File

@ -35,7 +35,7 @@ namespace Results.Forms
public IList<WMeterRsltItemSpec> SelectedItems;
public bool Compound; /// false = single meter items, true = combined meter items
public MetersKind MetersKind;
public ResultsConfigDlg()
{

View File

@ -229,10 +229,13 @@ namespace ResultsBrowser
private void formatOfResultsBtn_Click(object sender, EventArgs e)
{
Results.Forms.ResultsConfigDlg dlg = new Results.Forms.ResultsConfigDlg();
dlg.Compound = false; /// config.Factory.ClassName.Contains("Compound");
dlg.SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(filtersConfig.ResultItems);
dlg.AvailableItems = new List<Results.WMeterRsltItemSpec>();
Results.Forms.ResultsConfigDlg dlg = new Results.Forms.ResultsConfigDlg()
{
MetersKind = Config.Entities.MetersKind.Single,
SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(filtersConfig.ResultItems),
AvailableItems = new List<Results.WMeterRsltItemSpec>()
};
foreach (var v in Results.WMeterRsltItemSpec.AllItems) dlg.AvailableItems.Add(v);
if (dlg.ShowDialog() == DialogResult.OK)

View File

@ -17,11 +17,13 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Writer(cfg); }
public IComponentCfg DefaultConfig() { return new WriterCfg(this); }
public IComponentCfg DefaultConfig() { return new WriterCfg("FileWriter.Basic.Compound", this, Config.Entities.MetersKind.Combined); }
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(WriterCfg), component, this);
IComponentCfg cfg = ComponentCfgBase.CreateFromDbEntity(typeof(WriterCfg), component, this);
(cfg as WriterCfg).MetersKind = Config.Entities.MetersKind.Combined;
return cfg;
}
}
}

View File

@ -0,0 +1,29 @@
///
/// Copyright (c) 2016 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Output.FileWriters.Basic
{
public class FactoryHeatMeters : IComponentFactory
{
public string ClassName { get { return this.GetType().Namespace.Substring(17) + ".HeatMeters"; } }
public void ResetStaticProperties() { Writer.ResetStaticProperties(); }
public IComponent DummyComponent() { return new Writer(); }
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Writer(cfg); }
public IComponentCfg DefaultConfig() { return new WriterCfg("FileWriter.Basic.HeatMeters", this, Config.Entities.MetersKind.HeatMeter); }
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
IComponentCfg cfg = ComponentCfgBase.CreateFromDbEntity(typeof(WriterCfg), component, this);
(cfg as WriterCfg).MetersKind = Config.Entities.MetersKind.HeatMeter;
return cfg;
}
}
}

View File

@ -17,11 +17,13 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Writer(cfg); }
public IComponentCfg DefaultConfig() { return new WriterCfg(this); }
public IComponentCfg DefaultConfig() { return new WriterCfg("FileWriter.Basic.Single", this, Config.Entities.MetersKind.Single); }
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(WriterCfg), component, this);
IComponentCfg cfg = ComponentCfgBase.CreateFromDbEntity(typeof(WriterCfg), component, this);
(cfg as WriterCfg).MetersKind = Config.Entities.MetersKind.Single;
return cfg;
}
}
}

View File

@ -58,26 +58,30 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
public bool SaveGoodOnly;
public string[] SelectedItems;
[XmlIgnore]
public Config.Entities.MetersKind MetersKind;
/// Private parameterless constructor invoked by all other (public) constructors
WriterCfg()
{
Name = "FileWriter";
}
public WriterCfg(string name, IComponentFactory factory, Config.Entities.MetersKind metersKind)
: this()
{
Name = name;
Factory = factory;
MetersKind = metersKind;
ParentName = string.Empty;
DestinationPath = Program.HomeDir + "Results\\";
DestinationPath = Program.HomeDir + "Results\\";
DestinationPath2 = string.Empty;
YearFolders = YearFolders.FourDigit;
MonthFolders = MonthFolders.Digit;
DayFolders = DayFolders.Digit;
FileNameFormat = "{0:yyyyMMdd}";
Separator = Separator.None;
SaveGoodOnly = false;
}
public WriterCfg(IComponentFactory factory)
: this()
{
this.Factory = factory;
Separator = Separator.None;
SaveGoodOnly = false;
}
public string ToString(int i)

View File

@ -208,10 +208,13 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
private void selectItemsButton_Click(object sender, EventArgs e)
{
ResultsConfigDlg dlg = new ResultsConfigDlg();
dlg.Compound = config.Factory.ClassName.Contains("Compound");
dlg.SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(selectedItems);
dlg.AvailableItems = new List<Results.WMeterRsltItemSpec>();
ResultsConfigDlg dlg = new ResultsConfigDlg()
{
MetersKind = config.MetersKind,
SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(selectedItems),
AvailableItems = new List<Results.WMeterRsltItemSpec>()
};
foreach (var v in Results.WMeterRsltItemSpec.AllItems) dlg.AvailableItems.Add(v);
if (dlg.ShowDialog() == DialogResult.OK)

View File

@ -263,10 +263,13 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
private void commonItemsButton_Click(object sender, EventArgs e)
{
Results.Forms.ResultsConfigDlg dlg = new Results.Forms.ResultsConfigDlg();
dlg.Compound = config.Factory.ClassName.Contains("Compound");
dlg.SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(commonItems);
dlg.AvailableItems = new List<Results.WMeterRsltItemSpec>();
Results.Forms.ResultsConfigDlg dlg = new Results.Forms.ResultsConfigDlg()
{
MetersKind = config.MetersKind,
SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(commonItems),
AvailableItems = new List<Results.WMeterRsltItemSpec>()
};
foreach (var v in Results.WMeterRsltItemSpec.AllItems) dlg.AvailableItems.Add(v);
if (dlg.ShowDialog() == DialogResult.OK)
@ -277,9 +280,12 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
private void testItemsButton_Click(object sender, EventArgs e)
{
ResultsConfigDlg dlg = new ResultsConfigDlg() { MetersKind = config.MetersKind,
SelectedItems = Results.ItemSpec.FromStrArray(testItems),
AvailableItems = new List<Results.ItemSpec>() };
ResultsConfigDlg dlg = new ResultsConfigDlg()
{
MetersKind = config.MetersKind,
SelectedItems = Results.ItemSpec.FromStrArray(testItems),
AvailableItems = new List<Results.ItemSpec>()
};
foreach (var v in Results.ItemSpec.AllItems) dlg.AvailableItems.Add(v);

View File

@ -67,6 +67,7 @@ namespace TBF.BenchControl
Factories.Add(new Modbus.PressureMeter.Meret.Factory()); /// Meret pressure meter connected via modbus
Factories.Add(new Output.FileWriters.Basic.FactorySingle()); /// Output.FileWriters.Basic.Single
Factories.Add(new Output.FileWriters.Basic.FactoryCompound()); /// Output.FileWriters.Basic.Compound
Factories.Add(new Output.FileWriters.Basic.FactoryHeatMeters()); /// Output.FileWriters.Basic.FactoryHeatMeters
Factories.Add(new Output.FileWriters.Enhanced.FactorySingle()); /// Output.FileWriters.Basic.Single
Factories.Add(new Output.FileWriters.Enhanced.FactoryCompound()); /// Output.FileWriters.Basic.Compound
Factories.Add(new Output.FileWriters.Enhanced.FactoryHeatMeters()); /// Output.FileWriters.Basic.HeatMeters

View File

@ -486,6 +486,7 @@
<Compile Include="BenchControl\Modbus\QuidoRS\SetOutputsOp.cs" />
<Compile Include="BenchControl\Operations\EnthalpyCalculationOp.cs" />
<Compile Include="BenchControl\Output\FileWriters\Basic\FactoryCompound.cs" />
<Compile Include="BenchControl\Output\FileWriters\Basic\FactoryHeatMeters.cs" />
<Compile Include="BenchControl\Output\FileWriters\Basic\FactorySingle.cs" />
<Compile Include="BenchControl\Output\FileWriters\Enhanced\FactoryCompound.cs" />
<Compile Include="BenchControl\Output\FileWriters\Enhanced\FactoryHeatMeters.cs" />