From d1eb7b21d1fddf52a4f03bae207e2f4bc0db797d Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Fri, 29 Apr 2016 07:40:34 +0200 Subject: [PATCH] iPerlSpecial: Output.FileWriters.Basic rewritten to handle one water meter in one row (incl. fetch of test results). --- Config/Config.csproj | 1 + Config/Entities/Enums.cs | 9 + Config/Properties/AssemblyInfo.cs | 4 +- Config/Units.cs | 103 +++++ Results/Entities/MeterTestRslt.cs | 9 +- Results/ItemSpec.cs | 176 ++++----- Results/Properties/AssemblyInfo.cs | 4 +- Results/Results.csproj | 1 + Results/Utils.cs | 52 ++- Results/WMeterRsltItemSpec.cs | 259 +++++++++++++ .../FileWriters/Basic/ResultsConfigDlg.cs | 178 +++++++-- .../Basic/ResultsConfigDlg.designer.cs | 249 ++++++------ .../Output/FileWriters/Basic/Writer.cs | 280 ++++---------- .../Output/FileWriters/Basic/WriterCfg.cs | 39 +- .../Output/FileWriters/Basic/WriterCfgCtrl.cs | 118 +++--- .../Basic/WriterCfgCtrl.designer.cs | 356 +++++++++--------- 16 files changed, 1151 insertions(+), 687 deletions(-) create mode 100644 Config/Units.cs create mode 100644 Results/WMeterRsltItemSpec.cs diff --git a/Config/Config.csproj b/Config/Config.csproj index beb7009e0..9c111c9d2 100644 --- a/Config/Config.csproj +++ b/Config/Config.csproj @@ -115,6 +115,7 @@ + diff --git a/Config/Entities/Enums.cs b/Config/Entities/Enums.cs index f36c1737e..2372acacf 100644 --- a/Config/Entities/Enums.cs +++ b/Config/Entities/Enums.cs @@ -159,5 +159,14 @@ namespace Config.Entities Vertically, Horizontally, } + + public enum Alignment + { + Left, + Center, + Right, + Justified, + Count + } } diff --git a/Config/Properties/AssemblyInfo.cs b/Config/Properties/AssemblyInfo.cs index 692aede6e..4d51c5d04 100644 --- a/Config/Properties/AssemblyInfo.cs +++ b/Config/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.5.265.0")] -[assembly: AssemblyFileVersion("2.5.265.0")] +[assembly: AssemblyVersion("2.5.276.0")] +[assembly: AssemblyFileVersion("2.5.276.0")] diff --git a/Config/Units.cs b/Config/Units.cs new file mode 100644 index 000000000..be0bd9124 --- /dev/null +++ b/Config/Units.cs @@ -0,0 +1,103 @@ +/// +/// Copyright (c) 2016 Sensus Metering Systems +/// +using System; + +namespace Config +{ + public enum Unit + { + None, + l, /// 1 liter + m3, /// 1000 l + gal_UK, /// 1 gal(UK) = 4.54609 l + gal_US, /// 1 gal(US) = 3.78541178 l + lph, /// 1 liter/h + m3ph, /// 1 m3/h = 1000 l/h + g, /// 0.001 kg + kg, /// 1 kilogram + t, /// 1000 kg + lb, /// 0.45359237 kg + C, /// degree Celsius + F, /// degree Fahrenheit + K, /// degree Kelvin + hPa, /// 1 hPa = 100 Pa + mBar, /// 1 mbar = 1 hPa = 100 Pa + Bar, /// 1 Bar = 1000 mbar = 100000 Pa + inHg, /// 1 inHg = 33.864 hPa + Count + } + + public class Units + { + public static double ConvertTo(Unit units, double v) + { + switch (units) + { + /// Volume: internal representation in l + case Unit.l: return v; /// 1 liter + case Unit.m3: return 0.001 * v; /// 1000 l + case Unit.gal_UK: return 0.21996925 * v; /// 1 gal(UK) = 4.54609 l + case Unit.gal_US: return 0.26417205 * v; /// 1 gal(US) = 3.78541178 l + + /// Flow: internal representation in m3/h + case Unit.lph: return 1000 * v; /// 1 liter/h + case Unit.m3ph: return v; /// 1 m3/h = 1000 l/h + + /// Mass: internal representation in kg + case Unit.g: return 1000 * v; /// 1 g = 0.001 kg + case Unit.kg: return v; /// 1 kilogram + case Unit.t: return 0.001 * v; /// 1 t = 1000 kg + case Unit.lb: return 2.2046226 * v; /// 1 lb = 0.45359237 kg + + /// Temperature: internal representation in degree C + case Unit.C: return v; /// degree Celsius + case Unit.F: return 1.8 * v + 32; /// degree Fahrenheit + case Unit.K: return v + 273.15; /// degree Kelvin + + /// Pressure: internal representation in hPa (???) + case Unit.hPa: return v; /// 1 hPa = 100 Pa + case Unit.mBar: return v; /// 1 mbar = 1 hPa = 100 Pa + case Unit.Bar: return 0.001 * v; /// 1 Bar = 1000 mbar = 100000 Pa + case Unit.inHg: return 0.02953 * v; /// 1 inHg = 33.864 hPa + + default: return v; + } + } + + public static double ConvertFrom(Unit units, double v) + { + switch (units) + { + /// Volume: internal representation in l + case Unit.l: return v; /// 1 liter + case Unit.m3: return 1000 * v; /// 1000 l + case Unit.gal_UK: return 4.54609 * v; /// 1 gal(UK) = 4.54609 l + case Unit.gal_US: return 3.78541178 * v; /// 1 gal(US) = 3.78541178 l + + /// Flow: internal representation in m3/h + case Unit.lph: return 0.001 * v; /// 1 liter/h + case Unit.m3ph: return v; /// 1 m3/h = 1000 l/h + + /// Mass: internal representation in kg + case Unit.g: return 0.001 * v; /// 1 g = 0.001 kg + case Unit.kg: return v; /// 1 kilogram + case Unit.t: return 1000 * v; /// 1 t = 1000 kg + case Unit.lb: return 0.45359237 * v; /// 1 lb = 0.45359237 kg + + /// Temperature: internal representation in degree C + case Unit.C: return v; /// degree Celsius + case Unit.F: return 5 * (v - 32) / 9; /// degree Fahrenheit + case Unit.K: return v - 273.15; /// degree Kelvin + + /// Pressure: internal representation in hPa (???) + case Unit.hPa: return v; /// 1 hPa = 100 Pa + case Unit.mBar: return v; /// 1 mbar = 1 hPa = 100 Pa + case Unit.Bar: return 1000 * v; /// 1 Bar = 1000 mbar = 100000 Pa + case Unit.inHg: return 33.864 * v; /// 1 inHg = 33.864 hPa + + default: return v; + } + } + } +} diff --git a/Results/Entities/MeterTestRslt.cs b/Results/Entities/MeterTestRslt.cs index 44bbbe736..0cb17ae7f 100644 --- a/Results/Entities/MeterTestRslt.cs +++ b/Results/Entities/MeterTestRslt.cs @@ -24,8 +24,8 @@ namespace Results.Entities public virtual bool TestDone { get; set; } /// true = test was completed public virtual bool Passed { get; set; } /// true = test passed, water meter is OK - public virtual WaterMeter WaterMeter { get; set; } /// reference to the TestData entity - public virtual TestRslt TestRslt { get; set; } /// reference to the TestData entity + public virtual WaterMeter WaterMeter { get; set; } /// reference to the WaterMeter entity + public virtual TestRslt TestRslt { get; set; } /// reference to the TestRslt entity /// Wrappers public virtual string Name() { return TestRslt.Name(); } @@ -57,9 +57,12 @@ namespace Results.Entities public virtual double QRise() { return WaterMeter.QRise; } /// [m3/h] public virtual double QFall() { return WaterMeter.QFall; } /// [m3/h] - public virtual bool Evaluate() { return TestData().Evaluate; } + public virtual bool Evaluate() { return TestData().Evaluate; } public virtual Config.Entities.Publish Publish() { return (Config.Entities.Publish)TestData().Publish; } + public virtual WaterMeterData WaterMeterData() { return WaterMeter.WaterMeterData; } + public virtual Batch Batch() { return WaterMeter.Batch; } + public virtual string PassedColorStr() { if (!Evaluate()) return Passed ? "OK|White" : "NOK|White"; diff --git a/Results/ItemSpec.cs b/Results/ItemSpec.cs index fd6db53b0..9be421bd2 100644 --- a/Results/ItemSpec.cs +++ b/Results/ItemSpec.cs @@ -54,7 +54,6 @@ namespace Results } - /// /// Public constructor /// @@ -77,63 +76,94 @@ namespace Results /// Common - //AllItems.Add(new ResultItemSpec("Bench ID", "Bench ID", x => x.BenchID, - // (x, y, z) => x.BenchID)); - AllItems.Add(new ItemSpec("Test name", "Test", x => x.Name(), (x, y, z) => z.Name())); - AllItems.Add(new ItemSpec("Procedure name", "Procedure", x => x.ProcedureName(), (x, y, z) => z.ProcedureName())); - AllItems.Add(new ItemSpec("Batch number", "Batch nr.", x => x.BatchNr().ToString(), (x, y, z) => z.BatchNr().ToString())); - AllItems.Add(new ItemSpec("Test method", "Test method", x => x.Method(), (x, y, z) => z.Method())); - AllItems.Add(new ItemSpec("Density", "Density", x => x.DensityOut().ToString("F1"), (x, y, z) => z.DensityOut().ToString("F1"))); /// [kg/m3] + //AllItems.Add(new ResultItemSpec("Bench ID", "Bench ID", x => x.BenchID, (x, y, z) => x.BenchID)); + AllItems.Add(new ItemSpec("Test name", "Test", x => x.Name(), (x, y, z) => z.Name())); + AllItems.Add(new ItemSpec("Procedure name", "Procedure", x => x.ProcedureName(), (x, y, z) => z.ProcedureName())); + AllItems.Add(new ItemSpec("Batch number", "Batch nr.", x => x.BatchNr().ToString(), (x, y, z) => z.BatchNr().ToString())); + AllItems.Add(new ItemSpec("Test method", "Test method", x => x.Method(), (x, y, z) => z.Method())); + AllItems.Add(new ItemSpec("Density", "Density", x => x.DensityOut().ToString("F1"), (x, y, z) => z.DensityOut().ToString("F1"))); /// [kg/m3] /// Target values - AllItems.Add(new ItemSpec("Q from", "Q from [m3/h]", x => x.Qfrom().ToString("F3"), (x, y, z) => z.Qfrom().ToString("F3"))); - AllItems.Add(new ItemSpec("Q to", "Q to [m3/h]", x => x.Qto().ToString("F3"), (x, y, z) => z.Qto().ToString("F3"))); - AllItems.Add(new ItemSpec("Test volume", "Test vol. [l]", x => x.TargetVolume().ToString("F1"),(x, y, z) => z.TargetVolume().ToString("F1"))); - AllItems.Add(new ItemSpec("Error limit Lo", "Err.Lim.Lo [%]", x => x.ErrLimLo().ToString("F1"), (x, y, z) => z.ErrLimLo().ToString("F1"))); - AllItems.Add(new ItemSpec("Error limit Hi", "Err.Lim.Hi [%]", x => x.ErrLimHi().ToString("F1"), (x, y, z) => z.ErrLimHi().ToString("F1"))); - AllItems.Add(new ItemSpec("Uncertainty", "Uncertainty [%]",x => x.Uncertainty().ToString("F2"), (x, y, z) => z.Uncertainty().ToString("F2"))); + AllItems.Add(new ItemSpec("Q from", "Q from [m3/h]", x => x.Qfrom().ToString("F3"), (x, y, z) => z.Qfrom().ToString("F3"))); + AllItems.Add(new ItemSpec("Q to", "Q to [m3/h]", x => x.Qto().ToString("F3"), (x, y, z) => z.Qto().ToString("F3"))); + AllItems.Add(new ItemSpec("Test volume", "Test vol. [l]", x => x.TargetVolume().ToString("F1"), (x, y, z) => z.TargetVolume().ToString("F1"))); + AllItems.Add(new ItemSpec("Error limit Lo", "Err.Lim.Lo [%]", x => x.ErrLimLo().ToString("F1"), (x, y, z) => z.ErrLimLo().ToString("F1"))); + AllItems.Add(new ItemSpec("Error limit Hi", "Err.Lim.Hi [%]", x => x.ErrLimHi().ToString("F1"), (x, y, z) => z.ErrLimHi().ToString("F1"))); + AllItems.Add(new ItemSpec("Uncertainty", "Uncertainty [%]", x => x.Uncertainty().ToString("F2"), (x, y, z) => z.Uncertainty().ToString("F2"))); /// Test results - AllItems.Add(new ItemSpec("Start time", "T start", x => x.StartTime().ToShortTimeString(), (x, y, z) => z.StartTime().ToShortTimeString())); - AllItems.Add(new ItemSpec("End time", "T end", x => x.EndTime().ToShortTimeString(), (x, y, z) => z.EndTime().ToShortTimeString())); - AllItems.Add(new ItemSpec("Test time", "T [s]", x => x.TestTime.ToString("F2"), (x, y, z) => z.TestTime.ToString("F2"))); - AllItems.Add(new ItemSpec("Flow", "Flow [m3/h]", x => DoubleToStr(x.FlowVolume(), 4), (x, y, z) => DoubleToStr(z.FlowVolume(), 4))); - AllItems.Add(new ItemSpec("T in", "T in", x => x.TestRslt.TempInAvrg.ToString("F2"), (x, y, z) => z.TestRslt.TempInAvrg.ToString("F2"))); - AllItems.Add(new ItemSpec("T out", "T out", x => x.TestRslt.TempOutAvrg.ToString("F2"), (x, y, z) => z.TestRslt.TempOutAvrg.ToString("F2"))); - AllItems.Add(new ItemSpec("T div", "T div", x => x.TestRslt.TempDivAvrg.ToString("F2"), (x, y, z) => z.TestRslt.TempDivAvrg.ToString("F2"))); - AllItems.Add(new ItemSpec("P up", "P up", x => x.TestRslt.PressUpAvrg.ToString("F3"), (x, y, z) => z.TestRslt.PressUpAvrg.ToString("F3"))); - AllItems.Add(new ItemSpec("P up start", "P up start", x => x.TestRslt.PressUpStart.ToString("F3"), (x, y, z) => z.TestRslt.PressUpStart.ToString("F3"))); - AllItems.Add(new ItemSpec("P up end", "P up end", x => x.TestRslt.PressUpEnd.ToString("F3"), (x, y, z) => z.TestRslt.PressUpEnd.ToString("F3"))); - AllItems.Add(new ItemSpec("P down", "P down", x => x.TestRslt.PressDownAvrg.ToString("F3"), (x, y, z) => z.TestRslt.PressDownAvrg.ToString("F3"))); - AllItems.Add(new ItemSpec("P down start", "P down start", x => x.TestRslt.PressDownStart.ToString("F3"), (x, y, z) => z.TestRslt.PressDownStart.ToString("F3"))); - AllItems.Add(new ItemSpec("P down end", "P down end", x => x.TestRslt.PressDownEnd.ToString("F3"), (x, y, z) => z.TestRslt.PressDownEnd.ToString("F3"))); - AllItems.Add(new ItemSpec("Reference error","Err.ref. [%]", x => x.TestRslt.ErrorMaster.ToString("F3"), (x, y, z) => z.TestRslt.ErrorMaster.ToString("F3"))); - AllItems.Add(new ItemSpec("Ambient temperature","T amb", x => x.TestRslt.AmbientTempAve.ToString("F1"), (x, y, z) => z.TestRslt.AmbientTempAve.ToString("F1"))); - AllItems.Add(new ItemSpec("Ambient pressure", "P amb", x => x.TestRslt.AmbientPressAve.ToString("F0"), (x, y, z) => z.TestRslt.AmbientPressAve.ToString("F0"))); - AllItems.Add(new ItemSpec("Ambient humidity", "H amb [%]",x => x.TestRslt.AmbientHumiAve.ToString("F1"), (x, y, z) => z.TestRslt.AmbientHumiAve.ToString("F1"))); + AllItems.Add(new ItemSpec("Test start time", "T start", x => x.StartTime().ToShortTimeString(), (x, y, z) => z.StartTime().ToShortTimeString())); + AllItems.Add(new ItemSpec("Test end time", "T end", x => x.EndTime().ToShortTimeString(), (x, y, z) => z.EndTime().ToShortTimeString())); + AllItems.Add(new ItemSpec("Test time", "T [s]", x => x.TestTime.ToString("F2"), (x, y, z) => z.TestTime.ToString("F2"))); + AllItems.Add(new ItemSpec("Flow", "Flow [m3/h]", x => Utils.DoubleToStr(x.FlowVolume(), 4), (x, y, z) => Utils.DoubleToStr(z.FlowVolume(), 4))); + AllItems.Add(new ItemSpec("T in", "T in", x => x.TestRslt.TempInAvrg.ToString("F2"), (x, y, z) => z.TestRslt.TempInAvrg.ToString("F2"))); + AllItems.Add(new ItemSpec("T out", "T out", x => x.TestRslt.TempOutAvrg.ToString("F2"), (x, y, z) => z.TestRslt.TempOutAvrg.ToString("F2"))); + AllItems.Add(new ItemSpec("T div", "T div", x => x.TestRslt.TempDivAvrg.ToString("F2"), (x, y, z) => z.TestRslt.TempDivAvrg.ToString("F2"))); + AllItems.Add(new ItemSpec("P up", "P up", x => x.TestRslt.PressUpAvrg.ToString("F3"), (x, y, z) => z.TestRslt.PressUpAvrg.ToString("F3"))); + AllItems.Add(new ItemSpec("P up start", "P up start", x => x.TestRslt.PressUpStart.ToString("F3"), (x, y, z) => z.TestRslt.PressUpStart.ToString("F3"))); + AllItems.Add(new ItemSpec("P up end", "P up end", x => x.TestRslt.PressUpEnd.ToString("F3"), (x, y, z) => z.TestRslt.PressUpEnd.ToString("F3"))); + AllItems.Add(new ItemSpec("P down", "P down", x => x.TestRslt.PressDownAvrg.ToString("F3"), (x, y, z) => z.TestRslt.PressDownAvrg.ToString("F3"))); + AllItems.Add(new ItemSpec("P down start", "P down start", x => x.TestRslt.PressDownStart.ToString("F3"), (x, y, z) => z.TestRslt.PressDownStart.ToString("F3"))); + AllItems.Add(new ItemSpec("P down end", "P down end", x => x.TestRslt.PressDownEnd.ToString("F3"), (x, y, z) => z.TestRslt.PressDownEnd.ToString("F3"))); + AllItems.Add(new ItemSpec("Reference error", "Err.ref. [%]", x => x.TestRslt.ErrorMaster.ToString("F3"), (x, y, z) => z.TestRslt.ErrorMaster.ToString("F3"))); + AllItems.Add(new ItemSpec("Ambient temperature","T amb", x => x.TestRslt.AmbientTempAve.ToString("F1"), (x, y, z) => z.TestRslt.AmbientTempAve.ToString("F1"))); + AllItems.Add(new ItemSpec("Ambient pressure", "P amb", x => x.TestRslt.AmbientPressAve.ToString("F0"), (x, y, z) => z.TestRslt.AmbientPressAve.ToString("F0"))); + AllItems.Add(new ItemSpec("Ambient humidity", "H amb [%]", x => x.TestRslt.AmbientHumiAve.ToString("F1"), (x, y, z) => z.TestRslt.AmbientHumiAve.ToString("F1"))); /// Single and combined meter results - AllItems.Add(new ItemSpec("Volume", "Volume [l]", x => x.VolumeMeter.ToString("F3"), (x, y, z) => z.VolumeMeter.ToString("F3"))); - AllItems.Add(new ItemSpec("Reference volume", "Vol.ref. [l]", x => x.VolumeRef.ToString("F3"), (x, y, z) => z.VolumeRef.ToString("F3"))); - AllItems.Add(new ItemSpec("Error", "Error [%]", x => x.Error.ToString("F2"), (x, y, z) => z.Error.ToString("F2"))); - AllItems.Add(new ItemSpec("Passed", "Result", x => x.PassedColorStr(), (x, y, z) => z.PassedColorStr())); - /// Single water meters only results - AllItems.Add(new ItemSpec("Serial Nr", "s/n", x => x.SerialNr(), null)); - AllItems.Add(new ItemSpec("End state", "End state", x => x.EndState(), null)); - AllItems.Add(new ItemSpec("Pulses", "Pulses", x => x.PulsesMeter.ToString(), null)); - AllItems.Add(new ItemSpec("Pulses/liter", "Pulses/liter", x => x.PulsesPerLiter.ToString(), null)); - AllItems.Add(new ItemSpec("Reference pulses", "Ref.pulses", x => x.PulsesMaster.ToString(), null)); + AllItems.Add(new ItemSpec("Volume", "Volume [l]", x => x.VolumeMeter.ToString("F3"), (x, y, z) => z.VolumeMeter.ToString("F3"))); + AllItems.Add(new ItemSpec("Reference volume", "Vol.ref. [l]", x => x.VolumeRef.ToString("F3"), (x, y, z) => z.VolumeRef.ToString("F3"))); + AllItems.Add(new ItemSpec("Error", "Error [%]", x => x.Error.ToString("F2"), (x, y, z) => z.Error.ToString("F2"))); + AllItems.Add(new ItemSpec("Passed", "Result", x => x.PassedColorStr(), (x, y, z) => z.PassedColorStr())); - /// Combined water meters only results - AllItems.Add(new ItemSpec("Q rise", "Q rise [m3/h]", null, (x, y, z) => (z.QRise() == 0) ? "-" : DoubleToStr(z.QRise(), 4))); - AllItems.Add(new ItemSpec("Q fall", "Q fall [m3/h]", null, (x, y, z) => (z.QFall() == 0) ? "-" : DoubleToStr(z.QFall(), 4))); - AllItems.Add(new ItemSpec("Error large WM", "Error-L [%]", null, (x, y, z) => x.Error.ToString("F2"))); - AllItems.Add(new ItemSpec("Error small WM", "Error-S [%]", null, (x, y, z) => y.Error.ToString("F2"))); - AllItems.Add(new ItemSpec("Serial Nr large WM", "s/n", null, (x, y, z) => x.SerialNr())); - AllItems.Add(new ItemSpec("Serial Nr small WM", "s/n", null, (x, y, z) => y.SerialNr())); - AllItems.Add(new ItemSpec("End state large WM", "End state", null, (x, y, z) => x.EndState())); - AllItems.Add(new ItemSpec("End state small WM", "End state", null, (x, y, z) => y.EndState())); - } + /// Water meter info + AllItems.Add(new ItemSpec("Watermeter type", "WM Type", x => x.WaterMeterData().ProductName, (x, y, z) => z.WaterMeterData().ProductName)); + AllItems.Add(new ItemSpec("Producer", "Producer", x => x.WaterMeterData().Producer, (x, y, z) => z.WaterMeterData().Producer)); + AllItems.Add(new ItemSpec("Metrological class", "M.Class", x => x.WaterMeterData().MetrologicalClass, (x, y, z) => z.WaterMeterData().MetrologicalClass)); + AllItems.Add(new ItemSpec("Approval info", "Approval", x => x.WaterMeterData().ApprovalInfo, (x, y, z) => z.WaterMeterData().ApprovalInfo)); + AllItems.Add(new ItemSpec("Q4", "Q4", x => x.WaterMeterData().Q4_Qmax.ToString(), (x, y, z) => z.WaterMeterData().Q4_Qmax.ToString())); + AllItems.Add(new ItemSpec("Q3", "Q3", x => x.WaterMeterData().Q3.ToString(), (x, y, z) => z.WaterMeterData().Q3.ToString())); + AllItems.Add(new ItemSpec("Q2", "Q2", x => x.WaterMeterData().Q2_Qt.ToString(), (x, y, z) => z.WaterMeterData().Q2_Qt.ToString())); + AllItems.Add(new ItemSpec("Q1", "Q1", x => x.WaterMeterData().Q1_Qmin.ToString(), (x, y, z) => z.WaterMeterData().Q1_Qmin.ToString())); + AllItems.Add(new ItemSpec("Qmax", "Qmax", x => x.WaterMeterData().Q4_Qmax.ToString(), (x, y, z) => z.WaterMeterData().Q4_Qmax.ToString())); + AllItems.Add(new ItemSpec("Qn", "Qn", x => x.WaterMeterData().Q3.ToString(), (x, y, z) => z.WaterMeterData().Q3.ToString())); + AllItems.Add(new ItemSpec("Qt", "Qt", x => x.WaterMeterData().Q2_Qt.ToString(), (x, y, z) => z.WaterMeterData().Q2_Qt.ToString())); + AllItems.Add(new ItemSpec("Qmin", "Qmin", x => x.WaterMeterData().Q1_Qmin.ToString(), (x, y, z) => z.WaterMeterData().Q1_Qmin.ToString())); + + /// Water meters results + AllItems.Add(new ItemSpec("Serial Nr", "s/n", x => x.WaterMeter.SerialNr, (x, y, z) => z.WaterMeter.SerialNr)); + AllItems.Add(new ItemSpec("Purchase order", "PO", x => x.WaterMeter.PurchaseOrder, (x, y, z) => z.WaterMeter.PurchaseOrder)); + AllItems.Add(new ItemSpec("Year of production", "Year", x => x.WaterMeter.YearOfProduction.ToString(), (x, y, z) => z.WaterMeter.YearOfProduction.ToString())); + AllItems.Add(new ItemSpec("WM Position", "Pos.", x => x.WaterMeter.WMPosition.ToString(), (x, y, z) => z.WaterMeter.WMPosition.ToString())); + + /// Water meters results (single) + AllItems.Add(new ItemSpec("End state", "End state", x => x.EndState(), null)); + AllItems.Add(new ItemSpec("Pulses", "Pulses", x => x.PulsesMeter.ToString(), null)); + AllItems.Add(new ItemSpec("Pulses/liter", "Pulses/liter", x => x.PulsesPerLiter.ToString(), null)); + AllItems.Add(new ItemSpec("Reference pulses", "Ref.pulses", x => x.PulsesMaster.ToString(), null)); + + /// Water meters results (combined) + AllItems.Add(new ItemSpec("Q rise", "Q rise [m3/h]", null, (x, y, z) => (z.QRise() == 0) ? "-" : Utils.DoubleToStr(z.QRise(), 4))); + AllItems.Add(new ItemSpec("Q fall", "Q fall [m3/h]", null, (x, y, z) => (z.QFall() == 0) ? "-" : Utils.DoubleToStr(z.QFall(), 4))); + AllItems.Add(new ItemSpec("Error large WM", "Error-L [%]", null, (x, y, z) => x.Error.ToString("F2"))); + AllItems.Add(new ItemSpec("Error small WM", "Error-S [%]", null, (x, y, z) => y.Error.ToString("F2"))); + AllItems.Add(new ItemSpec("Serial Nr large WM", "s/n", null, (x, y, z) => x.SerialNr())); + AllItems.Add(new ItemSpec("Serial Nr small WM", "s/n", null, (x, y, z) => y.SerialNr())); + AllItems.Add(new ItemSpec("End state large WM", "End state", null, (x, y, z) => x.EndState())); + AllItems.Add(new ItemSpec("End state small WM", "End state", null, (x, y, z) => y.EndState())); + + /// Batch info + AllItems.Add(new ItemSpec("Batch number", "Batch#", x => x.Batch().BatchNr.ToString(), (x, y, z) => x.Batch().BatchNr.ToString())); + AllItems.Add(new ItemSpec("Test bench ID", "Bench", x => x.Batch().TestBenchId.ToString(), (x, y, z) => x.Batch().TestBenchId.ToString())); + AllItems.Add(new ItemSpec("Program version", "Ver.", x => x.Batch().ProgramVersion, (x, y, z) => x.Batch().ProgramVersion)); + AllItems.Add(new ItemSpec("User name", "User", x => x.Batch().UserName, (x, y, z) => x.Batch().UserName)); + AllItems.Add(new ItemSpec("User nr.", "User#", x => x.Batch().UserNumber.ToString(), (x, y, z) => x.Batch().UserNumber.ToString())); + AllItems.Add(new ItemSpec("Procedure name", "Procedure", x => x.Batch().ProcedureName, (x, y, z) => x.Batch().ProcedureName)); + AllItems.Add(new ItemSpec("Watermeters", "WMs", x => x.Batch().WatermetersStr, (x, y, z) => x.Batch().WatermetersStr)); + AllItems.Add(new ItemSpec("Protocol title", "Protocol", x => x.Batch().ProtocolTitle, (x, y, z) => x.Batch().ProtocolTitle)); + AllItems.Add(new ItemSpec("Batch start time", "Start", x => x.Batch().StartTime.ToShortTimeString(), (x, y, z) => x.Batch().StartTime.ToShortTimeString())); + AllItems.Add(new ItemSpec("Batch end time", "End", x => x.Batch().EndTime.ToShortTimeString(), (x, y, z) => x.Batch().EndTime.ToShortTimeString())); + } public static ItemSpec GetItem(string name) { @@ -162,49 +192,5 @@ namespace Results } return result; } - - /// - /// Converts float number to a string with the specified number of valid digits - /// - /// Float value to be converted to a string - /// Number of valid digits: 4, 3, or 2 (otherwise a full precision number is printed) - /// String representation of the float number - public static string DoubleToStr(double value, int validDigits) - { - if (-float.Epsilon <= value && value <= float.Epsilon) - { - return "0"; - } - else if (validDigits == 4) - { - if (value >= 999.5 || value < -999.5) return value.ToString("F0"); - else if (value >= 99.95 || value < -99.95) return value.ToString("F1"); - else if (value >= 9.995 || value < -9.995) return value.ToString("F2"); - else if (value >= 0.9995 || value < -0.9995) return value.ToString("F3"); - else if (value >= 0.09995 || value < -0.09995) return value.ToString("F4"); - else if (value >= 0.009995 || value < -0.009995) return value.ToString("F5"); - else return value.ToString("F6"); - } - else if (validDigits == 3) - { - if (value >= 99.5 || value < -99.5) return value.ToString("F0"); - else if (value >= 9.95 || value < -9.95) return value.ToString("F1"); - else if (value >= 0.995 || value < -0.995) return value.ToString("F2"); - else if (value >= 0.0995 || value < -0.0995) return value.ToString("F3"); - else if (value >= 0.00995 || value < -0.00995) return value.ToString("F4"); - else if (value >= 0.000995 || value < -0.000995) return value.ToString("F5"); - else return value.ToString("F6"); - } - else if (validDigits == 2) - { - if (value >= 9.5 || value < -9.5) return value.ToString("F0"); - else if (value >= 0.95 || value < -0.95) return value.ToString("F1"); - else if (value >= 0.095 || value < -0.095) return value.ToString("F2"); - else if (value >= 0.0095 || value < -0.0095) return value.ToString("F3"); - else if (value >= 0.00095 || value < -0.00095) return value.ToString("F4"); - else return value.ToString("F5"); - } - else return value.ToString(); - } } } diff --git a/Results/Properties/AssemblyInfo.cs b/Results/Properties/AssemblyInfo.cs index 7f985668f..0c982a6d7 100644 --- a/Results/Properties/AssemblyInfo.cs +++ b/Results/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.5.265.0")] -[assembly: AssemblyFileVersion("2.5.265.0")] +[assembly: AssemblyVersion("2.5.276.0")] +[assembly: AssemblyFileVersion("2.5.276.0")] diff --git a/Results/Results.csproj b/Results/Results.csproj index 40c53f9ef..3b48b771a 100644 --- a/Results/Results.csproj +++ b/Results/Results.csproj @@ -75,6 +75,7 @@ + diff --git a/Results/Utils.cs b/Results/Utils.cs index 64d569ae0..401694d70 100644 --- a/Results/Utils.cs +++ b/Results/Utils.cs @@ -1,5 +1,9 @@ -using System; +/// +/// Copyright (c) 2016 Sensus Metering Systems +/// +using System; using System.Text; +using Config.Entities; namespace Results { @@ -10,5 +14,49 @@ namespace Results if (repeats == 1) return name; return string.Format("{0} ({1}/{2})", name, repetitionNr, repeats); } - } + + /// + /// Converts float number to a string with the specified number of valid digits + /// + /// Float value to be converted to a string + /// Number of valid digits: 4, 3, or 2 (otherwise a full precision number is printed) + /// String representation of the float number + public static string DoubleToStr(double value, int validDigits) + { + if (-float.Epsilon <= value && value <= float.Epsilon) + { + return "0"; + } + else if (validDigits == 4) + { + if (value >= 999.5 || value < -999.5) return value.ToString("F0"); + else if (value >= 99.95 || value < -99.95) return value.ToString("F1"); + else if (value >= 9.995 || value < -9.995) return value.ToString("F2"); + else if (value >= 0.9995 || value < -0.9995) return value.ToString("F3"); + else if (value >= 0.09995 || value < -0.09995) return value.ToString("F4"); + else if (value >= 0.009995 || value < -0.009995) return value.ToString("F5"); + else return value.ToString("F6"); + } + else if (validDigits == 3) + { + if (value >= 99.5 || value < -99.5) return value.ToString("F0"); + else if (value >= 9.95 || value < -9.95) return value.ToString("F1"); + else if (value >= 0.995 || value < -0.995) return value.ToString("F2"); + else if (value >= 0.0995 || value < -0.0995) return value.ToString("F3"); + else if (value >= 0.00995 || value < -0.00995) return value.ToString("F4"); + else if (value >= 0.000995 || value < -0.000995) return value.ToString("F5"); + else return value.ToString("F6"); + } + else if (validDigits == 2) + { + if (value >= 9.5 || value < -9.5) return value.ToString("F0"); + else if (value >= 0.95 || value < -0.95) return value.ToString("F1"); + else if (value >= 0.095 || value < -0.095) return value.ToString("F2"); + else if (value >= 0.0095 || value < -0.0095) return value.ToString("F3"); + else if (value >= 0.00095 || value < -0.00095) return value.ToString("F4"); + else return value.ToString("F5"); + } + else return value.ToString(); + } + } } diff --git a/Results/WMeterRsltItemSpec.cs b/Results/WMeterRsltItemSpec.cs new file mode 100644 index 000000000..47ff02d6c --- /dev/null +++ b/Results/WMeterRsltItemSpec.cs @@ -0,0 +1,259 @@ +/// +/// Copyright (c) 2013-2016 Sensus Metering Systems +/// +using System; +using System.Collections.Generic; +using Results.Entities; + +namespace Results +{ + public class WMeterRsltItemSpec + { + /// + /// Public fields + /// + public readonly int Uid; + public readonly string Name; /// Name-s of all items must be unique + public string Header; /// Specifies the header to be printed at the top of the table + public string TestID; /// Specifies the test + public Config.Unit Units; /// Specifies units for the output + public string Format; /// Specifies format for the output + public string Precision; /// Specifies precision for the output + public int Width; /// Specifies the number of characters of the output, 0 = automatic + public Config.Entities.Alignment Alignment; /// Specifies alignment for the output + + public WMeterRsltItemSpec Clone() + { + WMeterRsltItemSpec item2 = new WMeterRsltItemSpec(Uid, Name, printDlgt); + item2.Header = Header; + item2.TestID = TestID; + item2.Units = Units; + item2.Format = Format; + item2.Precision = Precision; + item2.Width = Width; + item2.Alignment = Alignment; + return item2; + } + + /// + /// Function to pick a MeterTestResult field and convert it into a string + /// + public delegate string PrintDlgt(WaterMeter waterMeterResult, string testID, Config.Unit units, string format, string precision); + + private readonly PrintDlgt printDlgt; + + /// Safe wrapper which replaces null-s by empty strings + public string Print(WaterMeter waterMeterResult) + { + string str = printDlgt(waterMeterResult, TestID, Units, Format, Precision); + if (str == null) str = string.Empty; + + if (!string.IsNullOrEmpty(Format)) + { + str = string.Format(Format, str); + } + + int len = str.Length; + if (Width == 0 || len >= Width) + { + return str; + } + else if (Alignment == Config.Entities.Alignment.Left) + { + return str + new string(' ', Width - len); + } + else if (Alignment == Config.Entities.Alignment.Right) + { + return new string(' ', Width - len) + str; + } + else // Alignment.Center or Alignment.Justified + { + int nrSpaces = Width - len; + return new string(' ', nrSpaces / 2) + str + new string(' ', nrSpaces - (nrSpaces / 2)); + } + } + + /// + /// Public constructor + /// + public WMeterRsltItemSpec(int uid, string name, PrintDlgt printDlgt) + { + Uid = uid; + Name = name; + this.printDlgt = printDlgt; + } + + + /// Static list of all available items + public static readonly IList AllItems; + + /// Static constructor that initializes the list of all items + static WMeterRsltItemSpec() + { + AllItems = new List(); + + AllItems.Add(new WMeterRsltItemSpec(0, "String", (w, t, u, f, p) => f)); + + /// Common + AllItems.Add(new WMeterRsltItemSpec(1, "Test name", (w, t, u, f, p) => w.GetTestRslt(t).Name())); + AllItems.Add(new WMeterRsltItemSpec(2, "Procedure name", (w, t, u, f, p) => w.ProcedureName())); + AllItems.Add(new WMeterRsltItemSpec(3, "Batch number", (w, t, u, f, p) => w.BatchNr().ToString())); + AllItems.Add(new WMeterRsltItemSpec(4, "Test method", (w, t, u, f, p) => w.GetTestRslt(t).Method())); + AllItems.Add(new WMeterRsltItemSpec(5, "Density", (w, t, u, f, p) => w.GetTestRslt(t).DensityOut.ToString(string.IsNullOrEmpty(p) ? "F1" : p))); /// [kg/m3] + + /// Target values + AllItems.Add(new WMeterRsltItemSpec(6, "Q from", (w, t, u, f, p) => w.GetTestRslt(t).Qfrom().ToString(string.IsNullOrEmpty(p) ? "F3" : p))); + AllItems.Add(new WMeterRsltItemSpec(7, "Q to", (w, t, u, f, p) => w.GetTestRslt(t).Qto().ToString(string.IsNullOrEmpty(p) ? "F3" : p))); + AllItems.Add(new WMeterRsltItemSpec(8, "Test volume", (w, t, u, f, p) => Config.Units.ConvertTo(u, w.GetTestRslt(t).TargetVolume()).ToString(string.IsNullOrEmpty(p) ? "F1" : p))); + AllItems.Add(new WMeterRsltItemSpec(9, "Error limit Lo", (w, t, u, f, p) => w.GetTestRslt(t).ErrLimLo().ToString(string.IsNullOrEmpty(p) ? "F1" : p))); + AllItems.Add(new WMeterRsltItemSpec(10, "Error limit Hi", (w, t, u, f, p) => w.GetTestRslt(t).ErrLimHi().ToString(string.IsNullOrEmpty(p) ? "F1" : p))); + AllItems.Add(new WMeterRsltItemSpec(11, "Uncertainty", (w, t, u, f, p) => w.GetTestRslt(t).Uncertainty().ToString(string.IsNullOrEmpty(p) ? "F2" : p))); + + /// Test results + AllItems.Add(new WMeterRsltItemSpec(12, "Test start time", (w, t, u, f, p) => w.GetTestRslt(t).StartTime.ToShortTimeString())); + AllItems.Add(new WMeterRsltItemSpec(13, "Test end time", (w, t, u, f, p) => w.GetTestRslt(t).EndTime.ToShortTimeString())); + AllItems.Add(new WMeterRsltItemSpec(14, "Test time", (w, t, u, f, p) => w.GetTestRslt(t).TestTime.ToString(string.IsNullOrEmpty(p) ? "F2" : p))); + AllItems.Add(new WMeterRsltItemSpec(15, "Flow", (w, t, u, f, p) => Utils.DoubleToStr(Config.Units.ConvertTo(u, w.GetTestRslt(t).FlowVolume), 4))); + AllItems.Add(new WMeterRsltItemSpec(16, "T in", (w, t, u, f, p) => Config.Units.ConvertTo(u, w.GetTestRslt(t).TempInAvrg).ToString(string.IsNullOrEmpty(p) ? "F2" : p))); + AllItems.Add(new WMeterRsltItemSpec(17, "T out", (w, t, u, f, p) => Config.Units.ConvertTo(u, w.GetTestRslt(t).TempOutAvrg).ToString(string.IsNullOrEmpty(p) ? "F2" : p))); + AllItems.Add(new WMeterRsltItemSpec(18, "T div", (w, t, u, f, p) => Config.Units.ConvertTo(u, w.GetTestRslt(t).TempDivAvrg).ToString(string.IsNullOrEmpty(p) ? "F2" : p))); + AllItems.Add(new WMeterRsltItemSpec(19, "P up", (w, t, u, f, p) => Config.Units.ConvertTo(u, w.GetTestRslt(t).PressUpAvrg).ToString(string.IsNullOrEmpty(p) ? "F3" : p))); + AllItems.Add(new WMeterRsltItemSpec(20, "P up start", (w, t, u, f, p) => Config.Units.ConvertTo(u, w.GetTestRslt(t).PressUpStart).ToString(string.IsNullOrEmpty(p) ? "F3" : p))); + AllItems.Add(new WMeterRsltItemSpec(21, "P up end", (w, t, u, f, p) => Config.Units.ConvertTo(u, w.GetTestRslt(t).PressUpEnd).ToString(string.IsNullOrEmpty(p) ? "F3" : p))); + AllItems.Add(new WMeterRsltItemSpec(22, "P down", (w, t, u, f, p) => Config.Units.ConvertTo(u, w.GetTestRslt(t).PressDownAvrg).ToString(string.IsNullOrEmpty(p) ? "F3" : p))); + AllItems.Add(new WMeterRsltItemSpec(23, "P down start", (w, t, u, f, p) => Config.Units.ConvertTo(u, w.GetTestRslt(t).PressDownStart).ToString(string.IsNullOrEmpty(p) ? "F3" : p))); + AllItems.Add(new WMeterRsltItemSpec(24, "P down end", (w, t, u, f, p) => Config.Units.ConvertTo(u, w.GetTestRslt(t).PressDownEnd).ToString(string.IsNullOrEmpty(p) ? "F3" : p))); + AllItems.Add(new WMeterRsltItemSpec(25, "Reference error", (w, t, u, f, p) => w.GetTestRslt(t).ErrorMaster.ToString(string.IsNullOrEmpty(p) ? "F3" : p))); + AllItems.Add(new WMeterRsltItemSpec(26, "Ambient temperature", (w, t, u, f, p) => Config.Units.ConvertTo(u, w.GetTestRslt(t).AmbientTempAve).ToString(string.IsNullOrEmpty(p) ? "F1" : p))); + AllItems.Add(new WMeterRsltItemSpec(27, "Ambient pressure", (w, t, u, f, p) => Config.Units.ConvertTo(u, w.GetTestRslt(t).AmbientPressAve).ToString(string.IsNullOrEmpty(p) ? "F0" : p))); + AllItems.Add(new WMeterRsltItemSpec(28, "Ambient humidity", (w, t, u, f, p) => Config.Units.ConvertTo(u, w.GetTestRslt(t).AmbientHumiAve).ToString(string.IsNullOrEmpty(p) ? "F1" : p))); + + /// Single and combined meter results + AllItems.Add(new WMeterRsltItemSpec(29, "Volume", (w, t, u, f, p) => Config.Units.ConvertTo(u, w.GetMeterTestRslt(t).VolumeMeter).ToString(string.IsNullOrEmpty(p) ? "F3" : p))); + AllItems.Add(new WMeterRsltItemSpec(30, "Reference volume", (w, t, u, f, p) => Config.Units.ConvertTo(u, w.GetMeterTestRslt(t).VolumeRef).ToString(string.IsNullOrEmpty(p) ? "F3" : p))); + AllItems.Add(new WMeterRsltItemSpec(31, "Error", (w, t, u, f, p) => w.GetMeterTestRslt(t).Error.ToString(string.IsNullOrEmpty(p) ? "F2" : p))); + AllItems.Add(new WMeterRsltItemSpec(32, "Passed", (w, t, u, f, p) => w.GetMeterTestRslt(t).PassedColorStr())); + + /// Water meter info + AllItems.Add(new WMeterRsltItemSpec(33, "Watermeter type", (w, t, u, f, p) => w.WaterMeterData.ProductName)); + AllItems.Add(new WMeterRsltItemSpec(34, "Producer", (w, t, u, f, p) => w.WaterMeterData.Producer)); + AllItems.Add(new WMeterRsltItemSpec(35, "Metrological class", (w, t, u, f, p) => w.WaterMeterData.MetrologicalClass)); + AllItems.Add(new WMeterRsltItemSpec(36, "Approval info", (w, t, u, f, p) => w.WaterMeterData.ApprovalInfo)); + AllItems.Add(new WMeterRsltItemSpec(37, "Q4", (w, t, u, f, p) => string.IsNullOrEmpty(p) ? Config.Units.ConvertTo(u, w.WaterMeterData.Q4_Qmax).ToString() + : Config.Units.ConvertTo(u, w.WaterMeterData.Q4_Qmax).ToString(p))); + AllItems.Add(new WMeterRsltItemSpec(38, "Q3", (w, t, u, f, p) => string.IsNullOrEmpty(p) ? Config.Units.ConvertTo(u, w.WaterMeterData.Q3).ToString() + : Config.Units.ConvertTo(u, w.WaterMeterData.Q3).ToString(p))); + AllItems.Add(new WMeterRsltItemSpec(39, "Q2", (w, t, u, f, p) => string.IsNullOrEmpty(p) ? Config.Units.ConvertTo(u, w.WaterMeterData.Q2_Qt).ToString() + : Config.Units.ConvertTo(u, w.WaterMeterData.Q2_Qt).ToString(p))); + AllItems.Add(new WMeterRsltItemSpec(40, "Q1", (w, t, u, f, p) => string.IsNullOrEmpty(p) ? Config.Units.ConvertTo(u, w.WaterMeterData.Q1_Qmin).ToString() + : Config.Units.ConvertTo(u, w.WaterMeterData.Q1_Qmin).ToString(p))); + AllItems.Add(new WMeterRsltItemSpec(41, "Qmax", (w, t, u, f, p) => string.IsNullOrEmpty(p) ? Config.Units.ConvertTo(u, w.WaterMeterData.Q4_Qmax).ToString() + : Config.Units.ConvertTo(u, w.WaterMeterData.Q4_Qmax).ToString(p))); + AllItems.Add(new WMeterRsltItemSpec(42, "Qn", (w, t, u, f, p) => string.IsNullOrEmpty(p) ? Config.Units.ConvertTo(u, w.WaterMeterData.Q3).ToString() + : Config.Units.ConvertTo(u, w.WaterMeterData.Q3).ToString(p))); + AllItems.Add(new WMeterRsltItemSpec(43, "Qt", (w, t, u, f, p) => string.IsNullOrEmpty(p) ? Config.Units.ConvertTo(u, w.WaterMeterData.Q2_Qt).ToString() + : Config.Units.ConvertTo(u, w.WaterMeterData.Q2_Qt).ToString(p))); + AllItems.Add(new WMeterRsltItemSpec(44, "Qmin", (w, t, u, f, p) => string.IsNullOrEmpty(p) ? Config.Units.ConvertTo(u, w.WaterMeterData.Q1_Qmin).ToString() + : Config.Units.ConvertTo(u, w.WaterMeterData.Q1_Qmin).ToString(p))); + + /// Water meters results + AllItems.Add(new WMeterRsltItemSpec(45, "Serial Nr", (w, t, u, f, p) => w.SerialNr)); + AllItems.Add(new WMeterRsltItemSpec(46, "Purchase order", (w, t, u, f, p) => w.PurchaseOrder)); + AllItems.Add(new WMeterRsltItemSpec(47, "Year of production", (w, t, u, f, p) => w.YearOfProduction.ToString())); + AllItems.Add(new WMeterRsltItemSpec(48, "WM Position", (w, t, u, f, p) => w.WMPosition.ToString())); + + /// Water meters results (single) + AllItems.Add(new WMeterRsltItemSpec(49, "End state", (w, t, u, f, p) => w.EndState)); + AllItems.Add(new WMeterRsltItemSpec(50, "Pulses", (w, t, u, f, p) => w.GetMeterTestRslt(t).PulsesMeter.ToString())); + AllItems.Add(new WMeterRsltItemSpec(51, "Pulses/liter", (w, t, u, f, p) => string.IsNullOrEmpty(p) ? w.GetMeterTestRslt(t).PulsesPerLiter.ToString() + : w.GetMeterTestRslt(t).PulsesPerLiter.ToString(p))); + AllItems.Add(new WMeterRsltItemSpec(52, "Reference pulses", (w, t, u, f, p) => w.GetMeterTestRslt(t).PulsesMaster.ToString())); + + /// Batch info + AllItems.Add(new WMeterRsltItemSpec(53, "Batch number", (w, t, u, f, p) => w.Batch.BatchNr.ToString())); + AllItems.Add(new WMeterRsltItemSpec(54, "Test bench ID", (w, t, u, f, p) => w.Batch.TestBenchId.ToString())); + AllItems.Add(new WMeterRsltItemSpec(55, "Program version", (w, t, u, f, p) => w.Batch.ProgramVersion)); + AllItems.Add(new WMeterRsltItemSpec(56, "User name", (w, t, u, f, p) => w.Batch.UserName)); + AllItems.Add(new WMeterRsltItemSpec(57, "User nr.", (w, t, u, f, p) => w.Batch.UserNumber.ToString())); + AllItems.Add(new WMeterRsltItemSpec(58, "Procedure name", (w, t, u, f, p) => w.Batch.ProcedureName)); + AllItems.Add(new WMeterRsltItemSpec(59, "Watermeters", (w, t, u, f, p) => w.Batch.WatermetersStr)); + AllItems.Add(new WMeterRsltItemSpec(60, "Protocol title", (w, t, u, f, p) => w.Batch.ProtocolTitle)); + AllItems.Add(new WMeterRsltItemSpec(61, "Batch start time", (w, t, u, f, p) => w.Batch.StartTime.ToShortTimeString())); + AllItems.Add(new WMeterRsltItemSpec(62, "Batch end time", (w, t, u, f, p) => w.Batch.EndTime.ToShortTimeString())); + } + + /// + /// Converts a list of 'Output item specifications' to a string array + /// + /// + /// + public static string[] ToStrArray(IList items) + { + int count = (items != null) ? items.Count : 0; + string[] result = new string[count]; + for (int i = 0; i < count; i++) + { + result[i] = string.Format("{0}~{1}~{2}~{3}~{4}~{5}~{6}~{7}", + items[i].Uid, + items[i].Header, + items[i].TestID, + items[i].Units, + items[i].Format, + items[i].Precision, + items[i].Width, + items[i].Alignment); + } + return result; + } + + /// + /// Converts a string array to a list of 'Output item specifications' + /// + /// + /// + public static IList FromStrArray(string[] strArray) + { + IList result = new List(); + if (strArray != null) + { + for (int i = 0; i < strArray.Length; i++) + { + string[] field = strArray[i].Split(new char[] { '~' }); + try + { + WMeterRsltItemSpec item = GetItem(int.Parse(field[0])); + + item.Header = field[1]; + item.TestID = field[2]; + item.Units = 0; + for (Config.Unit u = 0; u < Config.Unit.Count; u++) if (u.ToString().Equals(field[3])) { item.Units = u; break; } + item.Format = field[4]; + item.Precision = field[5]; + item.Width = int.Parse(field[6]); + item.Alignment = 0; + for (Config.Entities.Alignment a = 0; a < Config.Entities.Alignment.Count; a++) if (a.ToString().Equals(field[7])) { item.Alignment = a; break; } + + result.Add(item); + } + catch + { + WMeterRsltItemSpec item = GetItem(0); + item.Format = string.Format("Parse error: {0}", strArray[i]); + result.Add(item); + } + } + } + return result; + } + + + private static WMeterRsltItemSpec GetItem(int uid) + { + foreach (var item in AllItems) + { + if (item.Uid == uid) return item.Clone(); + } + return null; + } + } +} diff --git a/TestBenchFramework/BenchControl/Output/FileWriters/Basic/ResultsConfigDlg.cs b/TestBenchFramework/BenchControl/Output/FileWriters/Basic/ResultsConfigDlg.cs index f76e185c2..412d32a1d 100644 --- a/TestBenchFramework/BenchControl/Output/FileWriters/Basic/ResultsConfigDlg.cs +++ b/TestBenchFramework/BenchControl/Output/FileWriters/Basic/ResultsConfigDlg.cs @@ -4,15 +4,36 @@ using System; using System.Collections.Generic; using System.Windows.Forms; +using log4net; using Config.Entities; using TBF.Resources; +using TBF.UiControls; namespace TBF.BenchControl.Output.FileWriters.Basic { public partial class ResultsConfigDlg : Form { - public IList AvailableItems; - public IList SelectedItems; + /// + /// ListViewEx columns + /// + enum Column + { + Item, + Header, + TestID, + Units, + Format, + Precision, + Width, + Alignment, + Count, + } + Control[] editors; + + + public IList AvailableItems; + public IList SelectedItems; + public bool Compound; /// false = single meter items, true = combined meter items @@ -36,24 +57,124 @@ namespace TBF.BenchControl.Output.FileWriters.Basic void ResultsConfig_Load(object sender, EventArgs e) { Localize(); - RedrawAvailable(); + + /// Add columns to ListViewEx + selectedResultsListViewEx.Columns.Add(new ColumnHeader { Text = "Item", Width = 120 }); + selectedResultsListViewEx.Columns.Add(new ColumnHeader { Text = "Header" }); + selectedResultsListViewEx.Columns.Add(new ColumnHeader { Text = "Test ID" }); + selectedResultsListViewEx.Columns.Add(new ColumnHeader { Text = "Units" }); + selectedResultsListViewEx.Columns.Add(new ColumnHeader { Text = "Format" }); + selectedResultsListViewEx.Columns.Add(new ColumnHeader { Text = "Precision" }); + selectedResultsListViewEx.Columns.Add(new ColumnHeader { Text = "Width" }); + selectedResultsListViewEx.Columns.Add(new ColumnHeader { Text = "Alignment" }); + + /// Create controls used by ListViewEx to edit items + ComboBox unitsCB = new ComboBox(); + unitsCB.Items.Add("---"); /// Use "---" instead of "None" + for (Config.Unit u = (Config.Unit)1; u < Config.Unit.Count; u++) + { + unitsCB.Items.Add(u.ToString().Replace('p','/')); + } + + ComboBox alignmentCB = new ComboBox(); + for (Config.Entities.Alignment a = 0; a < Config.Entities.Alignment.Count; a++) + { + alignmentCB.Items.Add(a.ToString()); + } + + editors = new Control[] + { + null, + new TextBox(), + new TextBox(), + unitsCB, + new TextBox(), + new TextBox(), + new TextBox(), + alignmentCB, + }; + foreach (var edi in editors) Controls.Add(edi); + + selectedResultsListViewEx.SubItemClicked += new SubItemEventHandler(selectedResultsListViewEx_SubItemClicked); + selectedResultsListViewEx.SubItemEndEditing += new SubItemEndEditingEventHandler(selectedResultsListViewEx_SubItemEndEditing); + + RedrawAvailable(); RedrawSelected(); } + void selectedResultsListViewEx_SubItemClicked(object sender, SubItemEventArgs e) + { + if ((e.SubItem > 0) && (e.SubItem < (int)Column.Count)) + { + selectedResultsListViewEx.StartEditing(editors[e.SubItem], e.Item, e.SubItem); + } + } + + void selectedResultsListViewEx_SubItemEndEditing(object sender, SubItemEndEditingEventArgs e) + { + ListViewItem lvi = e.Item; + Results.WMeterRsltItemSpec item = lvi.Tag as Results.WMeterRsltItemSpec; + + switch ((Column)e.SubItem) + { + case Column.Header: item.Header = e.DisplayText; return; + case Column.TestID: item.TestID = e.DisplayText; return; + case Column.Format: item.Format = e.DisplayText; return; + case Column.Precision: item.Precision = e.DisplayText; return; + + case Column.Units: + if (editors[e.SubItem].Text == "---") { item.Units = 0; return; }; + for (Config.Unit u = (Config.Unit)1; u < Config.Unit.Count; u++) + { + if (u.ToString().Replace('p', '/').Equals(editors[e.SubItem].Text)) + { + item.Units = u; + return; /// OK + } + } + break; /// Error + + case Column.Alignment: + for (Config.Entities.Alignment a = 0; a < Config.Entities.Alignment.Count; a++) + { + if (a.ToString().Equals(editors[e.SubItem].Text)) + { + item.Alignment = a; + return; + } + } + break; /// Error + + case Column.Width: + { + int width; + if (Int32.TryParse(editors[e.SubItem].Text, out width) && width >= 0) + { + item.Width = width; + return; /// OK + } + break; /// Error + } + default: + return; /// OK + } + + e.DisplayText = e.Item.SubItems[e.SubItem].Text; + e.Cancel = true; + return; + } + /// /// Redraw selected items (right hand side) /// void RedrawAvailable() { availableResultsListBox.Items.Clear(); - AvailableItems = new List(); - foreach (var item in Results.ItemSpec.AllItems) + AvailableItems = new List(); + foreach (var item in Results.WMeterRsltItemSpec.AllItems) { - if (!SelectedItems.Contains(item) && (Compound ? item.CanPrintCombined : item.CanPrintSingle)) - { - AvailableItems.Add(item); - availableResultsListBox.Items.Add(item.Name); - } + AvailableItems.Add(item); + availableResultsListBox.Items.Add(item.Name); } } @@ -62,21 +183,34 @@ namespace TBF.BenchControl.Output.FileWriters.Basic /// void RedrawSelected() { - selectedResultsListBox.Items.Clear(); + selectedResultsListViewEx.Items.Clear(); foreach (var item in SelectedItems) { - selectedResultsListBox.Items.Add(item.Name); + ListViewItem lvi = new ListViewItem(item.Name); /// Item + lvi.Tag = item; + lvi.SubItems.Add(item.Header); /// Header + lvi.SubItems.Add(item.TestID); /// TestID + lvi.SubItems.Add((item.Units == Config.Unit.None) ? "---" : item.Units.ToString().Replace('p', '/')); /// Units + lvi.SubItems.Add(item.Format); /// Format + lvi.SubItems.Add(item.Precision); /// Precision + lvi.SubItems.Add(item.Width.ToString()); /// Width + lvi.SubItems.Add(item.Alignment.ToString()); /// Alignment + + selectedResultsListViewEx.Items.Add(lvi); } } + void UpdateSelectedFromView() + { + } + void availableResultsListBox_DoubleClick(object sender, EventArgs e) { /// Double click works when just one item is selected - IList itemsToRemove = new List(); if (availableResultsListBox.SelectedIndices.Count == 1) { - var item = AvailableItems[availableResultsListBox.SelectedIndices[0]]; - SelectedItems.Add(item); + var oriItem = AvailableItems[availableResultsListBox.SelectedIndices[0]]; + SelectedItems.Add(oriItem.Clone()); RedrawAvailable(); RedrawSelected(); } @@ -89,8 +223,8 @@ namespace TBF.BenchControl.Output.FileWriters.Basic for (int i = availableResultsListBox.SelectedIndices.Count - 1; i >= 0; i--) { - var item = AvailableItems[availableResultsListBox.SelectedIndices[i]]; - SelectedItems.Add(item); + var oriItem = AvailableItems[availableResultsListBox.SelectedIndices[i]]; + SelectedItems.Add(oriItem.Clone()); } RedrawAvailable(); RedrawSelected(); @@ -100,9 +234,9 @@ namespace TBF.BenchControl.Output.FileWriters.Basic { /// Double click works when just one item is selected - if (selectedResultsListBox.SelectedIndices.Count == 1) + if (selectedResultsListViewEx.SelectedIndices.Count == 1) { - SelectedItems.RemoveAt(selectedResultsListBox.SelectedIndices[0]); + SelectedItems.RemoveAt(selectedResultsListViewEx.SelectedIndices[0]); RedrawAvailable(); RedrawSelected(); } @@ -112,9 +246,9 @@ namespace TBF.BenchControl.Output.FileWriters.Basic { /// Remove from the list (the last selected item first so that the indexes are not affected) - for (int i = selectedResultsListBox.SelectedIndices.Count - 1; i >= 0; i--) + for (int i = selectedResultsListViewEx.SelectedIndices.Count - 1; i >= 0; i--) { - SelectedItems.RemoveAt(selectedResultsListBox.SelectedIndices[i]); + SelectedItems.RemoveAt(selectedResultsListViewEx.SelectedIndices[i]); } RedrawAvailable(); RedrawSelected(); @@ -131,7 +265,7 @@ namespace TBF.BenchControl.Output.FileWriters.Basic void okButton_Click(object sender, EventArgs e) { - DialogResult = DialogResult.OK; + DialogResult = DialogResult.OK; Close(); } } diff --git a/TestBenchFramework/BenchControl/Output/FileWriters/Basic/ResultsConfigDlg.designer.cs b/TestBenchFramework/BenchControl/Output/FileWriters/Basic/ResultsConfigDlg.designer.cs index 240afedaa..5aec4ee33 100644 --- a/TestBenchFramework/BenchControl/Output/FileWriters/Basic/ResultsConfigDlg.designer.cs +++ b/TestBenchFramework/BenchControl/Output/FileWriters/Basic/ResultsConfigDlg.designer.cs @@ -31,125 +31,132 @@ namespace TBF.BenchControl.Output.FileWriters.Basic /// private void InitializeComponent() { - this.okButton = new System.Windows.Forms.Button(); - this.cancelButton = new System.Windows.Forms.Button(); - this.availableResultsListBox = new System.Windows.Forms.ListBox(); - this.selectedResultsListBox = new System.Windows.Forms.ListBox(); - this.availableResultsLabel = new System.Windows.Forms.Label(); - this.selectedResultsLabel = new System.Windows.Forms.Label(); - this.removeAllButton = new System.Windows.Forms.Button(); - this.removeButton = new System.Windows.Forms.Button(); - this.addButton = new System.Windows.Forms.Button(); - this.SuspendLayout(); - // - // okButton - // - this.okButton.Location = new System.Drawing.Point(90, 236); - this.okButton.Name = "okButton"; - this.okButton.Size = new System.Drawing.Size(104, 30); - this.okButton.TabIndex = 4; - this.okButton.Text = "OK"; - this.okButton.UseVisualStyleBackColor = true; - this.okButton.Click += new System.EventHandler(this.okButton_Click); - // - // cancelButton - // - this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.cancelButton.Location = new System.Drawing.Point(211, 236); - this.cancelButton.Name = "cancelButton"; - this.cancelButton.Size = new System.Drawing.Size(104, 30); - this.cancelButton.TabIndex = 5; - this.cancelButton.Text = "Cancel"; - this.cancelButton.UseVisualStyleBackColor = true; - // - // availableResultsListBox - // - this.availableResultsListBox.FormattingEnabled = true; - this.availableResultsListBox.Location = new System.Drawing.Point(12, 31); - this.availableResultsListBox.Name = "availableResultsListBox"; - this.availableResultsListBox.Size = new System.Drawing.Size(135, 186); - this.availableResultsListBox.TabIndex = 6; - this.availableResultsListBox.DoubleClick += new System.EventHandler(this.availableResultsListBox_DoubleClick); - // - // selectedResultsListBox - // - this.selectedResultsListBox.FormattingEnabled = true; - this.selectedResultsListBox.Location = new System.Drawing.Point(252, 31); - this.selectedResultsListBox.Name = "selectedResultsListBox"; - this.selectedResultsListBox.Size = new System.Drawing.Size(135, 186); - this.selectedResultsListBox.TabIndex = 7; - this.selectedResultsListBox.DoubleClick += new System.EventHandler(this.selectedResultsListBox_DoubleClick); - // - // availableResultsLabel - // - this.availableResultsLabel.AutoSize = true; - this.availableResultsLabel.Location = new System.Drawing.Point(12, 9); - this.availableResultsLabel.Name = "availableResultsLabel"; - this.availableResultsLabel.Size = new System.Drawing.Size(86, 13); - this.availableResultsLabel.TabIndex = 8; - this.availableResultsLabel.Text = "Available results:"; - // - // selectedResultsLabel - // - this.selectedResultsLabel.AutoSize = true; - this.selectedResultsLabel.Location = new System.Drawing.Point(249, 9); - this.selectedResultsLabel.Name = "selectedResultsLabel"; - this.selectedResultsLabel.Size = new System.Drawing.Size(85, 13); - this.selectedResultsLabel.TabIndex = 9; - this.selectedResultsLabel.Text = "Selected results:"; - // - // removeAllButton - // - this.removeAllButton.Location = new System.Drawing.Point(153, 144); - this.removeAllButton.Name = "removeAllButton"; - this.removeAllButton.Size = new System.Drawing.Size(94, 30); - this.removeAllButton.TabIndex = 46; - this.removeAllButton.Text = "<< R&emove all"; - this.removeAllButton.UseVisualStyleBackColor = true; - this.removeAllButton.Click += new System.EventHandler(this.removeAllButton_Click); - // - // removeButton - // - this.removeButton.Location = new System.Drawing.Point(153, 109); - this.removeButton.Name = "removeButton"; - this.removeButton.Size = new System.Drawing.Size(93, 30); - this.removeButton.TabIndex = 45; - this.removeButton.Text = "< &Remove"; - this.removeButton.UseVisualStyleBackColor = true; - this.removeButton.Click += new System.EventHandler(this.removeButton_Click); - // - // addButton - // - this.addButton.Location = new System.Drawing.Point(153, 74); - this.addButton.Name = "addButton"; - this.addButton.Size = new System.Drawing.Size(93, 30); - this.addButton.TabIndex = 44; - this.addButton.Text = "&Add >"; - this.addButton.UseVisualStyleBackColor = true; - this.addButton.Click += new System.EventHandler(this.addButton_Click); - // - // ResultsConfig - // - this.AcceptButton = this.okButton; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this.cancelButton; - this.ClientSize = new System.Drawing.Size(399, 282); - this.Controls.Add(this.removeAllButton); - this.Controls.Add(this.removeButton); - this.Controls.Add(this.addButton); - this.Controls.Add(this.selectedResultsLabel); - this.Controls.Add(this.availableResultsLabel); - this.Controls.Add(this.selectedResultsListBox); - this.Controls.Add(this.availableResultsListBox); - this.Controls.Add(this.cancelButton); - this.Controls.Add(this.okButton); - this.Name = "ResultsConfig"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "ResultsConfig"; - this.Load += new System.EventHandler(this.ResultsConfig_Load); - this.ResumeLayout(false); - this.PerformLayout(); + this.okButton = new System.Windows.Forms.Button(); + this.cancelButton = new System.Windows.Forms.Button(); + this.availableResultsListBox = new System.Windows.Forms.ListBox(); + this.availableResultsLabel = new System.Windows.Forms.Label(); + this.selectedResultsLabel = new System.Windows.Forms.Label(); + this.removeAllButton = new System.Windows.Forms.Button(); + this.removeButton = new System.Windows.Forms.Button(); + this.addButton = new System.Windows.Forms.Button(); + this.selectedResultsListViewEx = new TBF.UiControls.ListViewEx(); + this.SuspendLayout(); + // + // okButton + // + this.okButton.Location = new System.Drawing.Point(344, 324); + this.okButton.Name = "okButton"; + this.okButton.Size = new System.Drawing.Size(104, 30); + this.okButton.TabIndex = 4; + this.okButton.Text = "OK"; + this.okButton.UseVisualStyleBackColor = true; + this.okButton.Click += new System.EventHandler(this.okButton_Click); + // + // cancelButton + // + this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.cancelButton.Location = new System.Drawing.Point(465, 324); + this.cancelButton.Name = "cancelButton"; + this.cancelButton.Size = new System.Drawing.Size(104, 30); + this.cancelButton.TabIndex = 5; + this.cancelButton.Text = "Cancel"; + this.cancelButton.UseVisualStyleBackColor = true; + // + // availableResultsListBox + // + this.availableResultsListBox.FormattingEnabled = true; + this.availableResultsListBox.Location = new System.Drawing.Point(12, 31); + this.availableResultsListBox.Name = "availableResultsListBox"; + this.availableResultsListBox.Size = new System.Drawing.Size(162, 277); + this.availableResultsListBox.TabIndex = 6; + this.availableResultsListBox.DoubleClick += new System.EventHandler(this.availableResultsListBox_DoubleClick); + // + // availableResultsLabel + // + this.availableResultsLabel.AutoSize = true; + this.availableResultsLabel.Location = new System.Drawing.Point(12, 9); + this.availableResultsLabel.Name = "availableResultsLabel"; + this.availableResultsLabel.Size = new System.Drawing.Size(86, 13); + this.availableResultsLabel.TabIndex = 8; + this.availableResultsLabel.Text = "Available results:"; + // + // selectedResultsLabel + // + this.selectedResultsLabel.AutoSize = true; + this.selectedResultsLabel.Location = new System.Drawing.Point(284, 9); + this.selectedResultsLabel.Name = "selectedResultsLabel"; + this.selectedResultsLabel.Size = new System.Drawing.Size(85, 13); + this.selectedResultsLabel.TabIndex = 9; + this.selectedResultsLabel.Text = "Selected results:"; + // + // removeAllButton + // + this.removeAllButton.Location = new System.Drawing.Point(184, 182); + this.removeAllButton.Name = "removeAllButton"; + this.removeAllButton.Size = new System.Drawing.Size(94, 30); + this.removeAllButton.TabIndex = 46; + this.removeAllButton.Text = "<< R&emove all"; + this.removeAllButton.UseVisualStyleBackColor = true; + this.removeAllButton.Click += new System.EventHandler(this.removeAllButton_Click); + // + // removeButton + // + this.removeButton.Location = new System.Drawing.Point(184, 147); + this.removeButton.Name = "removeButton"; + this.removeButton.Size = new System.Drawing.Size(93, 30); + this.removeButton.TabIndex = 45; + this.removeButton.Text = "< &Remove"; + this.removeButton.UseVisualStyleBackColor = true; + this.removeButton.Click += new System.EventHandler(this.removeButton_Click); + // + // addButton + // + this.addButton.Location = new System.Drawing.Point(184, 112); + this.addButton.Name = "addButton"; + this.addButton.Size = new System.Drawing.Size(93, 30); + this.addButton.TabIndex = 44; + this.addButton.Text = "&Add >"; + this.addButton.UseVisualStyleBackColor = true; + this.addButton.Click += new System.EventHandler(this.addButton_Click); + // + // selectedResultsListViewEx + // + this.selectedResultsListViewEx.AllowColumnReorder = true; + this.selectedResultsListViewEx.DoubleClickActivation = false; + this.selectedResultsListViewEx.FullRowSelect = true; + this.selectedResultsListViewEx.Location = new System.Drawing.Point(287, 31); + this.selectedResultsListViewEx.Name = "selectedResultsListViewEx"; + this.selectedResultsListViewEx.Size = new System.Drawing.Size(594, 277); + this.selectedResultsListViewEx.TabIndex = 47; + this.selectedResultsListViewEx.UseCompatibleStateImageBehavior = false; + this.selectedResultsListViewEx.View = System.Windows.Forms.View.Details; + this.selectedResultsListViewEx.SubItemClicked += new TBF.UiControls.SubItemEventHandler(this.selectedResultsListViewEx_SubItemClicked); + this.selectedResultsListViewEx.SubItemEndEditing += new TBF.UiControls.SubItemEndEditingEventHandler(this.selectedResultsListViewEx_SubItemEndEditing); + // + // ResultsConfigDlg + // + this.AcceptButton = this.okButton; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.cancelButton; + this.ClientSize = new System.Drawing.Size(893, 366); + this.Controls.Add(this.selectedResultsListViewEx); + this.Controls.Add(this.removeAllButton); + this.Controls.Add(this.removeButton); + this.Controls.Add(this.addButton); + this.Controls.Add(this.selectedResultsLabel); + this.Controls.Add(this.availableResultsLabel); + this.Controls.Add(this.availableResultsListBox); + this.Controls.Add(this.cancelButton); + this.Controls.Add(this.okButton); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.Name = "ResultsConfigDlg"; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "ResultsConfig"; + this.Load += new System.EventHandler(this.ResultsConfig_Load); + this.ResumeLayout(false); + this.PerformLayout(); } @@ -157,12 +164,12 @@ namespace TBF.BenchControl.Output.FileWriters.Basic private System.Windows.Forms.Button okButton; private System.Windows.Forms.Button cancelButton; - private System.Windows.Forms.ListBox availableResultsListBox; - private System.Windows.Forms.ListBox selectedResultsListBox; + private System.Windows.Forms.ListBox availableResultsListBox; private System.Windows.Forms.Label availableResultsLabel; private System.Windows.Forms.Label selectedResultsLabel; private System.Windows.Forms.Button removeAllButton; private System.Windows.Forms.Button removeButton; private System.Windows.Forms.Button addButton; + private UiControls.ListViewEx selectedResultsListViewEx; } } \ No newline at end of file diff --git a/TestBenchFramework/BenchControl/Output/FileWriters/Basic/Writer.cs b/TestBenchFramework/BenchControl/Output/FileWriters/Basic/Writer.cs index 26ed15acd..f1a08b831 100644 --- a/TestBenchFramework/BenchControl/Output/FileWriters/Basic/Writer.cs +++ b/TestBenchFramework/BenchControl/Output/FileWriters/Basic/Writer.cs @@ -22,7 +22,7 @@ namespace TBF.BenchControl.Output.FileWriters.Basic /// /// Result items to print /// - IList rsltItems; + IList rsltItems; /// /// Results to print @@ -76,42 +76,60 @@ namespace TBF.BenchControl.Output.FileWriters.Basic string GetFilename(DateTime time) { string directory = writerCfg.DestinationPath; /// Ends with "\\"; - Directory.CreateDirectory(directory); - if (writerCfg.YearFolders) + switch (writerCfg.YearFolders) { - directory = string.Format("{0}{1}\\", directory, time.Year.ToString()); - Directory.CreateDirectory(directory); + case YearFolders.FourDigit: + directory = string.Format("{0}{1}\\", directory, time.Year.ToString("D4")); + break; + case YearFolders.TwoDigit: + directory = string.Format("{0}{1}\\", directory, (time.Year % 100).ToString("D2")); + break; + } + + switch (writerCfg.MonthFolders) + { + case MonthFolders.Name: + { + string monthStr; + switch (time.Month) + { + default: + case 1: monthStr = "January"; break; + case 2: monthStr = "February"; break; + case 3: monthStr = "March"; break; + case 4: monthStr = "April"; break; + case 5: monthStr = "May"; break; + case 6: monthStr = "June"; break; + case 7: monthStr = "July"; break; + case 8: monthStr = "August"; break; + case 9: monthStr = "September"; break; + case 10: monthStr = "October"; break; + case 11: monthStr = "November"; break; + case 12: monthStr = "December"; break; + } + directory = string.Format("{0}{1}\\", directory, monthStr); + break; + } + case MonthFolders.Digit: + directory = string.Format("{0}{1}\\", directory, time.Month.ToString()); + break; + case MonthFolders.DigitWithLeadingZero: + directory = string.Format("{0}{1}\\", directory, time.Month.ToString("D2")); + break; + } + + switch (writerCfg.DayFolders) + { + case DayFolders.Digit: + directory = string.Format("{0}{1}\\", directory, time.Day.ToString()); + break; + case DayFolders.DigitWithLeadingZero: + directory = string.Format("{0}{1}\\", directory, time.Day.ToString("D2")); + break; } - if (writerCfg.MonthFolders) - { - string monthStr /* = now.Month.ToString("D2")*/; - switch (time.Month) - { - default: - case 1: monthStr = "January"; break; - case 2: monthStr = "February"; break; - case 3: monthStr = "March"; break; - case 4: monthStr = "April"; break; - case 5: monthStr = "May"; break; - case 6: monthStr = "June"; break; - case 7: monthStr = "July"; break; - case 8: monthStr = "August"; break; - case 9: monthStr = "September"; break; - case 10: monthStr = "October"; break; - case 11: monthStr = "November"; break; - case 12: monthStr = "December"; break; - } - directory = string.Format("{0}{1}\\", directory, monthStr); - Directory.CreateDirectory(directory); - } - - if (writerCfg.DayFolders) - { - directory = string.Format("{0}{1}\\", directory, time.Day.ToString("D2")); - Directory.CreateDirectory(directory); - } + Directory.CreateDirectory(directory); return string.Format("{0}{1}{2}{3}-{4}{5}.txt", directory, (time.Year % 100).ToString("D2"), time.Month.ToString("D2"), time.Day.ToString("D2"), time.Hour.ToString("D2"), time.Minute.ToString("D2")); @@ -133,7 +151,7 @@ namespace TBF.BenchControl.Output.FileWriters.Basic return this; } - rsltItems = Results.ItemSpec.FromStrArray(writerCfg.SelectedItems); + rsltItems = Results.WMeterRsltItemSpec.FromStrArray(writerCfg.SelectedItems); try { @@ -150,58 +168,8 @@ namespace TBF.BenchControl.Output.FileWriters.Basic /// Start this operation public void Start() { - if (writer == null) return; + if (writer == null || rsltItems == null || rsltItems.Count == 0) return; - ///---------- - /// Header - ///---------- - writer.WriteLine(batch.ProtocolTitle); - writer.WriteLine(string.Empty); - - string[] leftColumn = new string[] - { - "Batch number: ", - "Date and time: ", - "Procedure:", - Strings.User_, - "Ambient temperature: ", - "Ambient pressure: ", - "Ambient humidity: ", - }; - - string[] rightColumn = new string[] - { - batch.BatchNr.ToString(), - //batch.EndTime.ToShortDateString() + " " + batch.EndTime.ToShortTimeString(), - string.Format("{0}.{1}.{2} {3}:{4}", batch.EndTime.Year.ToString("D4"), - batch.EndTime.Month.ToString("D2"), - batch.EndTime.Day.ToString("D2"), - batch.EndTime.Hour.ToString("D2"), - batch.EndTime.Minute.ToString("D2")), - batch.ProcedureName, - batch.UserName, - batch.AmbientTempAve().ToString("F1") + " °C", - batch.AmbientPressAve().ToString("F0") + " mbar", - batch.AmbientHumiAve().ToString("F0") + " %", - }; - - /// Determine max. left column width in characters - int maxLen = 0; - foreach (var s in leftColumn) if (s.Length > maxLen) maxLen = s.Length; - - /// Write aligned columns - for (int i = 0; i < Math.Min(leftColumn.Length, rightColumn.Length); i++) - { - writer.Write(leftColumn[i]); - writer.Write(new string(' ', maxLen - leftColumn[i].Length + 3)); - writer.WriteLine(rightColumn[i]); - } - writer.WriteLine(string.Empty); - - - ///-------- - /// Body - ///-------- foreach (var wm in batch.WaterMeters) WriteWM(wm); } @@ -211,138 +179,21 @@ namespace TBF.BenchControl.Output.FileWriters.Basic /// Water meter number (0-based) void WriteWM(Results.Entities.WaterMeter wm) { - /// Determine column widths - int[] columnWidths = new int[rsltItems.Count]; - int totalWidth = 0; - for (int i = 0; i < rsltItems.Count; i++) - { - columnWidths[i] = ElSpaces(rsltItems[i].ClmnHeaderText).Length; - foreach (var mtr in wm.MeterTestRslts) - { - if ((mtr != null) && (mtr.Publish() == Config.Entities.Publish.Always)) - { - string itemText; + for (int i = 0; i < rsltItems.Count; i++) + { + writer.Write(rsltItems[i].Print(wm)); - if (!wm.Compound()) - { - /// Single water meter - itemText = rsltItems[i].Print(mtr); - } - else if (mtr.CompoundMeterId == (byte)CompoundMeterId.Compound) - { - Results.Entities.MeterTestRslt mainMtr = wm.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundMain); - Results.Entities.MeterTestRslt auxMtr = wm.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundAux); - itemText = rsltItems[i].PrintCombined(mainMtr, auxMtr, mtr); - } - else - { - continue; - } - - /// Strip color information - string[] texts = itemText.Split(new char[] { '|' }); - if (texts.Length == 2) { itemText = texts[0]; } - - int len = ElSpaces(itemText).Length; - if (len > columnWidths[i]) columnWidths[i] = len; - } - } - totalWidth += columnWidths[i]; - } - totalWidth += 3 * (rsltItems.Count - 1); - if (totalWidth < 0) totalWidth = 0; - - - /// Write water meter number and s/n - writer.Write(string.Format("Water meter {0}", wm.WMPosition)); - if (!string.IsNullOrEmpty(wm.SerialNr)) writer.Write(string.Format(" s/n: {0}", wm.SerialNr)); - writer.WriteLine(string.Empty); - - - writer.WriteLine(new String('-', totalWidth)); /// Horizontal line above the header - - - /// Write column headers - for (int i = 0; i < rsltItems.Count; i++) - { - writer.Write(ElSpaces(rsltItems[i].ClmnHeaderText)); - - if (i < rsltItems.Count - 1) - { - if (!writerCfg.EliminateSpaces) - { - writer.Write(new string(' ', columnWidths[i] - rsltItems[i].ClmnHeaderText.Length + 3)); - } - writer.Write(separatorStr); - } - else - { - writer.WriteLine(string.Empty); - } - } - - - writer.WriteLine(new String('-', totalWidth)); /// Horizontal line between the header and the body - - - /// Write table data - foreach (var mtr in wm.MeterTestRslts) - { - if ((mtr != null) && (mtr.Publish() == Config.Entities.Publish.Always)) - { - for (int i = 0; i < rsltItems.Count; i++) - { - string itemText; - - /// - /// Fetch an item - /// - if (!wm.Compound()) - { - /// Single water meter - itemText = rsltItems[i].Print(mtr); - } - else if (mtr.CompoundMeterId == (byte)CompoundMeterId.Compound) - { - Results.Entities.MeterTestRslt mainMtr = wm.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundMain); - Results.Entities.MeterTestRslt auxMtr = wm.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundAux); - itemText = rsltItems[i].PrintCombined(mainMtr, auxMtr, mtr); - } - else - { - continue; - } - - /// - /// Print the item - /// - string[] texts = itemText.Split(new char[] { '|' }); - if (texts.Length == 2) { itemText = texts[0]; } /// Strip color information - - writer.Write(ElSpaces(itemText)); - - if (i < rsltItems.Count - 1) - { - if (!writerCfg.EliminateSpaces) - { - writer.Write(new string(' ', columnWidths[i] - itemText.Length + 3)); - } - writer.Write(separatorStr); - } - else - { - writer.WriteLine(string.Empty); - } - } - } - } - - writer.WriteLine(new String('-', totalWidth)); /// Horizontal line below the body - - writer.WriteLine(string.Empty); + if (i < rsltItems.Count - 1) + { + writer.Write(separatorStr); + } + else + { + writer.WriteLine(string.Empty); + } + } } - /// Run this operation /// Event.ResultsWritten public Event Run() @@ -350,7 +201,6 @@ namespace TBF.BenchControl.Output.FileWriters.Basic return Event.ResultsWritten; } - /// Stop this operation public void Stop() { diff --git a/TestBenchFramework/BenchControl/Output/FileWriters/Basic/WriterCfg.cs b/TestBenchFramework/BenchControl/Output/FileWriters/Basic/WriterCfg.cs index 563d52b6e..3285088ed 100644 --- a/TestBenchFramework/BenchControl/Output/FileWriters/Basic/WriterCfg.cs +++ b/TestBenchFramework/BenchControl/Output/FileWriters/Basic/WriterCfg.cs @@ -9,7 +9,32 @@ using TBF.BenchControl.Generic; namespace TBF.BenchControl.Output.FileWriters.Basic { - public enum Separator + public enum YearFolders + { + None, + TwoDigit, + FourDigit, + Count + } + + public enum MonthFolders + { + None, + Digit, + DigitWithLeadingZero, + Name, + Count + } + + public enum DayFolders + { + None, + Digit, + DigitWithLeadingZero, + Count + } + + public enum Separator { None, Space, @@ -25,9 +50,9 @@ namespace TBF.BenchControl.Output.FileWriters.Basic public IComponentCfgCtrl GetControl() { return new WriterCfgCtrl(); } public string DestinationPath; /// Directory path into which the results will be saved - public bool YearFolders; - public bool MonthFolders; - public bool DayFolders; + public YearFolders YearFolders; + public MonthFolders MonthFolders; + public DayFolders DayFolders; public Separator Separator; public bool EliminateSpaces; public string[] SelectedItems; @@ -39,9 +64,9 @@ namespace TBF.BenchControl.Output.FileWriters.Basic Name = "FileWriter"; ParentName = string.Empty; DestinationPath = Program.HomeDir + "Results\\"; - YearFolders = true; - MonthFolders = true; - DayFolders = false; + YearFolders = YearFolders.FourDigit; + MonthFolders = MonthFolders.Digit; + DayFolders = DayFolders.Digit; Separator = Separator.None; EliminateSpaces = false; } diff --git a/TestBenchFramework/BenchControl/Output/FileWriters/Basic/WriterCfgCtrl.cs b/TestBenchFramework/BenchControl/Output/FileWriters/Basic/WriterCfgCtrl.cs index 6b1aca4e5..96ae5561c 100644 --- a/TestBenchFramework/BenchControl/Output/FileWriters/Basic/WriterCfgCtrl.cs +++ b/TestBenchFramework/BenchControl/Output/FileWriters/Basic/WriterCfgCtrl.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2013-2016 Sensus Metering Systems +/// Copyright (c) 2016 Sensus Metering Systems /// using System; using System.Collections.Generic; @@ -37,10 +37,15 @@ namespace TBF.BenchControl.Output.FileWriters.Basic private void WriterCfgCtrl_Load(object sender, EventArgs e) { - for (int i = 0; i < (int)Separator.Count; i++) - { - separatorComboBox.Items.Add(((Separator)i).ToString()); - } + for (Separator s = 0; s < Separator.Count; s++) separatorComboBox.Items.Add(s.ToString()); + for (YearFolders s = 0; s < YearFolders.Count; s++) yearFoldersComboBox.Items.Add(s.ToString()); + for (MonthFolders s = 0; s < MonthFolders.Count; s++) monthFoldersComboBox.Items.Add(s.ToString()); + for (DayFolders s = 0; s < DayFolders.Count; s++) dayFoldersComboBox.Items.Add(s.ToString()); + + for (int i = 0; i < (int)Separator.Count; i++) + { + separatorComboBox.Items.Add(((Separator)i).ToString()); + } selectedItems = config.SelectedItems; @@ -57,11 +62,10 @@ namespace TBF.BenchControl.Output.FileWriters.Basic classNameLabel.Text = config.Factory.ClassName; nameTextBox.Text = config.Name; destinationTextBox.Text = config.DestinationPath; - yearFoldersCheckBox.Checked = config.YearFolders; - monthFoldersCheckBox.Checked = config.MonthFolders; - dayFoldersCheckBox.Checked = config.DayFolders; + yearFoldersComboBox.Text = config.YearFolders.ToString(); + monthFoldersComboBox.Text = config.MonthFolders.ToString(); + dayFoldersComboBox.Text = config.DayFolders.ToString(); separatorComboBox.Text = config.Separator.ToString(); - eliminateSpacesCheckBox.Checked = config.EliminateSpaces; } public void Unlock() @@ -69,11 +73,10 @@ namespace TBF.BenchControl.Output.FileWriters.Basic nameTextBox.Enabled = true; destinationTextBox.Enabled = true; destinationButton.Enabled = true; - yearFoldersCheckBox.Enabled = true; - monthFoldersCheckBox.Enabled = true; - dayFoldersCheckBox.Enabled = true; + yearFoldersComboBox.Enabled = true; + monthFoldersComboBox.Enabled = true; + dayFoldersComboBox.Enabled = true; separatorComboBox.Enabled = true; - eliminateSpacesCheckBox.Enabled = true; selectItemsButton.Enabled = true; } @@ -81,6 +84,24 @@ namespace TBF.BenchControl.Output.FileWriters.Basic { CfgUpdateFlags flags = CfgUpdateFlags.None; + if (!yearFoldersComboBox.Items.Contains(yearFoldersComboBox.Text)) + { + flags |= CfgUpdateFlags.Error; + message += Environment.NewLine + "Invalid year folders selection"; + } + + if (!monthFoldersComboBox.Items.Contains(monthFoldersComboBox.Text)) + { + flags |= CfgUpdateFlags.Error; + message += Environment.NewLine + "Invalid month folders selection"; + } + + if (!dayFoldersComboBox.Items.Contains(dayFoldersComboBox.Text)) + { + flags |= CfgUpdateFlags.Error; + message += Environment.NewLine + "Invalid day folder selection"; + } + if (!separatorComboBox.Items.Contains(separatorComboBox.Text)) { flags |= CfgUpdateFlags.Error; @@ -104,38 +125,46 @@ namespace TBF.BenchControl.Output.FileWriters.Basic flags = CfgUpdateFlags.RestartRqrd; } - if (yearFoldersCheckBox.Checked != config.YearFolders) - { - config.YearFolders = yearFoldersCheckBox.Checked; - flags = CfgUpdateFlags.RestartRqrd; - } - if (monthFoldersCheckBox.Checked != config.MonthFolders) - { - config.MonthFolders = monthFoldersCheckBox.Checked; - flags = CfgUpdateFlags.RestartRqrd; - } - if (dayFoldersCheckBox.Checked != config.DayFolders) - { - config.DayFolders = dayFoldersCheckBox.Checked; - flags = CfgUpdateFlags.RestartRqrd; - } + for (YearFolders i = 0; i < YearFolders.Count; i++) + { + if (i.ToString().Equals(yearFoldersComboBox.Text) && (config.YearFolders != i)) + { + config.YearFolders = i; + flags = CfgUpdateFlags.RestartRqrd; + break; + } + } - for (int i = 0; i < (int)Separator.Count; i++) + for (MonthFolders i = 0; i < MonthFolders.Count; i++) + { + if (i.ToString().Equals(monthFoldersComboBox.Text) && (config.MonthFolders != i)) + { + config.MonthFolders = i; + flags = CfgUpdateFlags.RestartRqrd; + break; + } + } + + for (DayFolders i = 0; i < DayFolders.Count; i++) + { + if (i.ToString().Equals(dayFoldersComboBox.Text) && (config.DayFolders != i)) + { + config.DayFolders = i; + flags = CfgUpdateFlags.RestartRqrd; + break; + } + } + + for (Separator i = 0; i < Separator.Count; i++) { - if (((Separator)i).ToString().Equals(separatorComboBox.Text) && (config.Separator != (Separator)i)) + if (i.ToString().Equals(separatorComboBox.Text) && (config.Separator != i)) { - config.Separator = (Separator)i; + config.Separator = i; flags = CfgUpdateFlags.RestartRqrd; break; } } - if (eliminateSpacesCheckBox.Checked != config.EliminateSpaces) - { - config.EliminateSpaces = eliminateSpacesCheckBox.Checked; - flags = CfgUpdateFlags.RestartRqrd; - } - if (config.SelectedItems != selectedItems) { config.SelectedItems = selectedItems; @@ -154,20 +183,13 @@ namespace TBF.BenchControl.Output.FileWriters.Basic { ResultsConfigDlg dlg = new ResultsConfigDlg(); dlg.Compound = config.Factory.ClassName.Contains("Compound"); - dlg.SelectedItems = Results.ItemSpec.FromStrArray(selectedItems); - dlg.AvailableItems = new List(); - if (dlg.Compound) - { - foreach (var v in Results.ItemSpec.AllItems) if (v.CanPrintCombined) dlg.AvailableItems.Add(v); - } - else - { - foreach (var v in Results.ItemSpec.AllItems) if (v.CanPrintSingle) dlg.AvailableItems.Add(v); - } + dlg.SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(selectedItems); + dlg.AvailableItems = new List(); + foreach (var v in Results.WMeterRsltItemSpec.AllItems) dlg.AvailableItems.Add(v); if (dlg.ShowDialog() == DialogResult.OK) { - selectedItems = Results.ItemSpec.ToStrArray(dlg.SelectedItems); + selectedItems = Results.WMeterRsltItemSpec.ToStrArray(dlg.SelectedItems); } } } diff --git a/TestBenchFramework/BenchControl/Output/FileWriters/Basic/WriterCfgCtrl.designer.cs b/TestBenchFramework/BenchControl/Output/FileWriters/Basic/WriterCfgCtrl.designer.cs index 7c5407dec..effa3baf0 100644 --- a/TestBenchFramework/BenchControl/Output/FileWriters/Basic/WriterCfgCtrl.designer.cs +++ b/TestBenchFramework/BenchControl/Output/FileWriters/Basic/WriterCfgCtrl.designer.cs @@ -31,170 +31,184 @@ namespace TBF.BenchControl.Output.FileWriters.Basic /// private void InitializeComponent() { - this.nameTextBox = new System.Windows.Forms.TextBox(); - this.nameLabel = new System.Windows.Forms.Label(); - this.classNameLabel = new System.Windows.Forms.Label(); - this.destinationTextBox = new System.Windows.Forms.TextBox(); - this.destinationLabel = new System.Windows.Forms.Label(); - this.dayFoldersCheckBox = new System.Windows.Forms.CheckBox(); - this.destinationButton = new System.Windows.Forms.Button(); - this.yearFoldersCheckBox = new System.Windows.Forms.CheckBox(); - this.monthFoldersCheckBox = new System.Windows.Forms.CheckBox(); - this.eliminateSpacesCheckBox = new System.Windows.Forms.CheckBox(); - this.separatorLabel = new System.Windows.Forms.Label(); - this.separatorComboBox = new System.Windows.Forms.ComboBox(); - this.selectItemsButton = new System.Windows.Forms.Button(); - this.SuspendLayout(); - // - // nameTextBox - // - this.nameTextBox.Enabled = false; - this.nameTextBox.Location = new System.Drawing.Point(108, 29); - this.nameTextBox.Name = "nameTextBox"; - this.nameTextBox.Size = new System.Drawing.Size(146, 20); - this.nameTextBox.TabIndex = 2; - // - // nameLabel - // - this.nameLabel.AutoSize = true; - this.nameLabel.Location = new System.Drawing.Point(17, 32); - this.nameLabel.Name = "nameLabel"; - this.nameLabel.Size = new System.Drawing.Size(35, 13); - this.nameLabel.TabIndex = 1; - this.nameLabel.Text = "Name"; - // - // classNameLabel - // - this.classNameLabel.AutoSize = true; - this.classNameLabel.Location = new System.Drawing.Point(105, 6); - this.classNameLabel.Name = "classNameLabel"; - this.classNameLabel.Size = new System.Drawing.Size(83, 13); - this.classNameLabel.TabIndex = 0; - this.classNameLabel.Text = "ComonentName"; - // - // destinationTextBox - // - this.destinationTextBox.Enabled = false; - this.destinationTextBox.Location = new System.Drawing.Point(108, 52); - this.destinationTextBox.Name = "destinationTextBox"; - this.destinationTextBox.Size = new System.Drawing.Size(146, 20); - this.destinationTextBox.TabIndex = 4; - // - // destinationLabel - // - this.destinationLabel.AutoSize = true; - this.destinationLabel.Location = new System.Drawing.Point(17, 55); - this.destinationLabel.Name = "destinationLabel"; - this.destinationLabel.Size = new System.Drawing.Size(60, 13); - this.destinationLabel.TabIndex = 3; - this.destinationLabel.Text = "Destination"; - // - // dayFoldersCheckBox - // - this.dayFoldersCheckBox.AutoSize = true; - this.dayFoldersCheckBox.Enabled = false; - this.dayFoldersCheckBox.Location = new System.Drawing.Point(109, 114); - this.dayFoldersCheckBox.Name = "dayFoldersCheckBox"; - this.dayFoldersCheckBox.Size = new System.Drawing.Size(79, 17); - this.dayFoldersCheckBox.TabIndex = 8; - this.dayFoldersCheckBox.Text = "Day folders"; - this.dayFoldersCheckBox.UseVisualStyleBackColor = true; - // - // destinationButton - // - this.destinationButton.Enabled = false; - this.destinationButton.Location = new System.Drawing.Point(259, 52); - this.destinationButton.Name = "destinationButton"; - this.destinationButton.Size = new System.Drawing.Size(30, 20); - this.destinationButton.TabIndex = 5; - this.destinationButton.Text = "..."; - this.destinationButton.UseVisualStyleBackColor = true; - this.destinationButton.Click += new System.EventHandler(this.destinationButton_Click); - // - // yearFoldersCheckBox - // - this.yearFoldersCheckBox.AutoSize = true; - this.yearFoldersCheckBox.Enabled = false; - this.yearFoldersCheckBox.Location = new System.Drawing.Point(109, 78); - this.yearFoldersCheckBox.Name = "yearFoldersCheckBox"; - this.yearFoldersCheckBox.Size = new System.Drawing.Size(82, 17); - this.yearFoldersCheckBox.TabIndex = 6; - this.yearFoldersCheckBox.Text = "Year folders"; - this.yearFoldersCheckBox.UseVisualStyleBackColor = true; - // - // monthFoldersCheckBox - // - this.monthFoldersCheckBox.AutoSize = true; - this.monthFoldersCheckBox.Enabled = false; - this.monthFoldersCheckBox.Location = new System.Drawing.Point(109, 96); - this.monthFoldersCheckBox.Name = "monthFoldersCheckBox"; - this.monthFoldersCheckBox.Size = new System.Drawing.Size(90, 17); - this.monthFoldersCheckBox.TabIndex = 7; - this.monthFoldersCheckBox.Text = "Month folders"; - this.monthFoldersCheckBox.UseVisualStyleBackColor = true; - // - // eliminateSpacesCheckBox - // - this.eliminateSpacesCheckBox.AutoSize = true; - this.eliminateSpacesCheckBox.Enabled = false; - this.eliminateSpacesCheckBox.Location = new System.Drawing.Point(109, 163); - this.eliminateSpacesCheckBox.Name = "eliminateSpacesCheckBox"; - this.eliminateSpacesCheckBox.Size = new System.Drawing.Size(165, 17); - this.eliminateSpacesCheckBox.TabIndex = 11; - this.eliminateSpacesCheckBox.Text = "Eliminate spaces in each field"; - this.eliminateSpacesCheckBox.UseVisualStyleBackColor = true; - // - // separatorLabel - // - this.separatorLabel.AutoSize = true; - this.separatorLabel.Location = new System.Drawing.Point(17, 139); - this.separatorLabel.Name = "separatorLabel"; - this.separatorLabel.Size = new System.Drawing.Size(53, 13); - this.separatorLabel.TabIndex = 9; - this.separatorLabel.Text = "Separator"; - // - // separatorComboBox - // - this.separatorComboBox.Enabled = false; - this.separatorComboBox.FormattingEnabled = true; - this.separatorComboBox.Location = new System.Drawing.Point(108, 136); - this.separatorComboBox.Name = "separatorComboBox"; - this.separatorComboBox.Size = new System.Drawing.Size(146, 21); - this.separatorComboBox.TabIndex = 10; - // - // selectItemsButton - // - this.selectItemsButton.Enabled = false; - this.selectItemsButton.Location = new System.Drawing.Point(109, 184); - this.selectItemsButton.Name = "selectItemsButton"; - this.selectItemsButton.Size = new System.Drawing.Size(145, 23); - this.selectItemsButton.TabIndex = 12; - this.selectItemsButton.Text = "Select items"; - this.selectItemsButton.UseVisualStyleBackColor = true; - this.selectItemsButton.Click += new System.EventHandler(this.selectItemsButton_Click); - // - // WriterCfgCtrl - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.selectItemsButton); - this.Controls.Add(this.separatorComboBox); - this.Controls.Add(this.separatorLabel); - this.Controls.Add(this.eliminateSpacesCheckBox); - this.Controls.Add(this.monthFoldersCheckBox); - this.Controls.Add(this.yearFoldersCheckBox); - this.Controls.Add(this.destinationButton); - this.Controls.Add(this.dayFoldersCheckBox); - this.Controls.Add(this.destinationTextBox); - this.Controls.Add(this.destinationLabel); - this.Controls.Add(this.nameTextBox); - this.Controls.Add(this.nameLabel); - this.Controls.Add(this.classNameLabel); - this.Name = "WriterCfgCtrl"; - this.Size = new System.Drawing.Size(300, 230); - this.Load += new System.EventHandler(this.WriterCfgCtrl_Load); - this.ResumeLayout(false); - this.PerformLayout(); + this.nameTextBox = new System.Windows.Forms.TextBox(); + this.nameLabel = new System.Windows.Forms.Label(); + this.classNameLabel = new System.Windows.Forms.Label(); + this.destinationTextBox = new System.Windows.Forms.TextBox(); + this.destinationLabel = new System.Windows.Forms.Label(); + this.destinationButton = new System.Windows.Forms.Button(); + this.separatorLabel = new System.Windows.Forms.Label(); + this.separatorComboBox = new System.Windows.Forms.ComboBox(); + this.selectItemsButton = new System.Windows.Forms.Button(); + this.yearFoldersLabel = new System.Windows.Forms.Label(); + this.monthFoldersLabel = new System.Windows.Forms.Label(); + this.dayFoldersLabel = new System.Windows.Forms.Label(); + this.yearFoldersComboBox = new System.Windows.Forms.ComboBox(); + this.monthFoldersComboBox = new System.Windows.Forms.ComboBox(); + this.dayFoldersComboBox = new System.Windows.Forms.ComboBox(); + this.SuspendLayout(); + // + // nameTextBox + // + this.nameTextBox.Enabled = false; + this.nameTextBox.Location = new System.Drawing.Point(108, 33); + this.nameTextBox.Name = "nameTextBox"; + this.nameTextBox.Size = new System.Drawing.Size(146, 20); + this.nameTextBox.TabIndex = 2; + // + // nameLabel + // + this.nameLabel.AutoSize = true; + this.nameLabel.Location = new System.Drawing.Point(17, 36); + this.nameLabel.Name = "nameLabel"; + this.nameLabel.Size = new System.Drawing.Size(35, 13); + this.nameLabel.TabIndex = 1; + this.nameLabel.Text = "Name"; + // + // classNameLabel + // + this.classNameLabel.AutoSize = true; + this.classNameLabel.Location = new System.Drawing.Point(105, 10); + this.classNameLabel.Name = "classNameLabel"; + this.classNameLabel.Size = new System.Drawing.Size(83, 13); + this.classNameLabel.TabIndex = 0; + this.classNameLabel.Text = "ComonentName"; + // + // destinationTextBox + // + this.destinationTextBox.Enabled = false; + this.destinationTextBox.Location = new System.Drawing.Point(108, 56); + this.destinationTextBox.Name = "destinationTextBox"; + this.destinationTextBox.Size = new System.Drawing.Size(146, 20); + this.destinationTextBox.TabIndex = 4; + // + // destinationLabel + // + this.destinationLabel.AutoSize = true; + this.destinationLabel.Location = new System.Drawing.Point(17, 59); + this.destinationLabel.Name = "destinationLabel"; + this.destinationLabel.Size = new System.Drawing.Size(60, 13); + this.destinationLabel.TabIndex = 3; + this.destinationLabel.Text = "Destination"; + // + // destinationButton + // + this.destinationButton.Enabled = false; + this.destinationButton.Location = new System.Drawing.Point(259, 56); + this.destinationButton.Name = "destinationButton"; + this.destinationButton.Size = new System.Drawing.Size(30, 20); + this.destinationButton.TabIndex = 5; + this.destinationButton.Text = "..."; + this.destinationButton.UseVisualStyleBackColor = true; + this.destinationButton.Click += new System.EventHandler(this.destinationButton_Click); + // + // separatorLabel + // + this.separatorLabel.AutoSize = true; + this.separatorLabel.Location = new System.Drawing.Point(17, 154); + this.separatorLabel.Name = "separatorLabel"; + this.separatorLabel.Size = new System.Drawing.Size(53, 13); + this.separatorLabel.TabIndex = 12; + this.separatorLabel.Text = "Separator"; + // + // separatorComboBox + // + this.separatorComboBox.Enabled = false; + this.separatorComboBox.FormattingEnabled = true; + this.separatorComboBox.Location = new System.Drawing.Point(108, 151); + this.separatorComboBox.Name = "separatorComboBox"; + this.separatorComboBox.Size = new System.Drawing.Size(146, 21); + this.separatorComboBox.TabIndex = 13; + // + // selectItemsButton + // + this.selectItemsButton.Enabled = false; + this.selectItemsButton.Location = new System.Drawing.Point(108, 187); + this.selectItemsButton.Name = "selectItemsButton"; + this.selectItemsButton.Size = new System.Drawing.Size(145, 23); + this.selectItemsButton.TabIndex = 14; + this.selectItemsButton.Text = "Select items"; + this.selectItemsButton.UseVisualStyleBackColor = true; + this.selectItemsButton.Click += new System.EventHandler(this.selectItemsButton_Click); + // + // yearFoldersLabel + // + this.yearFoldersLabel.AutoSize = true; + this.yearFoldersLabel.Location = new System.Drawing.Point(17, 82); + this.yearFoldersLabel.Name = "yearFoldersLabel"; + this.yearFoldersLabel.Size = new System.Drawing.Size(63, 13); + this.yearFoldersLabel.TabIndex = 6; + this.yearFoldersLabel.Text = "Year folders"; + // + // monthFoldersLabel + // + this.monthFoldersLabel.AutoSize = true; + this.monthFoldersLabel.Location = new System.Drawing.Point(17, 106); + this.monthFoldersLabel.Name = "monthFoldersLabel"; + this.monthFoldersLabel.Size = new System.Drawing.Size(71, 13); + this.monthFoldersLabel.TabIndex = 8; + this.monthFoldersLabel.Text = "Month folders"; + // + // dayFoldersLabel + // + this.dayFoldersLabel.AutoSize = true; + this.dayFoldersLabel.Location = new System.Drawing.Point(17, 130); + this.dayFoldersLabel.Name = "dayFoldersLabel"; + this.dayFoldersLabel.Size = new System.Drawing.Size(60, 13); + this.dayFoldersLabel.TabIndex = 10; + this.dayFoldersLabel.Text = "Day folders"; + // + // yearFoldersComboBox + // + this.yearFoldersComboBox.Enabled = false; + this.yearFoldersComboBox.FormattingEnabled = true; + this.yearFoldersComboBox.Location = new System.Drawing.Point(108, 79); + this.yearFoldersComboBox.Name = "yearFoldersComboBox"; + this.yearFoldersComboBox.Size = new System.Drawing.Size(146, 21); + this.yearFoldersComboBox.TabIndex = 7; + // + // monthFoldersComboBox + // + this.monthFoldersComboBox.Enabled = false; + this.monthFoldersComboBox.FormattingEnabled = true; + this.monthFoldersComboBox.Location = new System.Drawing.Point(109, 103); + this.monthFoldersComboBox.Name = "monthFoldersComboBox"; + this.monthFoldersComboBox.Size = new System.Drawing.Size(146, 21); + this.monthFoldersComboBox.TabIndex = 9; + // + // dayFoldersComboBox + // + this.dayFoldersComboBox.Enabled = false; + this.dayFoldersComboBox.FormattingEnabled = true; + this.dayFoldersComboBox.Location = new System.Drawing.Point(108, 127); + this.dayFoldersComboBox.Name = "dayFoldersComboBox"; + this.dayFoldersComboBox.Size = new System.Drawing.Size(146, 21); + this.dayFoldersComboBox.TabIndex = 11; + // + // WriterCfgCtrl + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.dayFoldersComboBox); + this.Controls.Add(this.monthFoldersComboBox); + this.Controls.Add(this.yearFoldersComboBox); + this.Controls.Add(this.dayFoldersLabel); + this.Controls.Add(this.monthFoldersLabel); + this.Controls.Add(this.yearFoldersLabel); + this.Controls.Add(this.selectItemsButton); + this.Controls.Add(this.separatorComboBox); + this.Controls.Add(this.separatorLabel); + this.Controls.Add(this.destinationButton); + this.Controls.Add(this.destinationTextBox); + this.Controls.Add(this.destinationLabel); + this.Controls.Add(this.nameTextBox); + this.Controls.Add(this.nameLabel); + this.Controls.Add(this.classNameLabel); + this.Name = "WriterCfgCtrl"; + this.Size = new System.Drawing.Size(300, 230); + this.Load += new System.EventHandler(this.WriterCfgCtrl_Load); + this.ResumeLayout(false); + this.PerformLayout(); } @@ -204,14 +218,16 @@ namespace TBF.BenchControl.Output.FileWriters.Basic private System.Windows.Forms.Label nameLabel; private System.Windows.Forms.Label classNameLabel; private System.Windows.Forms.TextBox destinationTextBox; - private System.Windows.Forms.Label destinationLabel; - private System.Windows.Forms.CheckBox dayFoldersCheckBox; - private System.Windows.Forms.Button destinationButton; - private System.Windows.Forms.CheckBox yearFoldersCheckBox; - private System.Windows.Forms.CheckBox monthFoldersCheckBox; - private System.Windows.Forms.CheckBox eliminateSpacesCheckBox; + private System.Windows.Forms.Label destinationLabel; + private System.Windows.Forms.Button destinationButton; private System.Windows.Forms.Label separatorLabel; private System.Windows.Forms.ComboBox separatorComboBox; private System.Windows.Forms.Button selectItemsButton; + private System.Windows.Forms.Label yearFoldersLabel; + private System.Windows.Forms.Label monthFoldersLabel; + private System.Windows.Forms.Label dayFoldersLabel; + private System.Windows.Forms.ComboBox yearFoldersComboBox; + private System.Windows.Forms.ComboBox monthFoldersComboBox; + private System.Windows.Forms.ComboBox dayFoldersComboBox; } }