Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bdd9b3a100 |
@@ -4,8 +4,6 @@ DeviceTest/bin/
|
||||
DeviceTest/obj/
|
||||
Dirichlet.Numerics/bin
|
||||
Dirichlet.Numerics/obj
|
||||
GemCard/bin
|
||||
GemCard/obj
|
||||
GraphLib/bin
|
||||
GraphLib/obj
|
||||
MonitoringDB/bin
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;SENTEC</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;GENESIS;IPERL;LANG_DE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
@@ -28,7 +28,7 @@
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;SENTEC</DefineConstants>
|
||||
<DefineConstants>TRACE;GENESIS;IPERL;LANG_DE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
@@ -77,7 +77,6 @@
|
||||
<Compile Include="Entities\IHasItemNr.cs" />
|
||||
<Compile Include="Entities\IHasName.cs" />
|
||||
<Compile Include="Entities\IHasValves.cs" />
|
||||
<Compile Include="Entities\IParamsProvider.cs" />
|
||||
<Compile Include="Entities\MeasurementCorrection.cs" />
|
||||
<Compile Include="Entities\MetersPath.cs" />
|
||||
<Compile Include="Entities\OutputPath.cs" />
|
||||
@@ -92,7 +91,6 @@
|
||||
<Compile Include="Entities\Watermeter.cs" />
|
||||
<Compile Include="Entities\WMType.cs" />
|
||||
<Compile Include="FluentCommon.cs" />
|
||||
<Compile Include="Formulas.cs" />
|
||||
<Compile Include="Mappings\BenchPathMap.cs" />
|
||||
<Compile Include="Mappings\ComponentMap.cs" />
|
||||
<Compile Include="Mappings\ComponentProcedureMap.cs" />
|
||||
@@ -119,7 +117,6 @@
|
||||
<DependentUpon>Strings.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Units.cs" />
|
||||
<Compile Include="Utils.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\Strings.cs.resx" />
|
||||
|
||||
+3
-3
@@ -32,7 +32,7 @@ namespace Config
|
||||
public const int CompoundWMsCount = 1;
|
||||
public const int HeatMetersCount = 0;
|
||||
public const int MaxPartNr = 1;
|
||||
#elif TORUN_PT50_2015 || CEVAK_PT40_272 || MURES_PT40 || FUZHOU_40 || PETERSBURG_50 || KEMPNO_50 || BAHRAIN_50 || KRAKOW_50 || JUZNA_AFRIKA_50 || ZAMBIA
|
||||
#elif TORUN_PT50_2015 || CEVAK_PT40_272 || MURES_PT40 || FUZHOU_40 || PETERSBURG_50 || KEMPNO_50 || BAHRAIN_50 || KRAKOW_50
|
||||
public const int WMsCount = 20;
|
||||
public const int LineSize = 10;
|
||||
public const int CompoundWMsCount = 1;
|
||||
@@ -50,8 +50,8 @@ namespace Config
|
||||
public const int CompoundWMsCount = 1;
|
||||
public const int HeatMetersCount = 0;
|
||||
public const int MaxPartNr = WMsCount / LineSize;
|
||||
#elif TURA_SPECIAL || SENTEC
|
||||
public const int WMsCount = 6;
|
||||
#elif TURA_SPECIAL
|
||||
public const int WMsCount = 6;
|
||||
public const int LineSize = 6;
|
||||
public const int CompoundWMsCount = 1;
|
||||
public const int HeatMetersCount = 0;
|
||||
|
||||
@@ -24,8 +24,6 @@ namespace Config.Entities
|
||||
|
||||
public Component()
|
||||
{
|
||||
Name = string.Empty;
|
||||
ClassName = string.Empty;
|
||||
Corrections = new List<MeasurementCorrection>();
|
||||
}
|
||||
|
||||
@@ -127,10 +125,5 @@ namespace Config.Entities
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0} ({1})", Name, ClassName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.IO;
|
||||
@@ -13,25 +13,13 @@ namespace Config.Entities
|
||||
public virtual string Parameters { get; set; }
|
||||
public virtual Procedure Procedure { get; set; }
|
||||
|
||||
IParamsProvider paramsProvider;
|
||||
///
|
||||
public virtual IParamsProvider GetParamsProvider() { return paramsProvider; }
|
||||
public virtual void SetParamsProvider(IParamsProvider paramsProvider) { this.paramsProvider = paramsProvider; }
|
||||
|
||||
|
||||
protected ComponentProcedure() { }
|
||||
|
||||
public ComponentProcedure(string name, string parameters, Procedure procedure)
|
||||
{
|
||||
this.CmpntName = name;
|
||||
this.Parameters = parameters;
|
||||
this.Procedure = procedure;
|
||||
}
|
||||
|
||||
|
||||
public virtual ComponentProcedure Clone(Procedure newProcedure)
|
||||
{
|
||||
return new ComponentProcedure(CmpntName, Parameters, newProcedure);
|
||||
ComponentProcedure result = new ComponentProcedure();
|
||||
result.CmpntName = CmpntName;
|
||||
result.Parameters = Parameters;
|
||||
result.Procedure = newProcedure;
|
||||
return result;
|
||||
}
|
||||
|
||||
public virtual void Export(StreamWriter output)
|
||||
@@ -46,16 +34,11 @@ namespace Config.Entities
|
||||
|
||||
if (string.IsNullOrEmpty(firstLine)) return null;
|
||||
|
||||
try
|
||||
{
|
||||
string cmptnName = firstLine;
|
||||
string parameters = input.ReadLine().Replace("~", Environment.NewLine);
|
||||
return new ComponentProcedure(cmptnName, parameters, newProcedure);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
ComponentProcedure result = new ComponentProcedure();
|
||||
result.CmpntName = firstLine;
|
||||
result.Parameters = input.ReadLine().Replace("~", Environment.NewLine);
|
||||
result.Procedure = newProcedure;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.IO;
|
||||
@@ -13,25 +13,13 @@ namespace Config.Entities
|
||||
public virtual string Parameters { get; set; }
|
||||
public virtual Test Test { get; set; }
|
||||
|
||||
IParamsProvider paramsProvider;
|
||||
///
|
||||
public virtual IParamsProvider GetParamsProvider() { return paramsProvider; }
|
||||
public virtual void SetParamsProvider(IParamsProvider paramsProvider) { this.paramsProvider = paramsProvider; }
|
||||
|
||||
|
||||
protected ComponentTest() { }
|
||||
|
||||
public ComponentTest(string name, string parameters, Test test)
|
||||
{
|
||||
this.CmpntName = name;
|
||||
this.Parameters = parameters;
|
||||
this.Test = test;
|
||||
}
|
||||
|
||||
|
||||
public virtual ComponentTest Clone()
|
||||
{
|
||||
return new ComponentTest(CmpntName, Parameters, Test);
|
||||
ComponentTest result = new ComponentTest();
|
||||
result.CmpntName = CmpntName;
|
||||
result.Parameters = Parameters;
|
||||
result.Test = Test;
|
||||
return result;
|
||||
}
|
||||
|
||||
public virtual void Export(StreamWriter output)
|
||||
@@ -46,16 +34,11 @@ namespace Config.Entities
|
||||
|
||||
if (string.IsNullOrEmpty(firstLine)) return null;
|
||||
|
||||
try
|
||||
{
|
||||
string cmptnName = firstLine;
|
||||
string parameters = input.ReadLine().Replace("~", Environment.NewLine);
|
||||
return new ComponentTest(cmptnName, parameters, newTest);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
ComponentTest result = new ComponentTest();
|
||||
result.CmpntName = firstLine;
|
||||
result.Parameters = input.ReadLine().Replace("~", Environment.NewLine);
|
||||
result.Test = newTest;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,17 +80,9 @@ namespace Config.Entities
|
||||
|
||||
public enum Medium
|
||||
{
|
||||
[Description("")] NotSpecified,
|
||||
#if LANG_PL
|
||||
[Description("zimna")] ColdWater,
|
||||
[Description("ciepła")] HotWater,
|
||||
#elif LANG_IT
|
||||
[Description("freddo")] ColdWater,
|
||||
[Description("caldo")] HotWater,
|
||||
#else
|
||||
[Description("cold")] ColdWater,
|
||||
[Description("hot")] HotWater,
|
||||
#endif
|
||||
[Description("")] NotSpecified,
|
||||
ColdWater,
|
||||
HotWater,
|
||||
Count
|
||||
}
|
||||
|
||||
@@ -164,17 +156,6 @@ namespace Config.Entities
|
||||
Count
|
||||
}
|
||||
|
||||
/// <summary> Register reader type </summary>
|
||||
public enum RegisterReaderType
|
||||
{
|
||||
Unknown,
|
||||
Pulses, /// Sick, optical and similar
|
||||
Camera, /// CLP1611
|
||||
DataStream, /// iPerl
|
||||
Manual, /// Entered by human via form (also from camera images)
|
||||
Count
|
||||
}
|
||||
|
||||
/// <summary> Transition step is finished when this condition is fulfilled </summary>
|
||||
public enum StepCondition
|
||||
{
|
||||
@@ -393,22 +374,6 @@ namespace Config.Entities
|
||||
Count
|
||||
}
|
||||
|
||||
public enum VertAlignment
|
||||
{
|
||||
[Description("Top")] Top,
|
||||
[Description("Middle")] Middle,
|
||||
[Description("Bottom")] Bottom,
|
||||
}
|
||||
|
||||
public enum TableForm
|
||||
{
|
||||
None,
|
||||
Rows,
|
||||
Columns,
|
||||
ColumnsPL,
|
||||
Count,
|
||||
}
|
||||
|
||||
public enum ImageRotation
|
||||
{
|
||||
[Description("0 deg")] None,
|
||||
|
||||
@@ -225,15 +225,6 @@ namespace Config.Entities
|
||||
return diff.ToString();
|
||||
}
|
||||
|
||||
public virtual ComponentProcedure GetProcedureParamsEntity(string cmpntName)
|
||||
{
|
||||
foreach (var procPrms in MoreParams)
|
||||
{
|
||||
if (procPrms.CmpntName == cmpntName) return procPrms;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0}, rev.{1}", Name, Revision);
|
||||
|
||||
@@ -301,15 +301,6 @@ namespace Config.Entities
|
||||
return diff.ToString();
|
||||
}
|
||||
|
||||
public virtual ComponentTest GetTestParamsEntity(string cmpntName)
|
||||
{
|
||||
foreach (var tstPrms in MoreParams)
|
||||
{
|
||||
if (tstPrms.CmpntName == cmpntName) return tstPrms;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual float GetErrLimLo(float flow)
|
||||
{
|
||||
if (ErrLimLo <= ErrLimHi)
|
||||
|
||||
@@ -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.18.893.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.893.0")]
|
||||
[assembly: AssemblyVersion("2.18.797.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.797.0")]
|
||||
|
||||
+7
-82
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2016-2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2016-2017 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Reflection;
|
||||
@@ -11,12 +11,6 @@ namespace Config
|
||||
{
|
||||
[Description("---")] None,
|
||||
|
||||
[Description("imp.")] pulse,
|
||||
#if LANG_PL
|
||||
[Description("stopień")] degree,
|
||||
#else
|
||||
[Description("degree")] degree,
|
||||
#endif
|
||||
[Description("l")] l, /// * 1 liter
|
||||
[Description("dm3")] dm3, /// 1 dm3 = 1 liter
|
||||
[Description("m3")] m3, /// 1000 l
|
||||
@@ -68,28 +62,9 @@ namespace Config
|
||||
[Description("kWh")] kWh, /// 1 kWh = 3600000 J
|
||||
[Description("MWh")] MWh, /// 1 MWh = 3600000000 J
|
||||
|
||||
#if LANG_PL
|
||||
[Description("imp/l")] ppl, /// * 1 pulse/l
|
||||
[Description("imp/dm3")] ppdm3, /// * 1 pulse/dm3
|
||||
[Description("stopień/l")] degpl, /// * 1 degree/l
|
||||
[Description("stopień/dm3")] degpdm3, /// * 1 degree/dm3
|
||||
[Description("l/imp")] lpp, /// * 1 l/pulse
|
||||
[Description("dm3/imp")] dm3pp, /// * 1 dm3/pulse
|
||||
[Description("l/stopień")] lpdeg, /// * 1 l/degree
|
||||
[Description("dm3/stopień")] dm3pdeg, /// * 1 dm3/degree
|
||||
#else
|
||||
[Description("pulse/l")] ppl, /// * 1 pulse/l
|
||||
[Description("pulse/dm3")] ppdm3, /// * 1 pulse/dm3
|
||||
[Description("degree/l")] degpl, /// * 1 degree/l
|
||||
[Description("degree/dm3")] degpdm3, /// * 1 degree/dm3
|
||||
[Description("l/pulse")] lpp, /// * 1 l/pulse
|
||||
[Description("dm3/pulse")] dm3pp, /// * 1 dm3/pulse
|
||||
[Description("l/degree")] lpdeg, /// * 1 l/degree
|
||||
[Description("dm3/degree")] dm3pdeg, /// * 1 dm3/degree
|
||||
#endif
|
||||
///
|
||||
///
|
||||
[Description("pulse/kWh")] ppkWh, /// * 1 pulse/kWh
|
||||
[Description("kWh/pulse")] kWhpp, /// * 1 kWh/pulse
|
||||
|
||||
Count
|
||||
}
|
||||
@@ -109,7 +84,6 @@ namespace Config
|
||||
[Description("Länge")] Length,
|
||||
[Description("Dichte")] Density,
|
||||
[Description("Energie")] Energy,
|
||||
[Description("Impulse")] Pulses,
|
||||
[Description("Impulse/l")] PulsePerLtr,
|
||||
[Description("Impulse/kWh")] PulsePerKWh,
|
||||
|
||||
@@ -119,7 +93,7 @@ namespace Config
|
||||
[Description("Boolean")] Boolean,
|
||||
[Description("Datum und Uhrzeit")] DateTime,
|
||||
#elif LANG_PL
|
||||
[Description("Objętość")] Volume,
|
||||
[Description("Objętość")] Volume,
|
||||
[Description("Przepływ")] Flow,
|
||||
[Description("Masa")] Mass,
|
||||
[Description("Czas")] Time,
|
||||
@@ -130,7 +104,6 @@ namespace Config
|
||||
[Description("Długość")] Length,
|
||||
[Description("Gęstość")] Density,
|
||||
[Description("Energia")] Energy,
|
||||
[Description("Impulsy")] Pulses,
|
||||
[Description("Impulsy/litr")] PulsePerLtr,
|
||||
[Description("Impulsy/kWh")] PulsePerKWh,
|
||||
|
||||
@@ -151,7 +124,6 @@ namespace Config
|
||||
[Description("Délka")] Length,
|
||||
[Description("Hustota")] Density,
|
||||
[Description("Energie")] Energy,
|
||||
[Description("Pulzy")] Pulses,
|
||||
[Description("Pulzy/litr")] PulsePerLtr,
|
||||
[Description("Pulzy/kWh")] PulsePerKWh,
|
||||
|
||||
@@ -160,29 +132,8 @@ namespace Config
|
||||
[Description("Text")] String,
|
||||
[Description("Boolean")] Boolean,
|
||||
[Description("Datum a čas")] DateTime,
|
||||
#elif LANG_IT
|
||||
[Description("Volume")] Volume,
|
||||
[Description("Flusso")] Flow,
|
||||
[Description("Massa")] Mass,
|
||||
[Description("Tempo")] Time,
|
||||
[Description("Temperatura")] Temperature,
|
||||
[Description("Pressione")] Pressure,
|
||||
[Description("Umidità")] Humidity,
|
||||
[Description("Errore")] Error,
|
||||
[Description("Lungezza")] Length,
|
||||
[Description("Densità")] Density,
|
||||
[Description("Energia")] Energy,
|
||||
[Description("Impulso")] Pulses,
|
||||
[Description("Impulso/litro")] PulsePerLtr,
|
||||
[Description("Impulso/kWh")] PulsePerKWh,
|
||||
|
||||
/// Quantities without units and conversions
|
||||
[Description("Numero")] Number,
|
||||
[Description("Stringa")] String,
|
||||
[Description("Boolean")] Boolean,
|
||||
[Description("Data e ora")] DateTime,
|
||||
#else
|
||||
[Description("Volume")] Volume,
|
||||
[Description("Volume")] Volume,
|
||||
[Description("Flow")] Flow,
|
||||
[Description("Mass")] Mass,
|
||||
[Description("Time")] Time,
|
||||
@@ -193,7 +144,6 @@ namespace Config
|
||||
[Description("Length")] Length,
|
||||
[Description("Density")] Density,
|
||||
[Description("Energy")] Energy,
|
||||
[Description("Pulses")] Pulses,
|
||||
[Description("Pulses/liter")] PulsePerLtr,
|
||||
[Description("Pulses/kWh")] PulsePerKWh,
|
||||
|
||||
@@ -203,7 +153,7 @@ namespace Config
|
||||
[Description("Boolean")] Boolean,
|
||||
[Description("Date and time")] DateTime,
|
||||
#endif
|
||||
Count,
|
||||
Count,
|
||||
}
|
||||
|
||||
public static class Units
|
||||
@@ -228,10 +178,6 @@ namespace Config
|
||||
{
|
||||
switch (units)
|
||||
{
|
||||
case Unit.pulse:
|
||||
case Unit.degree:
|
||||
return Config.Quantity.Pulses;
|
||||
|
||||
case Unit.l:
|
||||
case Unit.dm3:
|
||||
case Unit.m3:
|
||||
@@ -295,17 +241,9 @@ namespace Config
|
||||
return Config.Quantity.Energy;
|
||||
|
||||
case Unit.ppl:
|
||||
case Unit.ppdm3:
|
||||
case Unit.degpl:
|
||||
case Unit.degpdm3:
|
||||
case Unit.lpp:
|
||||
case Unit.dm3pp:
|
||||
case Unit.lpdeg:
|
||||
case Unit.dm3pdeg:
|
||||
return Config.Quantity.PulsePerLtr;
|
||||
|
||||
case Unit.ppkWh:
|
||||
case Unit.kWhpp:
|
||||
return Config.Quantity.PulsePerKWh;
|
||||
|
||||
default:
|
||||
@@ -324,7 +262,6 @@ namespace Config
|
||||
public static bool IsLength(Unit units) { return IsQuantity(units, Config.Quantity.Length); }
|
||||
public static bool IsDensity(Unit units) { return IsQuantity(units, Config.Quantity.Density); }
|
||||
public static bool IsEnergy(Unit units) { return IsQuantity(units, Config.Quantity.Energy); }
|
||||
public static bool IsPulses(Unit units) { return IsQuantity(units, Config.Quantity.Pulses); }
|
||||
public static bool IsPulsePerLtr(Unit units) { return IsQuantity(units, Config.Quantity.PulsePerLtr); }
|
||||
public static bool IsPulsePerKWh(Unit units) { return IsQuantity(units, Config.Quantity.PulsePerKWh); }
|
||||
|
||||
@@ -392,13 +329,7 @@ namespace Config
|
||||
case Unit.kWh: return v / 3600000.0; /// 1 kWh = 3600000 J
|
||||
case Unit.MWh: return v / 3600000000.0;/// 1 MWh = 3600000000 J
|
||||
|
||||
case Unit.kWhpp:
|
||||
case Unit.lpp:
|
||||
case Unit.dm3pp:
|
||||
case Unit.lpdeg:
|
||||
case Unit.dm3pdeg: return ((v <= float.Epsilon) ? 0 : 1 / v);
|
||||
|
||||
default: return v;
|
||||
default: return v;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -465,13 +396,7 @@ namespace Config
|
||||
case Unit.kWh: return 3600000 * v; /// 1 kWh = 3600000 J
|
||||
case Unit.MWh: return 3600000000 * v; /// 1 kWh = 3600000000 J
|
||||
|
||||
case Unit.kWhpp:
|
||||
case Unit.lpp:
|
||||
case Unit.dm3pp:
|
||||
case Unit.lpdeg:
|
||||
case Unit.dm3pdeg: return ((v == 0) ? 0 : 1 / v);
|
||||
|
||||
default: return v;
|
||||
default: return v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Config
|
||||
{
|
||||
public static class Utils
|
||||
{
|
||||
public static string SignificantDigitsToFmt(double value, int sigDigits)
|
||||
{
|
||||
if (sigDigits == 5)
|
||||
{
|
||||
if (value >= 9999.5 || value < -9999.5) return "F0";
|
||||
else if (value >= 999.95 || value < -999.95) return "F1";
|
||||
else if (value >= 99.995 || value < -99.995) return "F2";
|
||||
else if (value >= 9.9995 || value < -9.9995) return "F3";
|
||||
else if (value >= 0.99995 || value < -0.99995) return "F4";
|
||||
else if (value >= 0.099995 || value < -0.099995) return "F5";
|
||||
else if (value >= 0.0099995 || value < -0.0099995) return "F6";
|
||||
else if (value >= 0.00099995 || value < -0.00099995) return "F7";
|
||||
else if (value >= 0.000099995 || value < -0.000099995) return "F8";
|
||||
else return "F9";
|
||||
}
|
||||
else if (sigDigits == 4)
|
||||
{
|
||||
if (value >= 999.5 || value < -999.5) return "F0";
|
||||
else if (value >= 99.95 || value < -99.95) return "F1";
|
||||
else if (value >= 9.995 || value < -9.995) return "F2";
|
||||
else if (value >= 0.9995 || value < -0.9995) return "F3";
|
||||
else if (value >= 0.09995 || value < -0.09995) return "F4";
|
||||
else if (value >= 0.009995 || value < -0.009995) return "F5";
|
||||
else if (value >= 0.0009995 || value < -0.0009995) return "F6";
|
||||
else if (value >= 0.00009995 || value < -0.00009995) return "F7";
|
||||
else return "F8";
|
||||
}
|
||||
else if (sigDigits == 3)
|
||||
{
|
||||
if (value >= 99.5 || value < -99.5) return "F0";
|
||||
else if (value >= 9.95 || value < -9.95) return "F1";
|
||||
else if (value >= 0.995 || value < -0.995) return "F2";
|
||||
else if (value >= 0.0995 || value < -0.0995) return "F3";
|
||||
else if (value >= 0.00995 || value < -0.00995) return "F4";
|
||||
else if (value >= 0.000995 || value < -0.000995) return "F5";
|
||||
else if (value >= 0.0000995 || value < -0.0000995) return "F6";
|
||||
else return "F7";
|
||||
}
|
||||
else if (sigDigits == 2)
|
||||
{
|
||||
if (value >= 9.5 || value < -9.5) return "F0";
|
||||
else if (value >= 0.95 || value < -0.95) return "F1";
|
||||
else if (value >= 0.095 || value < -0.095) return "F2";
|
||||
else if (value >= 0.0095 || value < -0.0095) return "F3";
|
||||
else if (value >= 0.00095 || value < -0.00095) return "F4";
|
||||
else if (value >= 0.000095 || value < -0.000095) return "F5";
|
||||
else return "F6";
|
||||
}
|
||||
else /// if (sigDigits == 1)
|
||||
{
|
||||
if (value >= 0.95 || value < -0.95) return "F0";
|
||||
else if (value >= 0.095 || value < -0.095) return "F1";
|
||||
else if (value >= 0.0095 || value < -0.0095) return "F2";
|
||||
else if (value >= 0.00095 || value < -0.00095) return "F3";
|
||||
else if (value >= 0.000095 || value < -0.000095) return "F4";
|
||||
else return "F5";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -68,10 +68,10 @@ namespace DeviceTest
|
||||
public DeviceTestDlg()
|
||||
{
|
||||
InitializeComponent();
|
||||
compClasses = new List<string>();
|
||||
radioButton0.Checked = true;
|
||||
stopButton.Enabled = false;
|
||||
|
||||
compClasses = new List<string>();
|
||||
|
||||
foreach (var componentFactory in TbfComponents.Factories)
|
||||
{
|
||||
compClasses.Add(componentFactory.ClassName);
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace GemCard
|
||||
{
|
||||
/// <summary>
|
||||
/// This class represents a command APDU
|
||||
/// </summary>
|
||||
public class APDUCommand
|
||||
{
|
||||
/// <summary>
|
||||
/// Minimun size of an APDU command in bytes
|
||||
/// </summary>
|
||||
public const int APDU_MIN_LENGTH = 4;
|
||||
|
||||
public byte Class; /// Class byte
|
||||
public byte Ins; /// Instruction byte
|
||||
public byte P1; /// Parameter P1 byte
|
||||
public byte P2; /// Parameter P2 byte
|
||||
public byte[] Data; /// Data to send to the card if any, null if no data to send
|
||||
public byte Le; /// Number of data expected, 0 if none
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="bCla">Class byte</param>
|
||||
/// <param name="bIns">Instruction byte</param>
|
||||
/// <param name="bP1">Parameter P1 byte</param>
|
||||
/// <param name="bP2">Parameter P2 byte</param>
|
||||
/// <param name="baData">Data to send to the card if any, null if no data to send</param>
|
||||
/// <param name="bLe">Number of data expected, 0 if none</param>
|
||||
public APDUCommand(byte bCla, byte bIns, byte bP1, byte bP2, byte[] baData, byte bLe)
|
||||
{
|
||||
this.Class = bCla;
|
||||
this.Ins = bIns;
|
||||
this.P1 = bP1;
|
||||
this.P2 = bP2;
|
||||
this.Data = baData;
|
||||
this.Le = bLe;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Update the current APDU with selected parameters
|
||||
/// </summary>
|
||||
/// <param name="apduParam">APDU parameters</param>
|
||||
public void Update(APDUParam apduParam)
|
||||
{
|
||||
if (apduParam.UseData) Data = apduParam.Data;
|
||||
if (apduParam.UseLe) Le = apduParam.Le;
|
||||
if (apduParam.UseP1) P1 = apduParam.P1;
|
||||
if (apduParam.UseP2) P2 = apduParam.P2;
|
||||
if (apduParam.UseChannel) Class += apduParam.Channel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the ToString method to format to a string the APDUCommand object
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override string ToString()
|
||||
{
|
||||
string strData = null;
|
||||
byte bLc = 0;
|
||||
byte bP3 = Le;
|
||||
|
||||
if (Data != null)
|
||||
{
|
||||
StringBuilder sData = new StringBuilder(Data.Length * 2);
|
||||
for (int nI = 0; nI < Data.Length; nI++)
|
||||
{
|
||||
sData.AppendFormat("{0:X02}", Data[nI]);
|
||||
}
|
||||
|
||||
strData = "Data=" + sData.ToString();
|
||||
bLc = (byte) Data.Length;
|
||||
bP3 = bLc;
|
||||
}
|
||||
|
||||
//string strApdu = string.Format("Class={0:X02} Ins={1:X02} P1={2:X02} P2={3:X02} Le={4:X02} Lc={5:X02} ",
|
||||
//m_bCla, m_bIns, m_bP1, m_bP2, m_bLe, bLc);
|
||||
StringBuilder strApdu = new StringBuilder();
|
||||
|
||||
strApdu.AppendFormat("Class={0:X02} Ins={1:X02} P1={2:X02} P2={3:X02} P3={4:X02} ",
|
||||
Class, Ins, P1, P2, bP3);
|
||||
|
||||
if (Data != null)
|
||||
{
|
||||
strApdu.Append(strData);
|
||||
}
|
||||
|
||||
return strApdu.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,147 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace GemCard
|
||||
{
|
||||
/// <summary>
|
||||
/// This class is used to update a set of parameters of an APDUCommand object
|
||||
/// </summary>
|
||||
public class APDUParam
|
||||
{
|
||||
byte bClass;
|
||||
byte bChannel;
|
||||
byte bP2;
|
||||
byte bP1;
|
||||
|
||||
byte[] baData;
|
||||
short nLe;
|
||||
|
||||
bool fUseP1;
|
||||
bool fUseP2;
|
||||
bool fChannel;
|
||||
bool fData;
|
||||
bool fClass;
|
||||
bool fLe;
|
||||
|
||||
/// <summary>
|
||||
/// Resets the current instance, all flags are set to false
|
||||
/// </summary>
|
||||
public void Reset()
|
||||
{
|
||||
bClass = 0;
|
||||
bChannel = 0;
|
||||
bP2 = 0;
|
||||
bP1 = 0;
|
||||
|
||||
baData = null;
|
||||
nLe = -1;
|
||||
|
||||
fUseP1 = false;
|
||||
fUseP2 = false;
|
||||
fChannel = false;
|
||||
fData = false;
|
||||
fClass = false;
|
||||
fLe = false;
|
||||
}
|
||||
|
||||
#region Constructors
|
||||
|
||||
public APDUParam()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Copy constructor (used for cloning)
|
||||
/// </summary>
|
||||
/// <param name="param"></param>
|
||||
public APDUParam(APDUParam param)
|
||||
{
|
||||
// Copy field
|
||||
if (param.baData != null)
|
||||
{
|
||||
param.baData.CopyTo(baData, 0);
|
||||
}
|
||||
|
||||
this.bClass = param.bClass;
|
||||
this.bChannel = param.bChannel;
|
||||
this.bP1 = param.bP1;
|
||||
this.bP2 = param.bP2;
|
||||
this.nLe = param.nLe;
|
||||
|
||||
// Copy flags field
|
||||
this.fChannel = param.fChannel;
|
||||
this.fClass = param.fClass;
|
||||
this.fData = param.fData;
|
||||
this.fLe = param.fLe;
|
||||
this.fUseP1 = param.fUseP1;
|
||||
this.fUseP2 = param.fUseP2;
|
||||
}
|
||||
|
||||
public APDUParam(byte bClass, byte bP1, byte bP2, byte[] baData, short nLe)
|
||||
{
|
||||
this.Class = bClass;
|
||||
this.P1 = bP1;
|
||||
this.P2 = bP2;
|
||||
this.Data = baData;
|
||||
this.Le = (byte)nLe;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Clones the current APDUParam instance
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public APDUParam Clone()
|
||||
{
|
||||
return new APDUParam(this);
|
||||
}
|
||||
|
||||
#region Properties
|
||||
|
||||
public bool UseClass { get { return fClass; } }
|
||||
public bool UseChannel { get { return fChannel; } }
|
||||
public bool UseLe { get { return fLe; } }
|
||||
public bool UseData { get { return fData; } }
|
||||
public bool UseP1 { get { return fUseP1; } }
|
||||
public bool UseP2 { get { return fUseP2; } }
|
||||
|
||||
public byte P1
|
||||
{
|
||||
get { return bP1; }
|
||||
set { bP1 = value; fUseP1 = true; }
|
||||
}
|
||||
|
||||
public byte P2
|
||||
{
|
||||
get { return bP2; }
|
||||
set { bP2 = value; fUseP2 = true; }
|
||||
}
|
||||
|
||||
public byte[] Data
|
||||
{
|
||||
get { return baData; }
|
||||
set { baData = value; fData = true; }
|
||||
}
|
||||
|
||||
public byte Le
|
||||
{
|
||||
get { return (byte)nLe; }
|
||||
set { nLe = value; fLe = true; }
|
||||
}
|
||||
|
||||
public byte Channel
|
||||
{
|
||||
get { return bChannel; }
|
||||
set { bChannel = value; fChannel = true; }
|
||||
}
|
||||
|
||||
public byte Class
|
||||
{
|
||||
get { return bClass; }
|
||||
set { bClass = value; fClass = true; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace GemCard
|
||||
{
|
||||
/// <summary>
|
||||
/// This class represents the APDU response sent by the card
|
||||
/// </summary>
|
||||
public class APDUResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// Status bytes length
|
||||
/// </summary>
|
||||
public const int SW_LENGTH = 2;
|
||||
|
||||
/// <summary>
|
||||
/// Response data. Contains the data sent by the card minus the 2 status bytes (SW1, SW2)
|
||||
/// null if no data were sent by the card
|
||||
/// </summary>
|
||||
public byte[] Data;
|
||||
public byte SW1;
|
||||
public byte SW2;
|
||||
|
||||
/// <summary>
|
||||
/// Status get property
|
||||
/// </summary>
|
||||
public ushort Status
|
||||
{
|
||||
get { return (ushort)(((short)SW1 << 8) + (short)SW2); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor from the byte data sent back by the card
|
||||
/// </summary>
|
||||
/// <param name="baData">Buffer of data from the card</param>
|
||||
public APDUResponse(byte[] baData)
|
||||
{
|
||||
if (baData.Length > SW_LENGTH)
|
||||
{
|
||||
Data = new byte[baData.Length - SW_LENGTH];
|
||||
|
||||
for (int nI = 0; nI < baData.Length - SW_LENGTH; nI++)
|
||||
{
|
||||
this.Data[nI] = baData[nI];
|
||||
}
|
||||
}
|
||||
|
||||
this.SW1 = baData[baData.Length - 2];
|
||||
this.SW2 = baData[baData.Length - 1];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the ToString method to format to a string the APDUResponse object
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override string ToString()
|
||||
{
|
||||
if (Data != null)
|
||||
{
|
||||
StringBuilder sData = new StringBuilder(Data.Length * 2);
|
||||
for (int nI = 0; nI < Data.Length; nI++)
|
||||
{
|
||||
sData.AppendFormat("{0:X02}", Data[nI]);
|
||||
}
|
||||
|
||||
return sData.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
//
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
//
|
||||
[assembly: AssemblyTitle("")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyCopyright("")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
//
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
//
|
||||
// In order to sign your assembly you must specify a key to use. Refer to the
|
||||
// Microsoft .NET Framework documentation for more information on assembly signing.
|
||||
//
|
||||
// Use the attributes below to control which key is used for signing.
|
||||
//
|
||||
// Notes:
|
||||
// (*) If no key is specified, the assembly is not signed.
|
||||
// (*) KeyName refers to a key that has been installed in the Crypto Service
|
||||
// Provider (CSP) on your machine. KeyFile refers to a file which contains
|
||||
// a key.
|
||||
// (*) If the KeyFile and the KeyName values are both specified, the
|
||||
// following processing occurs:
|
||||
// (1) If the KeyName can be found in the CSP, that key is used.
|
||||
// (2) If the KeyName does not exist and the KeyFile does exist, the key
|
||||
// in the KeyFile is installed into the CSP and used.
|
||||
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
|
||||
// When specifying the KeyFile, the location of the KeyFile should be
|
||||
// relative to the project output directory which is
|
||||
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
|
||||
// located in the project directory, you would specify the AssemblyKeyFile
|
||||
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
|
||||
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
|
||||
// documentation for more information on this.
|
||||
//
|
||||
[assembly: AssemblyDelaySign(false)]
|
||||
[assembly: AssemblyKeyFile("")]
|
||||
[assembly: AssemblyKeyName("")]
|
||||
@@ -1,162 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace GemCard
|
||||
{
|
||||
/// <summary>
|
||||
/// Values for AttrId of SCardGetAttrib
|
||||
/// </summary>
|
||||
public class SCARD_ATTR_VALUE
|
||||
{
|
||||
private const uint
|
||||
SCARD_CLASS_COMMUNICATIONS = 2,
|
||||
SCARD_CLASS_PROTOCOL = 3,
|
||||
SCARD_CLASS_MECHANICAL = 6,
|
||||
SCARD_CLASS_VENDOR_DEFINED = 7,
|
||||
SCARD_CLASS_IFD_PROTOCOL = 8,
|
||||
SCARD_CLASS_ICC_STATE = 9,
|
||||
SCARD_CLASS_SYSTEM = 0x7fff;
|
||||
|
||||
private static UInt32 SCardAttrValue(UInt32 attrClass, UInt32 val)
|
||||
{
|
||||
return (attrClass << 16) | val;
|
||||
}
|
||||
|
||||
public static UInt32 CHANNEL_ID { get { return SCardAttrValue(SCARD_CLASS_COMMUNICATIONS, 0x0110); } }
|
||||
|
||||
public static UInt32 CHARACTERISTICS { get { return SCardAttrValue(SCARD_CLASS_MECHANICAL, 0x0150); } }
|
||||
|
||||
public static UInt32 CURRENT_PROTOCOL_TYPE { get { return SCardAttrValue(SCARD_CLASS_IFD_PROTOCOL, 0x0201); } }
|
||||
|
||||
public static UInt32 DEVICE_UNIT { get { return SCardAttrValue(SCARD_CLASS_SYSTEM, 0x0001); } }
|
||||
public static UInt32 DEVICE_FRIENDLY_NAME { get { return SCardAttrValue(SCARD_CLASS_SYSTEM, 0x0003); } }
|
||||
public UInt32 DEVICE_SYSTEM_NAME { get { return SCardAttrValue(SCARD_CLASS_SYSTEM, 0x0004); } }
|
||||
|
||||
public static UInt32 ICC_PRESENCE { get { return SCardAttrValue(SCARD_CLASS_ICC_STATE, 0x0300); } }
|
||||
public static UInt32 ICC_INTERFACE_STATUS { get { return SCardAttrValue(SCARD_CLASS_ICC_STATE, 0x0301); } }
|
||||
public static UInt32 ATR_STRING { get { return SCardAttrValue(SCARD_CLASS_ICC_STATE, 0x0303); } }
|
||||
public static UInt32 ICC_TYPE_PER_ATR { get { return SCardAttrValue(SCARD_CLASS_ICC_STATE, 0x0304); } }
|
||||
|
||||
public static UInt32 PROTOCOL_TYPES { get { return SCardAttrValue(SCARD_CLASS_PROTOCOL, 0x0120); } }
|
||||
|
||||
public static UInt32 VENDOR_NAME { get { return SCardAttrValue(SCARD_CLASS_VENDOR_DEFINED, 0x0100); } }
|
||||
public static UInt32 VENDOR_IFD_TYPE { get { return SCardAttrValue(SCARD_CLASS_VENDOR_DEFINED, 0x0101); } }
|
||||
public static UInt32 VENDOR_IFD_VERSION { get { return SCardAttrValue(SCARD_CLASS_VENDOR_DEFINED, 0x0102); } }
|
||||
public static UInt32 VENDOR_IFD_SERIAL_NO { get { return SCardAttrValue(SCARD_CLASS_VENDOR_DEFINED, 0x0103); } }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Abstract class that adds a basic event management to the ICard interface.
|
||||
/// </summary>
|
||||
abstract public class CardBase : ICard
|
||||
{
|
||||
protected const uint INFINITE = 0xFFFFFFFF;
|
||||
protected const uint WAIT_TIME = 250;
|
||||
|
||||
protected bool m_bRunCardDetection = true;
|
||||
protected Thread m_thread = null;
|
||||
|
||||
/// <summary>
|
||||
/// Event handler for the card insertion
|
||||
/// </summary>
|
||||
public event EventHandler<CardInsertedEventArgs> OnCardInserted = null;
|
||||
|
||||
/// <summary>
|
||||
/// Event handler for the card removal
|
||||
/// </summary>
|
||||
public event EventHandler<CardRemovedEventArgs> OnCardRemoved = null;
|
||||
|
||||
~CardBase()
|
||||
{
|
||||
// Stop any eventual card detection thread
|
||||
StopCardEvents();
|
||||
}
|
||||
|
||||
#region Abstract method that implement the ICard interface
|
||||
abstract public string[] ListReaders();
|
||||
abstract public void Connect(string Reader, SHARE ShareMode, PROTOCOL PreferredProtocols);
|
||||
abstract public void Disconnect(DISCONNECT Disposition);
|
||||
abstract public APDUResponse Transmit(APDUCommand ApduCmd);
|
||||
abstract public void BeginTransaction();
|
||||
abstract public void EndTransaction(DISCONNECT Disposition);
|
||||
abstract public byte[] GetAttribute(UInt32 AttribId);
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// This method should start a thread that checks for card insertion or removal
|
||||
/// </summary>
|
||||
/// <param name="Reader"></param>
|
||||
public void StartCardEvents(string Reader)
|
||||
{
|
||||
if (m_thread == null)
|
||||
{
|
||||
m_bRunCardDetection = true;
|
||||
|
||||
m_thread = new Thread(new ParameterizedThreadStart(RunCardDetection));
|
||||
m_thread.Start(Reader);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stops the card events thread
|
||||
/// </summary>
|
||||
public void StopCardEvents()
|
||||
{
|
||||
if (m_thread != null)
|
||||
{
|
||||
int
|
||||
nTimeOut = 10,
|
||||
nCount = 0;
|
||||
bool m_bStop = false;
|
||||
m_bRunCardDetection = false;
|
||||
|
||||
do
|
||||
{
|
||||
if (nCount > nTimeOut)
|
||||
{
|
||||
m_thread.Abort();
|
||||
break;
|
||||
}
|
||||
|
||||
if (m_thread.ThreadState == ThreadState.Aborted)
|
||||
m_bStop = true;
|
||||
|
||||
if (m_thread.ThreadState == ThreadState.Stopped)
|
||||
m_bStop = true;
|
||||
|
||||
Thread.Sleep(200);
|
||||
++nCount; // Manage time out
|
||||
}
|
||||
while (!m_bStop);
|
||||
|
||||
m_thread = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function must implement a card detection mechanism.
|
||||
///
|
||||
/// When card insertion is detected, it must call the method CardInserted()
|
||||
/// When card removal is detected, it must call the method CardRemoved()
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="Reader">Name of the reader to scan for card event</param>
|
||||
abstract protected void RunCardDetection(object Reader);
|
||||
|
||||
#region Event methods
|
||||
|
||||
protected void CardInserted(object sender, CardInsertedEventArgs args)
|
||||
{
|
||||
if (OnCardInserted != null) OnCardInserted(sender, args);
|
||||
}
|
||||
|
||||
protected void CardRemoved(object sender, CardRemovedEventArgs args)
|
||||
{
|
||||
if (OnCardRemoved != null) OnCardRemoved(sender, args);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,173 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using SCARDSSPLib;
|
||||
using GemCardExLib;
|
||||
|
||||
namespace GemCard
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements the ICard interface using the SCard COM objects from Microsoft and SCardDatabaseEx object
|
||||
/// for the ListReaders function.
|
||||
/// </summary>
|
||||
public class CardCOM : CardBase
|
||||
{
|
||||
private ISCard m_itfCard = null;
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public CardCOM()
|
||||
{
|
||||
// Create the SCard object
|
||||
m_itfCard = new CSCardClass();
|
||||
}
|
||||
|
||||
#region ICard Members
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the PCSC function
|
||||
/// LONG SCardListReaders(SCARDCONTEXT hContext,
|
||||
/// LPCTSTR mszGroups,
|
||||
/// LPTSTR mszReaders,
|
||||
/// LPDWORD pcchReaders
|
||||
/// );
|
||||
/// </summary>
|
||||
/// <returns>A string array of the readers</returns>
|
||||
public override string[] ListReaders()
|
||||
{
|
||||
ISCardDatabaseEx itfCardBase = new SCardDatabaseEx();
|
||||
|
||||
return (string[]) itfCardBase.ListReaders();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the PCSC function
|
||||
/// LONG SCardConnect(
|
||||
/// IN SCARDCONTEXT hContext,
|
||||
/// IN LPCTSTR szReader,
|
||||
/// IN DWORD dwShareMode,
|
||||
/// IN DWORD dwPreferredProtocols,
|
||||
/// OUT LPSCARDHANDLE phCard,
|
||||
/// OUT LPDWORD pdwActiveProtocol
|
||||
/// );
|
||||
/// </summary>
|
||||
/// <param name="Reader"></param>
|
||||
/// <param name="ShareMode"></param>
|
||||
/// <param name="PreferredProtocols"></param>
|
||||
public override void Connect(string Reader, SHARE ShareMode, PROTOCOL PreferredProtocols)
|
||||
{
|
||||
// Calls AttachReader to connect to the card
|
||||
m_itfCard.AttachByReader(Reader, (SCARD_SHARE_MODES) ShareMode, (SCARD_PROTOCOLS) PreferredProtocols);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the PCSC function
|
||||
/// LONG SCardDisconnect(
|
||||
/// IN SCARDHANDLE hCard,
|
||||
/// IN DWORD dwDisposition
|
||||
/// );
|
||||
/// </summary>
|
||||
/// <param name="Disposition"></param>
|
||||
public override void Disconnect(DISCONNECT Disposition)
|
||||
{
|
||||
// Off the connection with the card
|
||||
m_itfCard.Detach((SCARD_DISPOSITIONS) Disposition);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the PCSC function
|
||||
/// LONG SCardTransmit(
|
||||
/// SCARDHANDLE hCard,
|
||||
/// LPCSCARD_I0_REQUEST pioSendPci,
|
||||
/// LPCBYTE pbSendBuffer,
|
||||
/// DWORD cbSendLength,
|
||||
/// LPSCARD_IO_REQUEST pioRecvPci,
|
||||
/// LPBYTE pbRecvBuffer,
|
||||
/// LPDWORD pcbRecvLength
|
||||
/// );
|
||||
/// </summary>
|
||||
/// <param name="ApduCmd">APDUCommand object with the APDU to send to the card</param>
|
||||
/// <returns>An APDUResponse object with the response from the card</returns>
|
||||
public override APDUResponse Transmit(APDUCommand ApduCmd)
|
||||
{
|
||||
CSCardCmd itfCmd = new CSCardCmdClass();
|
||||
CByteBuffer itfData = new CByteBufferClass();
|
||||
int nLe = ApduCmd.Le;
|
||||
|
||||
if (ApduCmd.Data == null)
|
||||
{
|
||||
itfData.SetSize(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
int nWrite = 0;
|
||||
|
||||
itfData.SetSize(ApduCmd.Data.Length);
|
||||
itfData.Write(ref ApduCmd.Data[0], ApduCmd.Data.Length, ref nWrite);
|
||||
}
|
||||
|
||||
// Build the APDU command
|
||||
itfCmd.BuildCmd(ApduCmd.Class, ApduCmd.Ins, ApduCmd.P1, ApduCmd.P2, itfData, ref nLe);
|
||||
|
||||
// Send the command
|
||||
m_itfCard.Transaction(ref itfCmd);
|
||||
|
||||
// Analyse the response
|
||||
int nRead = 0;
|
||||
byte[] pbResp = new byte[itfCmd.ApduReplyLength];
|
||||
|
||||
itfCmd.ApduReply.Read(ref pbResp[0], itfCmd.ApduReplyLength, ref nRead);
|
||||
|
||||
return new APDUResponse(pbResp);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the PSCS function
|
||||
/// LONG SCardBeginTransaction(
|
||||
/// SCARDHANDLE hCard
|
||||
// );
|
||||
/// This function is not supported in the COM implementation
|
||||
/// </summary>
|
||||
public override void BeginTransaction()
|
||||
{
|
||||
throw new NotImplementedException("BeginTransaction is not supported in the COM implementation");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the PCSC function
|
||||
/// LONG SCardEndTransaction(
|
||||
/// SCARDHANDLE hCard,
|
||||
/// DWORD dwDisposition
|
||||
/// );
|
||||
/// This function is not supported in the COM implementation
|
||||
/// </summary>
|
||||
/// <param name="Disposition">A value from DISCONNECT enum</param>
|
||||
public override void EndTransaction(DISCONNECT Disposition)
|
||||
{
|
||||
throw new NotImplementedException("EndTransaction is not supported in the COM implementation");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the attributes of the card
|
||||
/// </summary>
|
||||
/// <param name="AttribId">Identifier for the Attribute to get</param>
|
||||
/// <returns>Attribute content</returns>
|
||||
public override byte[] GetAttribute(UInt32 AttribId)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// This function must implement a card detection mechanism.
|
||||
///
|
||||
/// When card insertion is detected, it must call the method CardInserted()
|
||||
/// When card removal is detected, it must call the method CardRemoved()
|
||||
///
|
||||
/// </summary>
|
||||
protected override void RunCardDetection(object Reader)
|
||||
{
|
||||
throw new Exception("The method or operation is not implemented.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace GemCard
|
||||
{
|
||||
public class CardInsertedEventArgs : EventArgs
|
||||
{
|
||||
public CardInsertedEventArgs() { }
|
||||
}
|
||||
}
|
||||
@@ -1,620 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace GemCard
|
||||
{
|
||||
/// <summary>
|
||||
/// CARD_STATE enumeration, used by the PC/SC function SCardGetStatusChanged
|
||||
/// </summary>
|
||||
enum CARD_STATE
|
||||
{
|
||||
UNAWARE = 0x00000000,
|
||||
IGNORE = 0x00000001,
|
||||
CHANGED = 0x00000002,
|
||||
UNKNOWN = 0x00000004,
|
||||
UNAVAILABLE = 0x00000008,
|
||||
EMPTY = 0x00000010,
|
||||
PRESENT = 0x00000020,
|
||||
ATRMATCH = 0x00000040,
|
||||
EXCLUSIVE = 0x00000080,
|
||||
INUSE = 0x00000100,
|
||||
MUTE = 0x00000200,
|
||||
UNPOWERED = 0x00000400
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the SCARD_IO_STRUCTURE
|
||||
///
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct SCard_IO_Request
|
||||
{
|
||||
public UInt32 m_dwProtocol;
|
||||
public UInt32 m_cbPciLength;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Wraps theSCARD_READERSTATE structure of PC/SC
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
|
||||
public struct SCard_ReaderState
|
||||
{
|
||||
public string m_szReader;
|
||||
public IntPtr m_pvUserData;
|
||||
public UInt32 m_dwCurrentState;
|
||||
public UInt32 m_dwEventState;
|
||||
public UInt32 m_cbAtr;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst=32)]
|
||||
public byte[] m_rgbAtr;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implementation of ICard using native (P/Invoke) interoperability for PC/SC
|
||||
/// </summary>
|
||||
public class CardNative : CardBase
|
||||
{
|
||||
private UInt32 m_hContext = 0;
|
||||
private UInt32 m_hCard = 0;
|
||||
private UInt32 m_nProtocol = (uint) PROTOCOL.T0;
|
||||
private int m_nLastError = 0;
|
||||
|
||||
#region PCSC_FUNCTIONS
|
||||
/// <summary>
|
||||
/// Native SCardGetStatusChanged from winscard.dll
|
||||
/// </summary>
|
||||
/// <param name="hContext"></param>
|
||||
/// <param name="dwTimeout"></param>
|
||||
/// <param name="rgReaderStates"></param>
|
||||
/// <param name="cReaders"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("winscard.dll", SetLastError = true)]
|
||||
internal static extern int SCardGetStatusChange(UInt32 hContext,
|
||||
UInt32 dwTimeout,
|
||||
[In,Out] SCard_ReaderState[] rgReaderStates,
|
||||
UInt32 cReaders);
|
||||
|
||||
/// <summary>
|
||||
/// Native SCardListReaders function from winscard.dll
|
||||
/// </summary>
|
||||
/// <param name="hContext"></param>
|
||||
/// <param name="mszGroups"></param>
|
||||
/// <param name="mszReaders"></param>
|
||||
/// <param name="pcchReaders"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("winscard.dll", SetLastError=true)]
|
||||
internal static extern int SCardListReaders(UInt32 hContext,
|
||||
[MarshalAs(UnmanagedType.LPTStr)] string mszGroups,
|
||||
IntPtr mszReaders,
|
||||
out UInt32 pcchReaders);
|
||||
|
||||
/// <summary>
|
||||
/// Native SCardEstablishContext function from winscard.dll
|
||||
/// </summary>
|
||||
/// <param name="dwScope"></param>
|
||||
/// <param name="pvReserved1"></param>
|
||||
/// <param name="pvReserved2"></param>
|
||||
/// <param name="phContext"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("winscard.dll", SetLastError=true)]
|
||||
internal static extern int SCardEstablishContext(UInt32 dwScope,
|
||||
IntPtr pvReserved1,
|
||||
IntPtr pvReserved2,
|
||||
IntPtr phContext);
|
||||
|
||||
/// <summary>
|
||||
/// Native SCardReleaseContext function from winscard.dll
|
||||
/// </summary>
|
||||
/// <param name="hContext"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("winscard.dll", SetLastError=true)]
|
||||
internal static extern int SCardReleaseContext(UInt32 hContext);
|
||||
|
||||
/// <summary>
|
||||
/// Native SCardConnect function from winscard.dll
|
||||
/// </summary>
|
||||
/// <param name="hContext"></param>
|
||||
/// <param name="szReader"></param>
|
||||
/// <param name="dwShareMode"></param>
|
||||
/// <param name="dwPreferredProtocols"></param>
|
||||
/// <param name="phCard"></param>
|
||||
/// <param name="pdwActiveProtocol"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("winscard.dll", SetLastError=true, CharSet=CharSet.Auto)]
|
||||
internal static extern int SCardConnect(UInt32 hContext,
|
||||
[MarshalAs(UnmanagedType.LPTStr)] string szReader,
|
||||
UInt32 dwShareMode,
|
||||
UInt32 dwPreferredProtocols,
|
||||
IntPtr phCard,
|
||||
IntPtr pdwActiveProtocol);
|
||||
|
||||
/// <summary>
|
||||
/// Native SCardDisconnect function from winscard.dll
|
||||
/// </summary>
|
||||
/// <param name="hCard"></param>
|
||||
/// <param name="dwDisposition"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("winscard.dll", SetLastError=true)]
|
||||
internal static extern int SCardDisconnect(UInt32 hCard,
|
||||
UInt32 dwDisposition);
|
||||
|
||||
/// <summary>
|
||||
/// Native SCardTransmit function from winscard.dll
|
||||
/// </summary>
|
||||
/// <param name="hCard"></param>
|
||||
/// <param name="pioSendPci"></param>
|
||||
/// <param name="pbSendBuffer"></param>
|
||||
/// <param name="cbSendLength"></param>
|
||||
/// <param name="pioRecvPci"></param>
|
||||
/// <param name="pbRecvBuffer"></param>
|
||||
/// <param name="pcbRecvLength"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("winscard.dll", SetLastError=true)]
|
||||
internal static extern int SCardTransmit(UInt32 hCard,
|
||||
[In] ref SCard_IO_Request pioSendPci,
|
||||
byte[] pbSendBuffer,
|
||||
UInt32 cbSendLength,
|
||||
IntPtr pioRecvPci,
|
||||
[Out] byte[] pbRecvBuffer,
|
||||
out UInt32 pcbRecvLength
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Native SCardBeginTransaction function of winscard.dll
|
||||
/// </summary>
|
||||
/// <param name="hContext"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("winscard.dll", SetLastError = true)]
|
||||
internal static extern int SCardBeginTransaction(UInt32 hContext);
|
||||
|
||||
/// <summary>
|
||||
/// Native SCardEndTransaction function of winscard.dll
|
||||
/// </summary>
|
||||
/// <param name="hContext"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("winscard.dll", SetLastError = true)]
|
||||
internal static extern int SCardEndTransaction(UInt32 hContext, UInt32 dwDisposition);
|
||||
|
||||
[DllImport("winscard.dll", SetLastError = true)]
|
||||
internal static extern int SCardGetAttrib(UInt32 hCard,
|
||||
UInt32 dwAttribId,
|
||||
[Out] byte[] pbAttr,
|
||||
out UInt32 pcbAttrLen);
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public CardNative()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Object destruction
|
||||
/// </summary>
|
||||
~CardNative()
|
||||
{
|
||||
Disconnect(DISCONNECT.Unpower);
|
||||
|
||||
ReleaseContext();
|
||||
}
|
||||
|
||||
#region ICard Members
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the PCSC function
|
||||
/// LONG SCardListReaders(SCARDCONTEXT hContext,
|
||||
/// LPCTSTR mszGroups,
|
||||
/// LPTSTR mszReaders,
|
||||
/// LPDWORD pcchReaders
|
||||
/// );
|
||||
/// </summary>
|
||||
/// <returns>A string array of the readers</returns>
|
||||
public override string[] ListReaders()
|
||||
{
|
||||
EstablishContext(SCOPE.User);
|
||||
|
||||
string[] sListReaders = null;
|
||||
UInt32 pchReaders = 0;
|
||||
IntPtr szListReaders = IntPtr.Zero;
|
||||
|
||||
m_nLastError = SCardListReaders(m_hContext, null, szListReaders, out pchReaders);
|
||||
if (m_nLastError == 0)
|
||||
{
|
||||
szListReaders = Marshal.AllocHGlobal((int) pchReaders);
|
||||
m_nLastError = SCardListReaders(m_hContext, null, szListReaders, out pchReaders);
|
||||
if (m_nLastError == 0)
|
||||
{
|
||||
char[] caReadersData = new char[pchReaders];
|
||||
int nbReaders = 0;
|
||||
for (int nI = 0; nI < pchReaders; nI++)
|
||||
{
|
||||
caReadersData[nI] = (char) Marshal.ReadByte(szListReaders, nI);
|
||||
|
||||
if (caReadersData[nI] == 0)
|
||||
nbReaders++;
|
||||
}
|
||||
|
||||
// Remove last 0
|
||||
--nbReaders;
|
||||
|
||||
if (nbReaders != 0)
|
||||
{
|
||||
sListReaders = new string[nbReaders];
|
||||
char[] caReader = new char[pchReaders];
|
||||
int nIdx = 0;
|
||||
int nIdy = 0;
|
||||
int nIdz = 0;
|
||||
// Get the nJ string from the multi-string
|
||||
|
||||
while(nIdx < pchReaders - 1)
|
||||
{
|
||||
caReader[nIdy] = caReadersData[nIdx];
|
||||
if (caReader[nIdy] == 0)
|
||||
{
|
||||
sListReaders[nIdz] = new string(caReader, 0, nIdy);
|
||||
++nIdz;
|
||||
nIdy = 0;
|
||||
caReader = new char[pchReaders];
|
||||
}
|
||||
else
|
||||
++nIdy;
|
||||
|
||||
++nIdx;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Marshal.FreeHGlobal(szListReaders);
|
||||
}
|
||||
|
||||
ReleaseContext();
|
||||
|
||||
return sListReaders;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the PCSC function
|
||||
/// LONG SCardEstablishContext(
|
||||
/// IN DWORD dwScope,
|
||||
/// IN LPCVOID pvReserved1,
|
||||
/// IN LPCVOID pvReserved2,
|
||||
/// OUT LPSCARDCONTEXT phContext
|
||||
/// );
|
||||
/// </summary>
|
||||
/// <param name="Scope"></param>
|
||||
public void EstablishContext(SCOPE Scope)
|
||||
{
|
||||
IntPtr hContext = Marshal.AllocHGlobal(Marshal.SizeOf(m_hContext));
|
||||
|
||||
m_nLastError = SCardEstablishContext((uint) Scope, IntPtr.Zero, IntPtr.Zero, hContext);
|
||||
if (m_nLastError != 0)
|
||||
{
|
||||
string msg = "SCardEstablishContext error: " + m_nLastError;
|
||||
|
||||
Marshal.FreeHGlobal(hContext);
|
||||
throw new Exception(msg);
|
||||
}
|
||||
|
||||
m_hContext = (uint) Marshal.ReadInt32(hContext);
|
||||
|
||||
Marshal.FreeHGlobal(hContext);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the PCSC function
|
||||
/// LONG SCardReleaseContext(
|
||||
/// IN SCARDCONTEXT hContext
|
||||
/// );
|
||||
/// </summary>
|
||||
public void ReleaseContext()
|
||||
{
|
||||
if (m_hContext != 0)
|
||||
{
|
||||
m_nLastError = SCardReleaseContext(m_hContext);
|
||||
|
||||
if (m_nLastError != 0)
|
||||
{
|
||||
string msg = "SCardReleaseContext error: " + m_nLastError;
|
||||
throw new Exception(msg);
|
||||
}
|
||||
|
||||
m_hContext = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the PCSC function
|
||||
/// LONG SCardConnect(
|
||||
/// IN SCARDCONTEXT hContext,
|
||||
/// IN LPCTSTR szReader,
|
||||
/// IN DWORD dwShareMode,
|
||||
/// IN DWORD dwPreferredProtocols,
|
||||
/// OUT LPSCARDHANDLE phCard,
|
||||
/// OUT LPDWORD pdwActiveProtocol
|
||||
/// );
|
||||
/// </summary>
|
||||
/// <param name="Reader"></param>
|
||||
/// <param name="ShareMode"></param>
|
||||
/// <param name="PreferredProtocols"></param>
|
||||
public override void Connect(string Reader, SHARE ShareMode, PROTOCOL PreferredProtocols)
|
||||
{
|
||||
EstablishContext(SCOPE.User);
|
||||
|
||||
IntPtr hCard = Marshal.AllocHGlobal(Marshal.SizeOf(m_hCard));
|
||||
IntPtr pProtocol = Marshal.AllocHGlobal(Marshal.SizeOf(m_nProtocol));
|
||||
|
||||
m_nLastError = SCardConnect(m_hContext,
|
||||
Reader,
|
||||
(uint) ShareMode,
|
||||
(uint) PreferredProtocols,
|
||||
hCard,
|
||||
pProtocol);
|
||||
|
||||
if (m_nLastError != 0)
|
||||
{
|
||||
string msg = "SCardConnect error: " + m_nLastError;
|
||||
|
||||
Marshal.FreeHGlobal(hCard);
|
||||
Marshal.FreeHGlobal(pProtocol);
|
||||
throw new Exception(msg);
|
||||
}
|
||||
|
||||
m_hCard = (uint) Marshal.ReadInt32(hCard);
|
||||
m_nProtocol = (uint) Marshal.ReadInt32(pProtocol);
|
||||
|
||||
Marshal.FreeHGlobal(hCard);
|
||||
Marshal.FreeHGlobal(pProtocol);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the PCSC function
|
||||
/// LONG SCardDisconnect(
|
||||
/// IN SCARDHANDLE hCard,
|
||||
/// IN DWORD dwDisposition
|
||||
/// );
|
||||
/// </summary>
|
||||
/// <param name="Disposition"></param>
|
||||
public override void Disconnect(DISCONNECT Disposition)
|
||||
{
|
||||
if (m_hCard != 0)
|
||||
{
|
||||
m_nLastError = SCardDisconnect(m_hCard, (uint) Disposition);
|
||||
m_hCard = 0;
|
||||
|
||||
if (m_nLastError != 0)
|
||||
{
|
||||
string msg = "SCardDisconnect error: " + m_nLastError;
|
||||
throw new Exception(msg);
|
||||
}
|
||||
|
||||
ReleaseContext();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the PCSC function
|
||||
/// LONG SCardTransmit(
|
||||
/// SCARDHANDLE hCard,
|
||||
/// LPCSCARD_I0_REQUEST pioSendPci,
|
||||
/// LPCBYTE pbSendBuffer,
|
||||
/// DWORD cbSendLength,
|
||||
/// LPSCARD_IO_REQUEST pioRecvPci,
|
||||
/// LPBYTE pbRecvBuffer,
|
||||
/// LPDWORD pcbRecvLength
|
||||
/// );
|
||||
/// </summary>
|
||||
/// <param name="ApduCmd">APDUCommand object with the APDU to send to the card</param>
|
||||
/// <returns>An APDUResponse object with the response from the card</returns>
|
||||
public override APDUResponse Transmit(APDUCommand ApduCmd)
|
||||
{
|
||||
uint RecvLength = (uint) (ApduCmd.Le + APDUResponse.SW_LENGTH);
|
||||
byte[] ApduBuffer = null;
|
||||
byte[] ApduResponse = new byte[ApduCmd.Le + APDUResponse.SW_LENGTH];
|
||||
SCard_IO_Request ioRequest = new SCard_IO_Request();
|
||||
ioRequest.m_dwProtocol = m_nProtocol;
|
||||
ioRequest.m_cbPciLength = 8;
|
||||
|
||||
// Build the command APDU
|
||||
if (ApduCmd.Data == null)
|
||||
{
|
||||
ApduBuffer = new byte[APDUCommand.APDU_MIN_LENGTH + ((ApduCmd.Le != 0) ? 1 : 0)];
|
||||
|
||||
if (ApduCmd.Le != 0)
|
||||
ApduBuffer[4] = (byte) ApduCmd.Le;
|
||||
}
|
||||
else
|
||||
{
|
||||
ApduBuffer = new byte[APDUCommand.APDU_MIN_LENGTH + 1 + ApduCmd.Data.Length];
|
||||
|
||||
for (int nI = 0; nI < ApduCmd.Data.Length; nI++)
|
||||
ApduBuffer[APDUCommand.APDU_MIN_LENGTH + 1 + nI] = ApduCmd.Data[nI];
|
||||
|
||||
ApduBuffer[APDUCommand.APDU_MIN_LENGTH] = (byte) ApduCmd.Data.Length;
|
||||
}
|
||||
|
||||
ApduBuffer[0] = ApduCmd.Class;
|
||||
ApduBuffer[1] = ApduCmd.Ins;
|
||||
ApduBuffer[2] = ApduCmd.P1;
|
||||
ApduBuffer[3] = ApduCmd.P2;
|
||||
|
||||
m_nLastError = SCardTransmit(m_hCard, ref ioRequest, ApduBuffer, (uint) ApduBuffer.Length, IntPtr.Zero, ApduResponse, out RecvLength);
|
||||
if (m_nLastError != 0)
|
||||
{
|
||||
string msg = "SCardTransmit error: " + m_nLastError;
|
||||
throw new Exception(msg);
|
||||
}
|
||||
|
||||
byte[] ApduData = new byte[RecvLength];
|
||||
|
||||
for (int nI = 0; nI < RecvLength; nI++)
|
||||
ApduData[nI] = ApduResponse[nI];
|
||||
|
||||
return new APDUResponse(ApduData);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the PSCS function
|
||||
/// LONG SCardBeginTransaction(
|
||||
/// SCARDHANDLE hCard
|
||||
// );
|
||||
/// </summary>
|
||||
public override void BeginTransaction()
|
||||
{
|
||||
if (m_hCard != 0)
|
||||
{
|
||||
m_nLastError = SCardBeginTransaction(m_hCard);
|
||||
if (m_nLastError != 0)
|
||||
{
|
||||
string msg = "SCardBeginTransaction error: " + m_nLastError;
|
||||
throw new Exception(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the PCSC function
|
||||
/// LONG SCardEndTransaction(
|
||||
/// SCARDHANDLE hCard,
|
||||
/// DWORD dwDisposition
|
||||
/// );
|
||||
/// </summary>
|
||||
/// <param name="Disposition">A value from DISCONNECT enum</param>
|
||||
public override void EndTransaction(DISCONNECT Disposition)
|
||||
{
|
||||
if (m_hCard != 0)
|
||||
{
|
||||
m_nLastError = SCardEndTransaction(m_hCard, (UInt32)Disposition);
|
||||
if (m_nLastError != 0)
|
||||
{
|
||||
string msg = "SCardEndTransaction error: " + m_nLastError;
|
||||
throw new Exception(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the attributes of the card
|
||||
/// </summary>
|
||||
/// <param name="AttribId">Identifier for the Attribute to get</param>
|
||||
/// <returns>Attribute content</returns>
|
||||
public override byte[] GetAttribute(UInt32 AttribId)
|
||||
{
|
||||
byte[] attr = null;
|
||||
UInt32 attrLen = 0;
|
||||
|
||||
m_nLastError = SCardGetAttrib(m_hCard, AttribId, attr, out attrLen);
|
||||
if (m_nLastError == 0)
|
||||
{
|
||||
if (attrLen != 0)
|
||||
{
|
||||
attr = new byte[attrLen];
|
||||
m_nLastError = SCardGetAttrib(m_hCard, AttribId, attr, out attrLen);
|
||||
if (m_nLastError != 0)
|
||||
{
|
||||
string msg = "SCardGetAttr error: " + m_nLastError;
|
||||
throw new Exception(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string msg = "SCardGetAttr error: " + m_nLastError;
|
||||
throw new Exception(msg);
|
||||
}
|
||||
|
||||
return attr;
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// This function must implement a card detection mechanism.
|
||||
///
|
||||
/// When card insertion is detected, it must call the method CardInserted()
|
||||
/// When card removal is detected, it must call the method CardRemoved()
|
||||
///
|
||||
/// </summary>
|
||||
protected override void RunCardDetection(object Reader)
|
||||
{
|
||||
bool bFirstLoop = true;
|
||||
UInt32 hContext = 0; // Local context
|
||||
IntPtr phContext;
|
||||
|
||||
phContext = Marshal.AllocHGlobal(Marshal.SizeOf(hContext));
|
||||
|
||||
if (SCardEstablishContext((uint) SCOPE.User, IntPtr.Zero, IntPtr.Zero, phContext) == 0)
|
||||
{
|
||||
hContext = (uint)Marshal.ReadInt32(phContext);
|
||||
Marshal.FreeHGlobal(phContext);
|
||||
|
||||
UInt32 nbReaders = 1;
|
||||
SCard_ReaderState[] readerState = new SCard_ReaderState[nbReaders];
|
||||
|
||||
readerState[0].m_dwCurrentState = (UInt32) CARD_STATE.UNAWARE;
|
||||
readerState[0].m_szReader = (string)Reader;
|
||||
|
||||
UInt32 eventState;
|
||||
UInt32 currentState = readerState[0].m_dwCurrentState;
|
||||
|
||||
// Card detection loop
|
||||
do
|
||||
{
|
||||
if (SCardGetStatusChange(hContext, WAIT_TIME
|
||||
, readerState, nbReaders) == 0)
|
||||
{
|
||||
eventState = readerState[0].m_dwEventState;
|
||||
currentState = readerState[0].m_dwCurrentState;
|
||||
|
||||
// Check state
|
||||
if (((eventState & (uint) CARD_STATE.CHANGED) == (uint) CARD_STATE.CHANGED) && !bFirstLoop)
|
||||
{
|
||||
// State has changed
|
||||
if ((eventState & (uint) CARD_STATE.EMPTY) == (uint) CARD_STATE.EMPTY)
|
||||
{
|
||||
// There is no card, card has been removed -> Fire CardRemoved event
|
||||
CardRemoved(this, new CardRemovedEventArgs());
|
||||
}
|
||||
|
||||
if (((eventState & (uint)CARD_STATE.PRESENT) == (uint)CARD_STATE.PRESENT) &&
|
||||
((eventState & (uint) CARD_STATE.PRESENT) != (currentState & (uint) CARD_STATE.PRESENT)))
|
||||
{
|
||||
// There is a card in the reader -> Fire CardInserted event
|
||||
CardInserted(this, new CardInsertedEventArgs());
|
||||
}
|
||||
|
||||
if ((eventState & (uint) CARD_STATE.ATRMATCH) == (uint) CARD_STATE.ATRMATCH)
|
||||
{
|
||||
// There is a card in the reader and it matches the ATR we were expecting-> Fire CardInserted event
|
||||
CardInserted(this, new CardInsertedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
// The current stateis now the event state
|
||||
readerState[0].m_dwCurrentState = eventState;
|
||||
|
||||
bFirstLoop = false;
|
||||
}
|
||||
|
||||
Thread.Sleep(100);
|
||||
|
||||
if (m_bRunCardDetection == false)
|
||||
break;
|
||||
}
|
||||
while (true); // Exit on request
|
||||
}
|
||||
else
|
||||
{
|
||||
Marshal.FreeHGlobal(phContext);
|
||||
throw new Exception("PC/SC error");
|
||||
}
|
||||
|
||||
SCardReleaseContext(hContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace GemCard
|
||||
{
|
||||
public class CardRemovedEventArgs : EventArgs
|
||||
{
|
||||
public CardRemovedEventArgs() { }
|
||||
}
|
||||
}
|
||||
@@ -1,194 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<ProjectType>Local</ProjectType>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{8B10D15A-39DE-4B56-8DD1-710C1EB3A697}</ProjectGuid>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ApplicationIcon>
|
||||
</ApplicationIcon>
|
||||
<AssemblyKeyContainerName>
|
||||
</AssemblyKeyContainerName>
|
||||
<AssemblyName>GemCard</AssemblyName>
|
||||
<AssemblyOriginatorKeyFile>
|
||||
</AssemblyOriginatorKeyFile>
|
||||
<DefaultClientScript>JScript</DefaultClientScript>
|
||||
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
|
||||
<DefaultTargetSchema>IE50</DefaultTargetSchema>
|
||||
<DelaySign>false</DelaySign>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>GemCard</RootNamespace>
|
||||
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
|
||||
<StartupObject>
|
||||
</StartupObject>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>3.5</OldToolsVersion>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<NoStdLib>false</NoStdLib>
|
||||
<NoWarn>
|
||||
</NoWarn>
|
||||
<Optimize>false</Optimize>
|
||||
<RegisterForComInterop>false</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>false</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<NoStdLib>false</NoStdLib>
|
||||
<NoWarn>
|
||||
</NoWarn>
|
||||
<Optimize>true</Optimize>
|
||||
<RegisterForComInterop>false</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>false</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
|
||||
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Optimize>true</Optimize>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System">
|
||||
<Name>System</Name>
|
||||
</Reference>
|
||||
<Reference Include="System.Data">
|
||||
<Name>System.Data</Name>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml">
|
||||
<Name>System.XML</Name>
|
||||
</Reference>
|
||||
<COMReference Include="GemCardExLib">
|
||||
<Guid>{F1FF634B-BEDF-461C-A409-5B88E05F5117}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
</COMReference>
|
||||
<COMReference Include="SCARDSSPLib">
|
||||
<Guid>{82C38704-19F1-11D3-A11F-00C04F79F800}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
</COMReference>
|
||||
<COMReference Include="stdole">
|
||||
<Guid>{00020430-0000-0000-C000-000000000046}</Guid>
|
||||
<VersionMajor>2</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>primary</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
</COMReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="APDUCommand.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="APDUParam.cs" />
|
||||
<Compile Include="APDUResponse.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="AssemblyInfo.cs" />
|
||||
<Compile Include="CardBase.cs" />
|
||||
<Compile Include="CardInsertedEventArgs.cs" />
|
||||
<Compile Include="CardNative.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="CardRemovedEventArgs.cs" />
|
||||
<Compile Include="ICard.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SmartCardException.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Windows Installer 3.1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>
|
||||
</PreBuildEvent>
|
||||
<PostBuildEvent>
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -1,70 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<LastOpenVersion>8.0.50215</LastOpenVersion>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ReferencePath>
|
||||
</ReferencePath>
|
||||
<CopyProjectDestinationFolder>
|
||||
</CopyProjectDestinationFolder>
|
||||
<CopyProjectUncPath>
|
||||
</CopyProjectUncPath>
|
||||
<CopyProjectOption>0</CopyProjectOption>
|
||||
<ProjectView>ProjectFiles</ProjectView>
|
||||
<ProjectTrust>0</ProjectTrust>
|
||||
<PublishUrlHistory />
|
||||
<InstallUrlHistory />
|
||||
<SupportUrlHistory />
|
||||
<UpdateUrlHistory />
|
||||
<BootstrapperUrlHistory />
|
||||
<ErrorReportUrlHistory />
|
||||
<FallbackCulture>en-US</FallbackCulture>
|
||||
<VerifyUploadedFiles>false</VerifyUploadedFiles>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<EnableASPDebugging>false</EnableASPDebugging>
|
||||
<EnableASPXDebugging>false</EnableASPXDebugging>
|
||||
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
|
||||
<EnableSQLServerDebugging>false</EnableSQLServerDebugging>
|
||||
<RemoteDebugEnabled>false</RemoteDebugEnabled>
|
||||
<RemoteDebugMachine>
|
||||
</RemoteDebugMachine>
|
||||
<StartAction>Project</StartAction>
|
||||
<StartArguments>
|
||||
</StartArguments>
|
||||
<StartPage>
|
||||
</StartPage>
|
||||
<StartProgram>
|
||||
</StartProgram>
|
||||
<StartURL>
|
||||
</StartURL>
|
||||
<StartWorkingDirectory>
|
||||
</StartWorkingDirectory>
|
||||
<StartWithIE>true</StartWithIE>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<EnableASPDebugging>false</EnableASPDebugging>
|
||||
<EnableASPXDebugging>false</EnableASPXDebugging>
|
||||
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
|
||||
<EnableSQLServerDebugging>false</EnableSQLServerDebugging>
|
||||
<RemoteDebugEnabled>false</RemoteDebugEnabled>
|
||||
<RemoteDebugMachine>
|
||||
</RemoteDebugMachine>
|
||||
<StartAction>Project</StartAction>
|
||||
<StartArguments>
|
||||
</StartArguments>
|
||||
<StartPage>
|
||||
</StartPage>
|
||||
<StartProgram>
|
||||
</StartProgram>
|
||||
<StartURL>
|
||||
</StartURL>
|
||||
<StartWorkingDirectory>
|
||||
</StartWorkingDirectory>
|
||||
<StartWithIE>false</StartWithIE>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<StartWithIE>true</StartWithIE>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -1,149 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace GemCard
|
||||
{
|
||||
/// <summary>
|
||||
/// This interface gives access to the basic card functions. It must be implemented by a class.
|
||||
/// </summary>
|
||||
public interface ICard
|
||||
{
|
||||
/// <summary>
|
||||
/// Wraps the PCSC funciton
|
||||
/// LONG SCardListReaders(SCARDCONTEXT hContext,
|
||||
/// LPCTSTR mszGroups,
|
||||
/// LPTSTR mszReaders,
|
||||
/// LPDWORD pcchReaders
|
||||
/// );
|
||||
/// </summary>
|
||||
/// <returns>A string array of the readers</returns>
|
||||
string[] ListReaders();
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the PCSC function
|
||||
/// LONG SCardConnect(
|
||||
/// IN SCARDCONTEXT hContext,
|
||||
/// IN LPCTSTR szReader,
|
||||
/// IN DWORD dwShareMode,
|
||||
/// IN DWORD dwPreferredProtocols,
|
||||
/// OUT LPSCARDHANDLE phCard,
|
||||
/// OUT LPDWORD pdwActiveProtocol
|
||||
/// );
|
||||
/// </summary>
|
||||
/// <param name="Reader"></param>
|
||||
/// <param name="ShareMode"></param>
|
||||
/// <param name="PreferredProtocols"></param>
|
||||
void Connect(string Reader, SHARE ShareMode, PROTOCOL PreferredProtocols);
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the PCSC function
|
||||
/// LONG SCardDisconnect(
|
||||
/// IN SCARDHANDLE hCard,
|
||||
/// IN DWORD dwDisposition
|
||||
/// );
|
||||
/// </summary>
|
||||
/// <param name="Disposition"></param>
|
||||
void Disconnect(DISCONNECT Disposition);
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the PCSC function
|
||||
/// LONG SCardTransmit(
|
||||
/// SCARDHANDLE hCard,
|
||||
/// LPCSCARD_I0_REQUEST pioSendPci,
|
||||
/// LPCBYTE pbSendBuffer,
|
||||
/// DWORD cbSendLength,
|
||||
/// LPSCARD_IO_REQUEST pioRecvPci,
|
||||
/// LPBYTE pbRecvBuffer,
|
||||
/// LPDWORD pcbRecvLength
|
||||
/// );
|
||||
/// </summary>
|
||||
/// <param name="ApduCmd">APDUCommand object with the APDU to send to the card</param>
|
||||
/// <returns>An APDUResponse object with the response from the card</returns>
|
||||
APDUResponse Transmit(APDUCommand ApduCmd);
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the PSCS function
|
||||
/// LONG SCardBeginTransaction(
|
||||
/// SCARDHANDLE hCard
|
||||
// );
|
||||
/// </summary>
|
||||
void BeginTransaction();
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the PCSC function
|
||||
/// LONG SCardEndTransaction(
|
||||
/// SCARDHANDLE hCard,
|
||||
/// DWORD dwDisposition
|
||||
/// );
|
||||
/// </summary>
|
||||
void EndTransaction(DISCONNECT Disposition);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the attributes of the card
|
||||
/// </summary>
|
||||
/// <param name="AttribId">Identifier for the Attribute to get</param>
|
||||
/// <returns>Attribute content</returns>
|
||||
byte[] GetAttribute(UInt32 AttribId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SCOPE context
|
||||
/// </summary>
|
||||
public enum SCOPE
|
||||
{
|
||||
/// <summary>
|
||||
/// The context is a user context, and any database operations are performed within the
|
||||
/// domain of the user.
|
||||
/// </summary>
|
||||
User,
|
||||
|
||||
/// <summary>
|
||||
/// The context is that of the current terminal, and any database operations are performed
|
||||
/// within the domain of that terminal. (The calling application must have appropriate
|
||||
/// access permissions for any database actions.)
|
||||
/// </summary>
|
||||
Terminal,
|
||||
|
||||
/// <summary>
|
||||
/// The context is the system context, and any database operations are performed within the
|
||||
/// domain of the system. (The calling application must have appropriate access
|
||||
/// permissions for any database actions.)
|
||||
/// </summary>
|
||||
System
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SHARE mode enumeration
|
||||
/// </summary>
|
||||
public enum SHARE
|
||||
{
|
||||
Exclusive = 1, /// This app. is not willing to share this card with other applications.
|
||||
Shared, /// This app. is willing to share this card with other applications.
|
||||
Direct, /// This app. demands direct control of the reader, so it is not available to other applications.
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// PROTOCOL enumeration
|
||||
/// </summary>
|
||||
public enum PROTOCOL
|
||||
{
|
||||
Undefined = 0x00000000, /// There is no active protocol.
|
||||
T0 = 0x00000001, /// T=0 is the active protocol.
|
||||
T1 = 0x00000002, /// T=1 is the active protocol.
|
||||
T0orT1 = T0 | T1, /// T=1 or T=0 can be the active protocol
|
||||
Raw = 0x00010000, /// Raw is the active protocol.
|
||||
Default = unchecked ((int) 0x80000000), /// Use implicit PTS.
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// DISCONNECT action enumeration
|
||||
/// </summary>
|
||||
public enum DISCONNECT
|
||||
{
|
||||
Leave, /// Don't do anything special on close
|
||||
Reset, /// Reset the card on close
|
||||
Unpower, /// Power down the card on close
|
||||
Eject, /// Eject(!) the card on close
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace GemCard
|
||||
{
|
||||
/// <summary>
|
||||
/// Smart card exceptions
|
||||
/// </summary>
|
||||
public class SmartCardException : Exception
|
||||
{
|
||||
|
||||
public SmartCardException() : base("Smart card exception")
|
||||
{
|
||||
}
|
||||
|
||||
public SmartCardException(string Message) : base(Message)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class ApduCommandException : Exception
|
||||
{
|
||||
public const string
|
||||
NotValidDocument = "The file is not a valid APDU command document",
|
||||
NoSuchCommand = "No such APDU command in the document",
|
||||
ParamLeFormat = "Le parameter format is not correct",
|
||||
ParamP3Format = "P3 parameter format is not correct",
|
||||
NoSuchSequence = "No such APDU sequence in the document",
|
||||
MissingApduOrCommand = "An Apdu or a Sequence is missing in this Sequence";
|
||||
|
||||
public ApduCommandException() : base("APDU command exception")
|
||||
{
|
||||
}
|
||||
|
||||
public ApduCommandException(string Message) : base(Message)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -296,13 +296,13 @@ namespace Results
|
||||
ISession session = DB.CreateSession();
|
||||
if (session == null) return null;
|
||||
|
||||
TestDataList = session.QueryOver<TestData>().List();
|
||||
ComponentsList = session.QueryOver<Components>().List();
|
||||
WaterMeterDataList = session.QueryOver<WaterMeterData>().List();
|
||||
|
||||
try
|
||||
{
|
||||
TestDataList = session.QueryOver<TestData>().List();
|
||||
ComponentsList = session.QueryOver<Components>().List();
|
||||
WaterMeterDataList = session.QueryOver<WaterMeterData>().List();
|
||||
|
||||
batches = session.QueryOver<Batch>()
|
||||
batches = session.QueryOver<Batch>()
|
||||
.Where(x => (x.BatchNr == batchNr))
|
||||
.List();
|
||||
|
||||
@@ -315,14 +315,14 @@ namespace Results
|
||||
.Where(x => (x.Batch.Id == batch.Id))
|
||||
.List();
|
||||
}
|
||||
|
||||
return (batches.Count > 0) ? batches[0] : null;
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
log.FatalFormat("Cannot load batch #{0}: {1}", batchNr, exc.Message);
|
||||
return null;
|
||||
}
|
||||
|
||||
return (batches.Count > 0) ? batches[0] : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
|
||||
@@ -10,8 +10,6 @@ namespace Results.Entities
|
||||
public virtual int Id { get; protected set; }
|
||||
|
||||
public virtual byte CompoundMeterId { get; set; } /// 0=single, 1=compound/main, 2=compound/aux., 3=compound/overal, 4=heat meter volume, 5=heat meter energy
|
||||
public virtual int RegReaderType { get; set; } /// Not mapped to the DB, does not depent on localisation and customer
|
||||
|
||||
public virtual double PulsesMeter { get; set; } /// # of water meter or heat meter pulses
|
||||
public virtual double PulsesMaster { get; set; } /// # of reference flowmeter pulses (gated by this water meter pulses)
|
||||
public virtual double PulsesPerLiter { get; set; } /// [l ^ -1], in case of heat meters (CompoundMeterId==5) pulses per kWh in [kWh ^ -1]
|
||||
@@ -40,7 +38,7 @@ namespace Results.Entities
|
||||
public virtual double FlowMass() { return TestRslt.FlowMass; } /// [kg/h]
|
||||
public virtual double FlowVolume() { return TestRslt.FlowVolume; } /// [m3/h]
|
||||
public virtual double ErrorMaster() { return TestRslt.ErrorMaster; } /// [%]
|
||||
public virtual double DensityLine() { return TestRslt.DensityLine; }
|
||||
public virtual double DensityOut() { return TestRslt.DensityOut; }
|
||||
public virtual Components Components(){ return TestRslt.Components; }
|
||||
///
|
||||
public virtual TestData TestData() { return TestRslt.TestData; }
|
||||
@@ -75,11 +73,6 @@ namespace Results.Entities
|
||||
(CompoundMeterId == (byte)Config.Entities.CompoundMeterId.HeatMeterEnergy);
|
||||
}
|
||||
|
||||
public virtual bool IsPulses() { return (RegReaderType == (int)Config.Entities.RegisterReaderType.Pulses || RegReaderType == (int)Config.Entities.RegisterReaderType.Unknown); }
|
||||
public virtual bool IsCamera() { return (RegReaderType == (int)Config.Entities.RegisterReaderType.Camera); }
|
||||
public virtual bool IsDataStream() { return (RegReaderType == (int)Config.Entities.RegisterReaderType.DataStream); }
|
||||
public virtual bool IsManual() { return (RegReaderType == (int)Config.Entities.RegisterReaderType.Manual); }
|
||||
|
||||
public virtual string PassedColorStr()
|
||||
{
|
||||
return Utils.PassedColorStr(Passed, Evaluate());
|
||||
@@ -103,8 +96,6 @@ namespace Results.Entities
|
||||
{
|
||||
if (src == null) return;
|
||||
|
||||
CompoundMeterId = src.CompoundMeterId;
|
||||
RegReaderType = src.RegReaderType;
|
||||
PulsesMeter = src.PulsesMeter;
|
||||
PulsesMaster = src.PulsesMaster;
|
||||
PulsesPerLiter = src.PulsesPerLiter;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2015-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -14,26 +14,24 @@ namespace Results.Entities
|
||||
public virtual Batch Batch { get; set; }
|
||||
public virtual TestData TestData { get; set; }
|
||||
public virtual Components Components { get; set; }
|
||||
public virtual int Part { get; set; }
|
||||
public virtual int Part { get; set; }
|
||||
public virtual int RepetitionNr { get; set; } /// Repetition number from the set of repeated tests (1...)
|
||||
public virtual string MethodClass { get; set; } /// Not mapped to the DB, does not depent on localisation and customer
|
||||
|
||||
/// Main results
|
||||
public virtual bool TestDone { get; set; }
|
||||
public virtual string Remark { get; set; }
|
||||
public virtual string Remark { get; set; }
|
||||
public virtual DateTime StartTime { get; set; } /// Date and time of the test start
|
||||
public virtual DateTime EndTime { get; set; } /// Date and time of the test end
|
||||
public virtual int FlowSetTime { get; set; } /// [s] Measurement time in seconds
|
||||
public virtual double TestTime { get; set; } /// [s] Measurement time in seconds
|
||||
public virtual double PulsesMaster { get; set; }
|
||||
public virtual double ConstMasterRaw { get; set; } /// [l/pls] Liters per pulse of the master flow meter uncorrected
|
||||
public virtual double ConstMaster { get; set; } /// [l/pls] Liters per pulse of the master flow meter
|
||||
public virtual double MassStartRaw { get; set; } /// [kg]
|
||||
public virtual double ConstMaster { get; set; } /// [pls/l] Pulses per liter master flow meter
|
||||
public virtual double MassStartRaw { get; set; } /// [kg]
|
||||
public virtual double MassStart { get; set; } /// [kg]
|
||||
public virtual double MassEndRaw { get; set; } /// [kg]
|
||||
public virtual double MassEnd { get; set; } /// [kg]
|
||||
public virtual double DensityIn { get; set; } /// [kg/m3]
|
||||
public virtual double DensityLine { get; set; } /// [kg/m3]
|
||||
public virtual double DensityOut { get; set; } /// [kg/m3]
|
||||
public virtual double DensityDiv { get; set; } /// [kg/m3]
|
||||
public virtual double Buoyancy { get; set; }
|
||||
public virtual double FlowMass { get; set; } /// [kg/h] calculated from conventional true value
|
||||
@@ -129,9 +127,6 @@ namespace Results.Entities
|
||||
public virtual double TargetVolume() { return TestData.TargetVolume; }
|
||||
public virtual double TargetTime() { return TestData.TargetTime; }
|
||||
public virtual string Method() { return TestData.Method; }
|
||||
public virtual bool IsPMaxTest() { return (MethodClass != null) && (MethodClass.Contains("PMaxTest") || MethodClass.Contains("LeakTest")); }
|
||||
public virtual bool IsStartStop() { return (MethodClass != null) && MethodClass.Contains("FixedStart"); }
|
||||
public virtual bool IsDiverter() { return (MethodClass != null) && MethodClass.Contains("FlyingStart") && MethodClass.Contains("MassColl"); }
|
||||
|
||||
public virtual double ErrLimLo()
|
||||
{
|
||||
@@ -208,22 +203,20 @@ namespace Results.Entities
|
||||
Components = src.Components; /// ???
|
||||
Part = src.Part;
|
||||
RepetitionNr = src.RepetitionNr;
|
||||
MethodClass = src.MethodClass;
|
||||
TestDone = src.TestDone;
|
||||
TestDone = src.TestDone;
|
||||
Remark = src.Remark;
|
||||
StartTime = src.StartTime;
|
||||
EndTime = src.EndTime;
|
||||
FlowSetTime = src.FlowSetTime;
|
||||
TestTime = src.TestTime;
|
||||
PulsesMaster = src.PulsesMaster;
|
||||
ConstMasterRaw = src.ConstMasterRaw;
|
||||
ConstMaster = src.ConstMaster;
|
||||
MassStartRaw = src.MassStartRaw;
|
||||
MassStart = src.MassStart;
|
||||
MassEndRaw = src.MassEndRaw;
|
||||
MassEnd = src.MassEnd;
|
||||
DensityIn = src.DensityIn;
|
||||
DensityLine = src.DensityLine;
|
||||
DensityOut = src.DensityOut;
|
||||
DensityDiv = src.DensityDiv;
|
||||
Buoyancy = src.Buoyancy;
|
||||
FlowMass = src.FlowMass;
|
||||
@@ -307,12 +300,7 @@ namespace Results.Entities
|
||||
/// <summary> Wrapper </summary>
|
||||
public virtual string ErrorFlagsStr()
|
||||
{
|
||||
string eFlags = Utils.ErrorFlagsStr(ErrorFlags);
|
||||
#if LANG_PL
|
||||
return string.IsNullOrEmpty(eFlags) ? "brak" : eFlags;
|
||||
#else
|
||||
return eFlags;
|
||||
#endif
|
||||
return Utils.ErrorFlagsStr(ErrorFlags);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
@@ -325,7 +313,7 @@ namespace Results.Entities
|
||||
return string.Format("TestRslt: Part={0} RepetitionNr={1} TestDone={2} Remark={3} StartTime={4} EndTime={5} FlowSetTime={6} TestTime={7} PulsesMaster={8} ConstMaster={9} MassStartRaw={10} MassStart={11} MassEndRaw={12} MassEnd={13} DensityIn={14} DensityOut={15} DensityDiv={16} Buoyancy={17} FlowMass={18} FlowVolume={19} VolumeCTV={20} VolumeMaster={21} ErrorMaster={22} DiverterStart={85} DiverterEnd={86} ErrorFlags={23} ErrorFlagsMd={24} AmbTempMean={25} AmbTempStart={26} AmbTempEnd={27} AmbTempMin={28} AmbTempMax={29} AmbPressMean={30} AmbPressStart={31} AmbPressEnd={32} AmbPressMin={33} AmbPressMax={34} AmbHumiMean={35} AmbHumiStart={36} AmbHumiEnd={37} AmbHumiMin={38} AmbHumiMax={39} PressUpMean={40} PressUpStart={41} PressUpEnd={42} PressUpMin={43} PressUpMax={44} PressDownMean={45} PressDownStart={46} PressDownEnd={47} PressDownMin={48} PressDownMax={49} PressDeltaMean={50} PressDeltaStart={51} PressDeltaEnd={52} PressDeltaMin={53} PressDeltaMax={54} TempUpMean={55} TempUpStart={56} TempUpEnd={57} TempUpMin={58} TempUpMax={59} TempDownMean={60} TempDownStart={61} TempDownEnd={62} TempDownMin={63} TempDownMax={64} TempDivMean={65} TempDivStart={66} TempDivEnd={67} TempDivMin={68} TempDivMax={69} FlowMean={70} FlowStart={71} FlowEnd={72} FlowMin={73} FlowMax={74} Custom1={75} Custom2={76} Custom3={77} Custom4={78} Custom5={79} Custom6={80} Custom7={81} Custom8={82} Custom9={83} Custom10={84}",
|
||||
Part, RepetitionNr, TestDone, Remark, StartTime, EndTime, FlowSetTime, TestTime,
|
||||
PulsesMaster, ConstMaster, MassStartRaw, MassStart, MassEndRaw, MassEnd,
|
||||
DensityIn, DensityLine, DensityDiv, Buoyancy, FlowMass, FlowVolume,
|
||||
DensityIn, DensityOut, DensityDiv, Buoyancy, FlowMass, FlowVolume,
|
||||
VolumeCTV, VolumeMaster, ErrorMaster, ErrorFlags, ErrorFlagsMd,
|
||||
AmbTempMean, AmbTempStart, AmbTempEnd, AmbTempMin, AmbTempMax,
|
||||
AmbPressMean, AmbPressStart, AmbPressEnd, AmbPressMin, AmbPressMax,
|
||||
|
||||
@@ -130,48 +130,10 @@ namespace Results.Entities
|
||||
return (errorFlagsMode != ErrorFlagsMode.Off) ? (eFlagsFromTests | ErrorFlags) : 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert combined errorFlags of all tests to string
|
||||
/// </summary>
|
||||
/// <returns>ErrorFlags string</returns>
|
||||
public virtual string ErrorFlagsStr()
|
||||
public virtual string ErrorFlagstStr()
|
||||
{
|
||||
ErrorFlagsMode errorFlagsMode;
|
||||
string eFlags = Utils.ErrorFlagsStr(ErrorFlagsFromTestsAndWM(out errorFlagsMode));
|
||||
#if LANG_PL
|
||||
return string.IsNullOrEmpty(eFlags) ? "brak" : eFlags;
|
||||
#else
|
||||
return eFlags;
|
||||
#endif
|
||||
}
|
||||
|
||||
public virtual string PassedOrErrorFlagsStr()
|
||||
{
|
||||
ErrorFlagsMode errorFlagsMode;
|
||||
string eFlags = Utils.ErrorFlagsStr(ErrorFlagsFromTestsAndWM(out errorFlagsMode));
|
||||
return string.IsNullOrEmpty(eFlags) ? (WaterMeterData.Text4 + PassedColorStr()) : eFlags;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert failed tests and combined errorFlags of all tests to string
|
||||
/// </summary>
|
||||
/// <returns>ErrorFlagsEx string</returns>
|
||||
public virtual string ErrorFlagsStrEx()
|
||||
{
|
||||
StringBuilder errFlgsStr = new StringBuilder();
|
||||
foreach (var mtr in MeterTestRslts)
|
||||
{
|
||||
if (mtr.Evaluate() && mtr.TestDone && !mtr.Passed)
|
||||
{
|
||||
errFlgsStr.Append(mtr.Name());
|
||||
errFlgsStr.Append(" ");
|
||||
}
|
||||
}
|
||||
|
||||
ErrorFlagsMode errorFlagsMode;
|
||||
errFlgsStr.Append(Utils.ErrorFlagsStr(ErrorFlagsFromTestsAndWM(out errorFlagsMode)));
|
||||
|
||||
return errFlgsStr.ToString();
|
||||
return Utils.ErrorFlagsStr(ErrorFlagsFromTestsAndWM(out errorFlagsMode));
|
||||
}
|
||||
|
||||
public virtual bool PassedFromTests()
|
||||
@@ -215,8 +177,6 @@ namespace Results.Entities
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
///
|
||||
/// Not mapped to the database
|
||||
///
|
||||
|
||||
@@ -41,8 +41,6 @@ namespace Results.Entities
|
||||
public virtual string MetrologicalClassAux { get; set; }
|
||||
public virtual string ApprovalInfoAux { get; set; }
|
||||
|
||||
public virtual Config.Entities.Medium Medium { get; set; }
|
||||
|
||||
public virtual string Text1 { get; set; }
|
||||
public virtual string Text2 { get; set; }
|
||||
public virtual string Text3 { get; set; }
|
||||
@@ -98,8 +96,6 @@ namespace Results.Entities
|
||||
if (MetrologicalClassAux != wmd.MetrologicalClassAux) return false;
|
||||
if (ApprovalInfoAux != wmd.ApprovalInfoAux) return false;
|
||||
|
||||
if (Medium != wmd.Medium) return false;
|
||||
|
||||
if (Text1 != wmd.Text1) return false;
|
||||
if (Text2 != wmd.Text2) return false;
|
||||
if (Text3 != wmd.Text3) return false;
|
||||
|
||||
+3
-42
@@ -56,7 +56,7 @@ namespace Results
|
||||
Flow_profile_sensitivity_class, /// 46
|
||||
Approval_info, /// 47
|
||||
Certificate, /// 48
|
||||
Pulses_per_liter, /// 49 Water meter constant (water meter data, not used in calculations)
|
||||
Pulses_per_liter, /// 49
|
||||
Text1, /// 50
|
||||
Text2, /// 51
|
||||
Text3, /// 52
|
||||
@@ -68,8 +68,8 @@ namespace Results
|
||||
WM_Position, /// 58
|
||||
End_state, /// 59
|
||||
Pulses, /// 60
|
||||
Pulse__liter, /// 61 Water meter constant (pulses per liter) specific for one test
|
||||
Reference_pulses_ni, /// 62 Reference pulses gated for specific meter (synchro method)
|
||||
Pulses__liter, /// 61
|
||||
Reference_pulses, /// 62
|
||||
Reference_energy, /// 63
|
||||
Test_bench_ID, /// 64
|
||||
Program_version, /// 65
|
||||
@@ -213,45 +213,6 @@ namespace Results
|
||||
/// {0}=start DateTime {1}-end DateTime, {2}=batch nr., {3}=wm pos.(1..max), {4}=s/n string
|
||||
E21, /// 185
|
||||
|
||||
T_line_mean, /// 186
|
||||
T_line_start, /// 187
|
||||
T_line_end, /// 188
|
||||
T_line_avg, /// 189
|
||||
T_line_min, /// 190
|
||||
T_line_max, /// 191
|
||||
|
||||
ErrorFlagsEx, /// 192
|
||||
RhoDistilledWtrAtMeLineTemp, /// 193
|
||||
ConstMaster, /// 194
|
||||
Reference_pulses, /// 195 Reference pulses not gated
|
||||
spare,
|
||||
Separator, /// 197
|
||||
Test_time_ni, /// 198 Test time for a specific meter (gated in case of a synchro method OR a difference of 2 time stamps)
|
||||
PMax_test_time, /// 199 Pressure test time
|
||||
Start_valve_open_time, /// 200
|
||||
Start_valve_close_time, /// 201
|
||||
Qc, /// 202 Flow for a water meter
|
||||
Degree__liter, /// 203 Water meter constant (degree per liter) specific for one test with camera
|
||||
Camera_angle, /// 204
|
||||
Camera_angle_start, /// 205
|
||||
Camera_angle_end, /// 206
|
||||
|
||||
P_delta_mean_per_mtr, /// 207
|
||||
P_delta_mean_from_up_down, /// 208
|
||||
P_delta_mean_from_up_down_per_mtr, /// 209
|
||||
Timestamp_start, /// 210
|
||||
Timestamp_end, /// 211
|
||||
P_PMax_test_mean, /// 212 PMax test pressure mean of (Pup + Pdown)/2
|
||||
|
||||
Medium, /// 213 Woda zimna/ciepla
|
||||
|
||||
Flow_ctv, /// 214
|
||||
Flow_ctv_min, /// 215
|
||||
Flow_ctv_max, /// 216
|
||||
Flow_ctv_start, /// 217
|
||||
Flow_ctv_end, /// 218
|
||||
ConstMasterRaw, /// 219 ConstMaster (like 194) uncorrected
|
||||
|
||||
Count,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,244 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Results.Entities;
|
||||
using Results.Resources;
|
||||
|
||||
namespace Results
|
||||
{
|
||||
public class ItemSpec
|
||||
{
|
||||
///
|
||||
/// Public fields
|
||||
///
|
||||
public readonly string Name; /// Name-s of all items must be unique
|
||||
public readonly string ClmnHeaderText; /// Text printed in the column header
|
||||
|
||||
|
||||
///
|
||||
/// Function to pick a MeterTestResult field and convert it into a string
|
||||
///
|
||||
public delegate string PrintDlgt(MeterTestRslt meterTestRslt);
|
||||
|
||||
///
|
||||
/// Function to pick a MeterTestResult field and convert it into a string
|
||||
///
|
||||
public delegate string PrintCompoundDlgt(MeterTestRslt mainMtrTestResult,
|
||||
MeterTestRslt auxMtrTestResult,
|
||||
MeterTestRslt compoundMtrTestResult);
|
||||
|
||||
///
|
||||
/// Function to pick a MeterTestResult field and convert it into a string
|
||||
///
|
||||
public delegate string PrintHeatMeterDlgt(MeterTestRslt volumeTestResult,
|
||||
MeterTestRslt energyTestResult);
|
||||
|
||||
private readonly PrintDlgt printDlgt;
|
||||
private readonly PrintCompoundDlgt printCompoundDlgt;
|
||||
private readonly PrintHeatMeterDlgt printHeatMeterDlgt;
|
||||
|
||||
public bool CanPrintSingle { get { return (printDlgt != null); } }
|
||||
public bool CanPrintCompoundMeter { get { return (printCompoundDlgt != null); } }
|
||||
public bool CanPrintHeatMeter { get { return (printHeatMeterDlgt != null); } }
|
||||
|
||||
/// <summary> Safe wrapper which replaces null-s by empty strings </summary>
|
||||
public string Print(MeterTestRslt meterTestRslt)
|
||||
{
|
||||
string str = null;
|
||||
if (printDlgt != null) str = printDlgt(meterTestRslt);
|
||||
return (str == null) ? string.Empty : str;
|
||||
}
|
||||
|
||||
/// <summary> Safe wrapper which replaces null-s by empty strings </summary>
|
||||
public string PrintCombined(MeterTestRslt mainMtrTestResult,
|
||||
MeterTestRslt auxMtrTestResult,
|
||||
MeterTestRslt compoundMtrTestResult)
|
||||
{
|
||||
string str = null;
|
||||
if (printCompoundDlgt != null) str = printCompoundDlgt(mainMtrTestResult, auxMtrTestResult, compoundMtrTestResult);
|
||||
return (str == null) ? string.Empty : str;
|
||||
}
|
||||
|
||||
/// <summary> Safe wrapper which replaces null-s by empty strings </summary>
|
||||
public string PrintHeatMeter(MeterTestRslt volumeTestResult,
|
||||
MeterTestRslt energyTestResult)
|
||||
{
|
||||
string str = null;
|
||||
if (printHeatMeterDlgt != null) str = printHeatMeterDlgt(volumeTestResult, energyTestResult);
|
||||
return (str == null) ? string.Empty : str;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Public constructor
|
||||
///
|
||||
public ItemSpec(string name, string clmnHeaderText, PrintDlgt printDlgt, PrintCompoundDlgt printCombinedDlgt, PrintHeatMeterDlgt printHeatMeterDlgt)
|
||||
{
|
||||
Name = name;
|
||||
ClmnHeaderText = clmnHeaderText;
|
||||
this.printDlgt = printDlgt;
|
||||
this.printCompoundDlgt = printCombinedDlgt;
|
||||
this.printHeatMeterDlgt = printHeatMeterDlgt;
|
||||
}
|
||||
|
||||
|
||||
/// Static list of all available items
|
||||
public static readonly IList<ItemSpec> AllItems;
|
||||
|
||||
/// Static constructor that initializes the list of all items
|
||||
static ItemSpec()
|
||||
{
|
||||
AllItems = new List<ItemSpec>();
|
||||
|
||||
/// Common
|
||||
|
||||
//AllItems.Add(new ResultItemSpec("Bench ID", "Bench ID", x => x.BenchID, (x, y, z) => x.BenchID));
|
||||
AllItems.Add(new ItemSpec("Test name", Strings.Test, x => x.Name(), (x, y, z) => z.Name(), (x, z) => z.Name()));
|
||||
AllItems.Add(new ItemSpec("Procedure name", Strings.Procedure, x => x.ProcedureName(), (x, y, z) => z.ProcedureName(), (x, z) => z.ProcedureName()));
|
||||
AllItems.Add(new ItemSpec("Batch number", Strings.Batch_nr, x => x.BatchNr().ToString(), (x, y, z) => z.BatchNr().ToString(), (x, z) => z.BatchNr().ToString()));
|
||||
AllItems.Add(new ItemSpec("Test method", Strings.Test_method, x => x.Method(), (x, y, z) => z.Method(), (x, z) => z.Method()));
|
||||
AllItems.Add(new ItemSpec("Density", Strings.Density, x => x.DensityOut().ToString("F1"), (x, y, z) => z.DensityOut().ToString("F1"), (x, z) => z.DensityOut().ToString("F1"))); /// [kg/m3]
|
||||
|
||||
/// Target values
|
||||
AllItems.Add(new ItemSpec("Q from", Strings.Q_from + " [m3/h]", x => x.Qfrom().ToString("F3"), (x, y, z) => z.Qfrom().ToString("F3"), (x, z) => z.Qfrom().ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("Q to", Strings.Q_to + " [m3/h]", x => x.Qto().ToString("F3"), (x, y, z) => z.Qto().ToString("F3"), (x, z) => z.Qto().ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("Test volume", Strings.Test_vol + " [l]", x => x.TargetVolume().ToString("F1"), (x, y, z) => z.TargetVolume().ToString("F1"), (x, z) => z.TargetVolume().ToString("F1")));
|
||||
AllItems.Add(new ItemSpec("Error limit Lo", Strings.ErrLimLo + " [%]", x => x.ErrLimLo().ToString("F1"), (x, y, z) => z.ErrLimLo().ToString("F1"), (x, z) => z.ErrLimLo().ToString("F1")));
|
||||
AllItems.Add(new ItemSpec("Error limit Hi", Strings.ErrLimHi + " [%]", x => x.ErrLimHi().ToString("F1"), (x, y, z) => z.ErrLimHi().ToString("F1"), (x, z) => z.ErrLimHi().ToString("F1")));
|
||||
AllItems.Add(new ItemSpec("Uncertainty", Strings.Uncertainty + " [%]", x => x.Uncertainty().ToString("F2"), (x, y, z) => z.Uncertainty().ToString("F2"), (x, z) => z.Uncertainty().ToString("F2")));
|
||||
|
||||
/// Test results
|
||||
AllItems.Add(new ItemSpec("Test start time", Strings.T_start, x => x.StartTime().ToShortTimeString(), (x, y, z) => z.StartTime().ToShortTimeString(), (x, z) => z.StartTime().ToShortTimeString()));
|
||||
AllItems.Add(new ItemSpec("Test end time", Strings.T_end, x => x.EndTime().ToShortTimeString(), (x, y, z) => z.EndTime().ToShortTimeString(), (x, z) => z.EndTime().ToShortTimeString()));
|
||||
AllItems.Add(new ItemSpec("Test time", Strings.T_s, x => x.TestTime.ToString("F2"), (x, y, z) => z.TestTime.ToString("F2"), (x, z) => z.TestTime.ToString("F2")));
|
||||
AllItems.Add(new ItemSpec("Flow", Strings.Flow + " [m3/h]", x => Utils.DoubleToStr(x.FlowVolume(), 4), (x, y, z) => Utils.DoubleToStr(z.FlowVolume(), 4), (x, z) => Utils.DoubleToStr(x.FlowVolume(), 4)));
|
||||
AllItems.Add(new ItemSpec("T in", Strings.T_in + " [°C]", x => x.TestRslt.TempUpMean.ToString("F2"), (x, y, z) => z.TestRslt.TempUpMean.ToString("F2"), (x, z) => z.TestRslt.TempUpMean.ToString("F2")));
|
||||
AllItems.Add(new ItemSpec("T out", Strings.T_out + " [°C]", x => x.TestRslt.TempDownMean.ToString("F2"), (x, y, z) => z.TestRslt.TempDownMean.ToString("F2"), (x, z) => z.TestRslt.TempDownMean.ToString("F2")));
|
||||
AllItems.Add(new ItemSpec("T div", Strings.T_div + " [°C]", x => x.TestRslt.TempDivMean.ToString("F2"), (x, y, z) => z.TestRslt.TempDivMean.ToString("F2"), (x, z) => z.TestRslt.TempDivMean.ToString("F2")));
|
||||
AllItems.Add(new ItemSpec("P up", Strings.P_up + " [kPa]", x => (100 * x.TestRslt.PressUpMean).ToString("F3"), (x, y, z) => z.TestRslt.PressUpMean.ToString("F3"), (x, z) => z.TestRslt.PressUpMean.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("P up start", Strings.P_up_start + " [kPa]", x => (100 * x.TestRslt.PressUpStart).ToString("F3"), (x, y, z) => z.TestRslt.PressUpStart.ToString("F3"), (x, z) => z.TestRslt.PressUpStart.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("P up end", Strings.P_up_end + " [kPa]", x => (100 * x.TestRslt.PressUpEnd).ToString("F3"), (x, y, z) => z.TestRslt.PressUpEnd.ToString("F3"), (x, z) => z.TestRslt.PressUpEnd.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("P down", Strings.P_dn + " [kPa]", x => (100 * x.TestRslt.PressDownMean).ToString("F3"), (x, y, z) => z.TestRslt.PressDownMean.ToString("F3"), (x, z) => z.TestRslt.PressDownMean.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("P down start", Strings.P_dn_start + " [kPa]", x => (100 * x.TestRslt.PressDownStart).ToString("F3"), (x, y, z) => z.TestRslt.PressDownStart.ToString("F3"), (x, z) => z.TestRslt.PressDownStart.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("P down end", Strings.P_dn_end + " [kPa]", x => (100 * x.TestRslt.PressDownEnd).ToString("F3"), (x, y, z) => z.TestRslt.PressDownEnd.ToString("F3"), (x, z) => z.TestRslt.PressDownEnd.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("P delta", Strings.P_delta + " [kPa]", x => (100 * x.TestRslt.PressDeltaMean).ToString("F3"), (x, y, z) => z.TestRslt.PressDeltaMean.ToString("F3"), (x, z) => z.TestRslt.PressDeltaMean.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("P delta start", Strings.P_delta_start + " [kPa]", x => (100 * x.TestRslt.PressDeltaStart).ToString("F3"), (x, y, z) => z.TestRslt.PressDeltaStart.ToString("F3"), (x, z) => z.TestRslt.PressDeltaStart.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("P delta end", Strings.P_delta_end + " [kPa]", x => (100 * x.TestRslt.PressDeltaEnd).ToString("F3"), (x, y, z) => z.TestRslt.PressDeltaEnd.ToString("F3"), (x, z) => z.TestRslt.PressDeltaEnd.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("Reference error", Strings.ErrRef + " [%]", x => x.TestRslt.ErrorMaster.ToString("F3"), (x, y, z) => z.TestRslt.ErrorMaster.ToString("F3"), (x, z) => z.TestRslt.ErrorMaster.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("Ambient temperature", Strings.T_amb + " [°C]", x => x.TestRslt.AmbTempMean.ToString("F1"), (x, y, z) => z.TestRslt.AmbTempMean.ToString("F1"), (x, z) => z.TestRslt.AmbTempMean.ToString("F1")));
|
||||
AllItems.Add(new ItemSpec("Ambient pressure", Strings.P_amb + " [mbar]", x => (1000 * x.TestRslt.AmbPressMean).ToString("F0"), (x, y, z) => (1000 * z.TestRslt.AmbPressMean).ToString("F0"), (x, z) => (1000 * z.TestRslt.AmbPressMean).ToString("F0")));
|
||||
AllItems.Add(new ItemSpec("Ambient humidity", Strings.H_amb + " [%]", x => x.TestRslt.AmbHumiMean.ToString("F1"), (x, y, z) => z.TestRslt.AmbHumiMean.ToString("F1"), (x, z) => z.TestRslt.AmbHumiMean.ToString("F1")));
|
||||
|
||||
/// Single and combined meter results
|
||||
AllItems.Add(new ItemSpec("Start volume", Strings.Start_volume + " [l]", x => x.VolumeStart.ToString("F3"), (x, y, z) => z.VolumeStart.ToString("F3"), (x, z) => z.VolumeStart.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("End volume", Strings.End_volume + " [l]", x => x.VolumeEnd.ToString("F3"), (x, y, z) => z.VolumeEnd.ToString("F3"), (x, z) => z.VolumeEnd.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("Volume", Strings.Volume + " [l]", x => x.VolumeMeter.ToString("F3"), (x, y, z) => z.VolumeMeter.ToString("F3"), (x, z) => x.VolumeMeter.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("Reference volume", Strings.VolRef + " [l]", x => x.VolumeRef.ToString("F3"), (x, y, z) => z.VolumeRef.ToString("F3"), (x, z) => x.VolumeRef.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("Error", Strings.Error + " [%]", x => x.Error.ToString("F2"), (x, y, z) => z.Error.ToString("F2"), null));
|
||||
AllItems.Add(new ItemSpec("Passed", Strings.Result, x => x.PassedColorStr(), (x, y, z) => z.PassedColorStr(), null));
|
||||
AllItems.Add(new ItemSpec("Volume Error", "Volume Error" + " [%]", null, null, (x, z) => x.Error.ToString("F2")));
|
||||
AllItems.Add(new ItemSpec("Volume Passed", "Volume Passed", null, null, (x, z) => x.PassedColorStr()));
|
||||
AllItems.Add(new ItemSpec("Energy Error", "Energy Error" + " [%]", null, null, (x, z) => z.Error.ToString("F2")));
|
||||
AllItems.Add(new ItemSpec("Energy Passed", "Energy Passed", null, null, (x, z) => z.PassedColorStr()));
|
||||
|
||||
/// Water meter info
|
||||
AllItems.Add(new ItemSpec("Watermeter type", Strings.WM_Type, x => x.WaterMeterData().ProductName, (x, y, z) => z.WaterMeterData().ProductName, (x, z) => z.WaterMeterData().ProductName));
|
||||
AllItems.Add(new ItemSpec("Producer", Strings.Producer, x => x.WaterMeterData().Producer, (x, y, z) => z.WaterMeterData().Producer, (x, z) => z.WaterMeterData().Producer));
|
||||
AllItems.Add(new ItemSpec("Metrological class", Strings.MClass, x => x.WaterMeterData().MetrologicalClass, (x, y, z) => z.WaterMeterData().MetrologicalClass, (x, z) => z.WaterMeterData().MetrologicalClass));
|
||||
AllItems.Add(new ItemSpec("Approval info", Strings.Approval, x => x.WaterMeterData().ApprovalInfo, (x, y, z) => z.WaterMeterData().ApprovalInfo, (x, z) => z.WaterMeterData().ApprovalInfo));
|
||||
AllItems.Add(new ItemSpec("Q4", "Q4 [m3/h]", x => x.WaterMeterData().Q4_Qmax.ToString(), (x, y, z) => z.WaterMeterData().Q4_Qmax.ToString(), null));
|
||||
AllItems.Add(new ItemSpec("Q3", "Q3 [m3/h]", x => x.WaterMeterData().Q3_Qn.ToString(), (x, y, z) => z.WaterMeterData().Q3_Qn.ToString(), null));
|
||||
AllItems.Add(new ItemSpec("Q2", "Q2 [m3/h]", x => x.WaterMeterData().Q2_Qt.ToString(), (x, y, z) => z.WaterMeterData().Q2_Qt.ToString(), null));
|
||||
AllItems.Add(new ItemSpec("Q1", "Q1 [m3/h]", x => x.WaterMeterData().Q1_Qmin.ToString(), (x, y, z) => z.WaterMeterData().Q1_Qmin.ToString(), null));
|
||||
AllItems.Add(new ItemSpec("Qmax", "Qmax [m3/h]", x => x.WaterMeterData().Q4_Qmax.ToString(), (x, y, z) => z.WaterMeterData().Q4_Qmax.ToString(), null));
|
||||
AllItems.Add(new ItemSpec("Qn", "Qn [m3/h]", x => x.WaterMeterData().Q3_Qn.ToString(), (x, y, z) => z.WaterMeterData().Q3_Qn.ToString(), null));
|
||||
AllItems.Add(new ItemSpec("Qt", "Qt [m3/h]", x => x.WaterMeterData().Q2_Qt.ToString(), (x, y, z) => z.WaterMeterData().Q2_Qt.ToString(), null));
|
||||
AllItems.Add(new ItemSpec("Qmin", "Qmin [m3/h]", x => x.WaterMeterData().Q1_Qmin.ToString(), (x, y, z) => z.WaterMeterData().Q1_Qmin.ToString(), null));
|
||||
|
||||
/// Water meters results
|
||||
AllItems.Add(new ItemSpec("Serial Nr", Strings.sn, x => x.WaterMeter.SerialNr, (x, y, z) => z.WaterMeter.SerialNr, (x, z) => z.WaterMeter.SerialNr));
|
||||
AllItems.Add(new ItemSpec("Purchase order", Strings.PO, x => x.WaterMeter.PurchaseOrder, (x, y, z) => z.WaterMeter.PurchaseOrder, (x, z) => z.WaterMeter.PurchaseOrder));
|
||||
AllItems.Add(new ItemSpec("Year of production", Strings.Year, x => x.WaterMeter.YearOfProduction.ToString(), (x, y, z) => z.WaterMeter.YearOfProduction.ToString(), (x, z) => z.WaterMeter.YearOfProduction.ToString()));
|
||||
AllItems.Add(new ItemSpec("WM Position", Strings.Pos, x => x.WaterMeter.WMPosition.ToString(), (x, y, z) => z.WaterMeter.WMPosition.ToString(), (x, z) => z.WaterMeter.WMPosition.ToString()));
|
||||
|
||||
/// Water meters results (single)
|
||||
AllItems.Add(new ItemSpec("End state", Strings.End_state, x => x.EndState(), null, null));
|
||||
AllItems.Add(new ItemSpec("Pulses", Strings.Pulses, x => x.PulsesMeter.ToString(), null, null));
|
||||
AllItems.Add(new ItemSpec("Pulses/liter", Strings.PulsesLiter, x => x.PulsesPerLiter.ToString(), null, null));
|
||||
AllItems.Add(new ItemSpec("Reference pulses", Strings.RefPulses, x => x.PulsesMaster.ToString(), null, null));
|
||||
|
||||
/// Water meters results (combined)
|
||||
AllItems.Add(new ItemSpec("Q rise", Strings.Q_rise + " [m3/h]", null, (x, y, z) => (z.QRise() == 0) ? "-" : Utils.DoubleToStr(z.QRise(), 4), null));
|
||||
AllItems.Add(new ItemSpec("Q fall", Strings.Q_fall + " [m3/h]", null, (x, y, z) => (z.QFall() == 0) ? "-" : Utils.DoubleToStr(z.QFall(), 4), null));
|
||||
AllItems.Add(new ItemSpec("Error large WM", Strings.Err_main + " [%]", null, (x, y, z) => x.Error.ToString("F2"), null));
|
||||
AllItems.Add(new ItemSpec("Error small WM", Strings.Err_aux + " [%]", null, (x, y, z) => y.Error.ToString("F2"), null));
|
||||
AllItems.Add(new ItemSpec("Serial Nr large WM", Strings.sn_main, null, (x, y, z) => x.SerialNr(), null));
|
||||
AllItems.Add(new ItemSpec("Serial Nr small WM", Strings.sn_aux, null, (x, y, z) => y.SerialNr(), null));
|
||||
AllItems.Add(new ItemSpec("End state large WM", Strings.EndState_main, null, (x, y, z) => x.EndState(), null));
|
||||
AllItems.Add(new ItemSpec("End state small WM", Strings.EndState_aux, null, (x, y, z) => y.EndState(), null));
|
||||
AllItems.Add(new ItemSpec("Start volume main", Strings.Start_volume_main + " [l]",x => x.VolumeMeter.ToString("F3"), (x, y, z) => x.VolumeStart.ToString("F3"), null));
|
||||
AllItems.Add(new ItemSpec("End volume main", Strings.End_volume_main + " [l]", x => x.VolumeMeter.ToString("F3"), (x, y, z) => x.VolumeEnd.ToString("F3"), null));
|
||||
AllItems.Add(new ItemSpec("Volume main", Strings.Volume_main + " [l]", x => x.VolumeMeter.ToString("F3"), (x, y, z) => x.VolumeMeter.ToString("F3"), null));
|
||||
AllItems.Add(new ItemSpec("Start volume aux", Strings.Start_volume_aux + " [l]", x => x.VolumeMeter.ToString("F3"), (x, y, z) => y.VolumeStart.ToString("F3"), null));
|
||||
AllItems.Add(new ItemSpec("End volume aux", Strings.End_volume_aux + " [l]", x => x.VolumeMeter.ToString("F3"), (x, y, z) => y.VolumeEnd.ToString("F3"), null));
|
||||
AllItems.Add(new ItemSpec("Volume aux", Strings.Volume_aux + " [l]", x => x.VolumeMeter.ToString("F3"), (x, y, z) => y.VolumeMeter.ToString("F3"), null));
|
||||
|
||||
/// Batch info
|
||||
AllItems.Add(new ItemSpec("Batch number", Strings.Batch_nr, x => x.Batch().BatchNr.ToString(), (x, y, z) => x.Batch().BatchNr.ToString(), (x, z) => x.Batch().BatchNr.ToString()));
|
||||
AllItems.Add(new ItemSpec("Test bench ID", Strings.Bench, x => x.Batch().TestBenchId.ToString(), (x, y, z) => x.Batch().TestBenchId.ToString(), (x, z) => x.Batch().TestBenchId.ToString()));
|
||||
AllItems.Add(new ItemSpec("Program version", Strings.Ver, x => x.Batch().ProgramVersion, (x, y, z) => x.Batch().ProgramVersion, (x, z) => x.Batch().ProgramVersion));
|
||||
AllItems.Add(new ItemSpec("User name", Strings.User, x => x.Batch().UserName, (x, y, z) => x.Batch().UserName, (x, z) => x.Batch().UserName));
|
||||
AllItems.Add(new ItemSpec("User nr.", Strings.User_nr, x => x.Batch().UserNumber.ToString(), (x, y, z) => x.Batch().UserNumber.ToString(), (x, z) => x.Batch().UserNumber.ToString()));
|
||||
AllItems.Add(new ItemSpec("Procedure name", Strings.Procedure, x => x.Batch().ProcedureName, (x, y, z) => x.Batch().ProcedureName, (x, z) => x.Batch().ProcedureName));
|
||||
AllItems.Add(new ItemSpec("Watermeters", Strings.WMs, x => x.Batch().WatermetersStr, (x, y, z) => x.Batch().WatermetersStr, (x, z) => x.Batch().WatermetersStr));
|
||||
AllItems.Add(new ItemSpec("Protocol title", Strings.Protocol, x => x.Batch().ProtocolTitle, (x, y, z) => x.Batch().ProtocolTitle, (x, z) => x.Batch().ProtocolTitle));
|
||||
AllItems.Add(new ItemSpec("Batch start time", Strings.Start, x => x.Batch().StartTime.ToShortTimeString(), (x, y, z) => x.Batch().StartTime.ToShortTimeString(), (x, z) => x.Batch().StartTime.ToShortTimeString()));
|
||||
AllItems.Add(new ItemSpec("Batch end time", Strings.End, x => x.Batch().EndTime.ToShortTimeString(), (x, y, z) => x.Batch().EndTime.ToShortTimeString(), (x, z) => x.Batch().EndTime.ToShortTimeString()));
|
||||
|
||||
/// Heat meters results
|
||||
AllItems.Add(new ItemSpec("Energy", Strings.Energy, null, null, (x, z) => z.VolumeMeter.ToString()));
|
||||
AllItems.Add(new ItemSpec("Reference energy", Strings.Energy_ref, null, null, (x, z) => z.VolumeRef.ToString()));
|
||||
AllItems.Add(new ItemSpec("Temp hi me", "T hi me", null, null, (x, z) => z.TestRslt.Custom1.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("Temp hi st", "T hi st", null, null, (x, z) => z.TestRslt.Custom2.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("Temp hi en", "T hi en", null, null, (x, z) => z.TestRslt.Custom3.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("Temp hi av", "T hi av", null, null, (x, z) => ((z.TestRslt.Custom2 + z.TestRslt.Custom3) / 2).ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("Temp lo me", "T lo me", null, null, (x, z) => z.TestRslt.Custom6.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("Temp lo st", "T lo st", null, null, (x, z) => z.TestRslt.Custom7.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("Temp lo en", "T lo en", null, null, (x, z) => z.TestRslt.Custom8.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("Temp lo av", "T lo av", null, null, (x, z) => ((z.TestRslt.Custom7 + z.TestRslt.Custom8) / 2).ToString("F3")));
|
||||
|
||||
AllItems.Add(new ItemSpec("Start mass", Strings.Start_mass + " [kg]", x => x.TestRslt.MassStart.ToString("F4"), (x, y, z) => z.TestRslt.MassStart.ToString("F4"), (x, z) => z.TestRslt.MassStart.ToString("F4")));
|
||||
AllItems.Add(new ItemSpec("End mass", Strings.End_mass + " [kg]", x => x.TestRslt.MassEnd.ToString("F4"), (x, y, z) => z.TestRslt.MassEnd.ToString("F4"), (x, z) => z.TestRslt.MassEnd.ToString("F4")));
|
||||
}
|
||||
|
||||
public static ItemSpec GetItem(string name)
|
||||
{
|
||||
foreach (var item in AllItems) if (item.Name.Equals(name)) return item;
|
||||
return null;
|
||||
}
|
||||
|
||||
public static string[] ToStrArray(IList<ItemSpec> items)
|
||||
{
|
||||
int count = (items != null) ? items.Count : 0;
|
||||
string[] result = new string[count];
|
||||
for (int i = 0; i < count; i++) result[i] = items[i].Name;
|
||||
return result;
|
||||
}
|
||||
|
||||
public static IList<ItemSpec> FromStrArray(string[] strArray)
|
||||
{
|
||||
IList<ItemSpec> result = new List<ItemSpec>();
|
||||
if (strArray != null)
|
||||
{
|
||||
for (int i = 0; i < strArray.Length; i++)
|
||||
{
|
||||
ItemSpec item = GetItem(strArray[i]);
|
||||
if (item != null) result.Add(item);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,7 @@ namespace Results.Mappings
|
||||
Map(x => x.MassEndRaw);
|
||||
Map(x => x.MassEnd);
|
||||
Map(x => x.DensityIn);
|
||||
Map(x => x.DensityLine).Column("DensityOut");
|
||||
Map(x => x.DensityOut);
|
||||
Map(x => x.DensityDiv);
|
||||
Map(x => x.Buoyancy);
|
||||
Map(x => x.FlowMass);
|
||||
|
||||
@@ -0,0 +1,446 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Printing;
|
||||
using System.IO;
|
||||
using Config.Entities;
|
||||
using Results.Resources;
|
||||
|
||||
namespace Results.Output.Printers.Cevak
|
||||
{
|
||||
enum DocumentSection
|
||||
{
|
||||
FirstPage,
|
||||
OtherPages,
|
||||
Appendix1,
|
||||
Appendix2,
|
||||
Count,
|
||||
}
|
||||
|
||||
public class PrintDocumentCevak : PrintDocument
|
||||
{
|
||||
const string FontFamilyName = "Arial"; //"Times New Roman";
|
||||
|
||||
const int SpacingOne = 18;
|
||||
const int SpacingOneAndHalf = (3 * SpacingOne) / 2;
|
||||
|
||||
readonly int topMargin;
|
||||
readonly int bottomMargin;
|
||||
readonly int leftMargin;
|
||||
readonly int TitleX;
|
||||
readonly int TitleY; /// Depends on the size of the header
|
||||
readonly int HdrTop; /// = TitleY + 60
|
||||
readonly int BodyTop; /// = HdrTop + 160
|
||||
|
||||
/// Size of the printed area without margins, after taking into account 'pageOrientation'
|
||||
int printHeight;
|
||||
int printWidth;
|
||||
|
||||
/// <summary>
|
||||
/// Property variable for the Font the user wishes to use
|
||||
/// </summary>
|
||||
Font font;
|
||||
Font boldFont;
|
||||
Font titleFont;
|
||||
|
||||
///
|
||||
/// Data to print
|
||||
///
|
||||
Results.Entities.Batch batch;
|
||||
|
||||
string testBenchName;
|
||||
string address1;
|
||||
|
||||
|
||||
///
|
||||
/// Items to print
|
||||
///
|
||||
readonly IList<Results.ItemSpec> rsltItems;
|
||||
|
||||
///
|
||||
/// Layout and status
|
||||
///
|
||||
DocumentSection documentSection;
|
||||
|
||||
int nrWMsOnFirstPage;
|
||||
int nrWMsOnNextPage;
|
||||
int nextWMNr; /// nr. of watermeter to be printed as the first one on the next page
|
||||
int nrPages;
|
||||
int pageNr; /// Page number to be printed at the bottom of the page
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="textToPrint">Text to be printed</param>
|
||||
public PrintDocumentCevak(Results.Entities.Batch batch,
|
||||
PageOrientation pageOrientation,
|
||||
int topMargin, int bottomMargin, int leftMargin,
|
||||
string testBenchName, string address1)
|
||||
{
|
||||
this.batch = batch;
|
||||
|
||||
DefaultPageSettings.Landscape = (pageOrientation == PageOrientation.Landscape);
|
||||
|
||||
this.topMargin = topMargin;
|
||||
this.bottomMargin = bottomMargin;
|
||||
this.leftMargin = leftMargin;
|
||||
|
||||
this.testBenchName = testBenchName;
|
||||
this.address1 = address1;
|
||||
|
||||
TitleX = leftMargin;
|
||||
TitleY = topMargin; /// Depends on the size of the header
|
||||
HdrTop = TitleY + 60;
|
||||
BodyTop = HdrTop + 250;
|
||||
|
||||
rsltItems = Results.ItemSpec.FromStrArray(new string[] {
|
||||
"Test name",
|
||||
"Volume",
|
||||
"Reference volume",
|
||||
"Test time",
|
||||
"Flow",
|
||||
"Error",
|
||||
"Passed",
|
||||
//"Reference error", // ?
|
||||
});
|
||||
|
||||
/// Set print area size and margins (in dots using 100 dpi)
|
||||
if (DefaultPageSettings.Landscape)
|
||||
{
|
||||
printHeight = base.DefaultPageSettings.PaperSize.Width - topMargin - bottomMargin;
|
||||
printWidth = base.DefaultPageSettings.PaperSize.Height - leftMargin - leftMargin;
|
||||
}
|
||||
else
|
||||
{
|
||||
printHeight = base.DefaultPageSettings.PaperSize.Height - topMargin - bottomMargin;
|
||||
printWidth = base.DefaultPageSettings.PaperSize.Width - leftMargin - leftMargin;
|
||||
}
|
||||
|
||||
|
||||
int testsCount = 0;
|
||||
foreach (var mtr in batch.WaterMeters[0].MeterTestRslts)
|
||||
{
|
||||
if (mtr.Publish() == Config.Entities.Publish.Always) testsCount++;
|
||||
}
|
||||
|
||||
if (batch.WaterMeters[0].Compound()) testsCount /= 3;
|
||||
|
||||
int wmSectionHeight = (testsCount + 4) * SpacingOne;
|
||||
|
||||
nrWMsOnFirstPage = (printHeight - BodyTop + TitleY - 2 * SpacingOne) / wmSectionHeight;
|
||||
nrWMsOnNextPage = (printHeight - 2 * SpacingOne) / wmSectionHeight;
|
||||
nrWMsOnNextPage = Math.Max(nrWMsOnNextPage, 1); /// Prevent division by zero if there are too many WM tests
|
||||
|
||||
nrPages = 1 + (batch.WaterMeters.Count - nrWMsOnFirstPage + nrWMsOnNextPage - 1) / nrWMsOnNextPage;
|
||||
|
||||
pageNr = 1;
|
||||
nextWMNr = 0;
|
||||
documentSection = DocumentSection.FirstPage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override the default onbeginPrint method of the PrintDocument Object
|
||||
/// </summary>
|
||||
/// <param name=e></param>
|
||||
/// <remarks></remarks>
|
||||
protected override void OnBeginPrint(System.Drawing.Printing.PrintEventArgs e)
|
||||
{
|
||||
base.OnBeginPrint(e);
|
||||
|
||||
if (font == null) { font = new Font(FontFamilyName, 10, FontStyle.Regular); }
|
||||
if (boldFont == null) { boldFont = new Font(FontFamilyName, 10, FontStyle.Bold); }
|
||||
if (titleFont == null) { titleFont = new Font(FontFamilyName, 18, FontStyle.Bold); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override the default OnPrintPage method of the PrintDocument.
|
||||
/// </summary>
|
||||
/// <param name=e></param>
|
||||
/// <remarks>This provides the print logic for our document</remarks>
|
||||
protected override void OnPrintPage(System.Drawing.Printing.PrintPageEventArgs e)
|
||||
{
|
||||
/// Run base code
|
||||
base.OnPrintPage(e);
|
||||
|
||||
/// Use the StringFormat class for the text layout of our document
|
||||
StringFormat format = new StringFormat(StringFormatFlags.LineLimit);
|
||||
|
||||
|
||||
if (documentSection != DocumentSection.OtherPages)
|
||||
{
|
||||
///----------
|
||||
/// Header
|
||||
///----------
|
||||
if (documentSection == DocumentSection.FirstPage)
|
||||
{
|
||||
RectangleF printArea = new RectangleF(TitleX, TitleY, printWidth, 40);
|
||||
e.Graphics.DrawString(batch.ProtocolTitle, titleFont, Brushes.Black, printArea);
|
||||
}
|
||||
else
|
||||
{
|
||||
PrintAt(e, TitleX, TitleY, batch.ProtocolTitle);
|
||||
}
|
||||
|
||||
string[] leftColumn = new string[]
|
||||
{
|
||||
"Protokol č.: ",
|
||||
"Zákazník: ",
|
||||
"Datum a čas: ",
|
||||
"Procedura: ",
|
||||
"Popis procedury: ",
|
||||
"Typ vodoměru: ",
|
||||
"Zkoušející: ",
|
||||
"Název zkušební stanice: ",
|
||||
"Zkušební SW, č. verze: ",
|
||||
"Metodika: ", /// BenchAdresa 1
|
||||
//"Okolní teplota: ", // Disabled, see email dated 25.11.2016
|
||||
//"Okolní tlak: ",
|
||||
//"Relativní vlhkost: ",
|
||||
};
|
||||
|
||||
string[] rightColumn = new string[]
|
||||
{
|
||||
batch.BatchNr.ToString(),
|
||||
batch.WaterMeters[0].PurchaseOrder,
|
||||
//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")),
|
||||
string.IsNullOrEmpty(batch.ProcedureName) ? "" : batch.ProcedureName,
|
||||
string.IsNullOrEmpty(batch.ProcedureDescription) ? "" : batch.ProcedureDescription,
|
||||
string.IsNullOrEmpty(batch.WatermetersStr) ? "" : batch.WatermetersStr,
|
||||
string.IsNullOrEmpty(batch.UserName) ? "" : batch.UserName,
|
||||
string.IsNullOrEmpty(testBenchName) ? "" : testBenchName,
|
||||
string.Format("Test Bench Framework ver.{0}", batch.ProgramVersion),
|
||||
string.IsNullOrEmpty(address1) ? "" : address1,
|
||||
//batch.AmbientTempAve().ToString("F1") + " °C", // Disabled, see email dated 25.11.2016
|
||||
//Config.Units.ConvertTo(Config.Unit.mbar, 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++)
|
||||
{
|
||||
PrintAt(e, leftMargin, HdrTop + SpacingOne * i, leftColumn[i]);
|
||||
PrintAt(e, 300, HdrTop + SpacingOne * i, rightColumn[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (documentSection == DocumentSection.FirstPage || documentSection == DocumentSection.OtherPages)
|
||||
{
|
||||
///--------
|
||||
/// Body
|
||||
///--------
|
||||
|
||||
/// This variable represents the top coordinate of the area where WM results are printed
|
||||
/// and it is updated (increased by) the value returned by PrintWM() - the section size.
|
||||
int nextWmTop = (pageNr == 1) ? BodyTop : TitleY;
|
||||
|
||||
int nrWMsOnPage = (pageNr == 1) ? nrWMsOnFirstPage : nrWMsOnNextPage;
|
||||
|
||||
for (int wmNr = nextWMNr; wmNr < Math.Min(nextWMNr + nrWMsOnPage, batch.WaterMeters.Count); wmNr++) /// wmNr is 0-based
|
||||
{
|
||||
int wmPosition = true ? batch.WaterMeters[wmNr].WMPosition : (wmNr + 1);
|
||||
nextWmTop += PrintWM(e, batch.WaterMeters[wmNr], wmPosition, nextWmTop);
|
||||
}
|
||||
|
||||
nextWMNr += nrWMsOnPage;
|
||||
e.HasMorePages = true;
|
||||
if (nextWMNr < batch.WaterMeters.Count)
|
||||
{
|
||||
documentSection = DocumentSection.OtherPages;
|
||||
}
|
||||
else
|
||||
{
|
||||
documentSection = DocumentSection.Appendix1;
|
||||
}
|
||||
|
||||
///----------
|
||||
/// Footer
|
||||
///----------
|
||||
string footerText = string.Format("{0} {1}/{2}", Strings.Page, pageNr++, nrPages);
|
||||
int footerWidth = (int)e.Graphics.MeasureString(footerText, font).Width;
|
||||
PrintAt(e, leftMargin + (printWidth - footerWidth) / 2, topMargin + printHeight - SpacingOne, footerText);
|
||||
}
|
||||
else
|
||||
{
|
||||
///-------------------------------
|
||||
/// List of passed water meters
|
||||
///-------------------------------
|
||||
|
||||
int nextWmTop = BodyTop;
|
||||
|
||||
foreach (var wm in batch.WaterMeters)
|
||||
{
|
||||
if (wm.Passed)
|
||||
{
|
||||
PrintAt(e, leftMargin, nextWmTop, string.Format("Vodoměr {0}: s/n {1}", wm.WMPosition, wm.SerialNr));
|
||||
nextWmTop += SpacingOne;
|
||||
}
|
||||
}
|
||||
|
||||
if (documentSection == DocumentSection.Appendix1)
|
||||
{
|
||||
documentSection = DocumentSection.Appendix2;
|
||||
e.HasMorePages = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.HasMorePages = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Print one water meter results
|
||||
/// </summary>
|
||||
/// <param name="wm">Water meter</param>
|
||||
/// <param name="printedWMNr">Number of the water meter printed</param>
|
||||
/// <param name="top">Top coordinate of watermeter data</param>
|
||||
/// <returns>The height of the printed section</returns>
|
||||
int PrintWM(System.Drawing.Printing.PrintPageEventArgs e,
|
||||
Results.Entities.WaterMeter wm, int printedWMNr, int top)
|
||||
{
|
||||
/// Determin column widths
|
||||
float[] columnPos = new float[rsltItems.Count + 1];
|
||||
columnPos[0] = (float)leftMargin;
|
||||
|
||||
for (int i = 0; i < rsltItems.Count; i++)
|
||||
{
|
||||
float columnWidth = e.Graphics.MeasureString(rsltItems[i].ClmnHeaderText, font).Width;
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
{
|
||||
string itemText;
|
||||
|
||||
if (!wm.Compound())
|
||||
{
|
||||
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]; }
|
||||
|
||||
float width = e.Graphics.MeasureString(itemText, font).Width;
|
||||
if (width > columnWidth) columnWidth = width;
|
||||
}
|
||||
columnPos[i + 1] = columnPos[i] + columnWidth + 20.0f;
|
||||
}
|
||||
int tableLeftX = (int)columnPos[0];
|
||||
int tableRightX = (int)columnPos[rsltItems.Count] - 20;
|
||||
|
||||
string wmText = string.Format("Vodoměr {0}", printedWMNr);
|
||||
PrintAt(e, leftMargin, top, wmText);
|
||||
if (!string.IsNullOrEmpty(wm.SerialNr))
|
||||
{
|
||||
PrintAt(e, leftMargin + (int)e.Graphics.MeasureString(wmText, font).Width, top,
|
||||
string.Format(" s/n = {0}", wm.SerialNr));
|
||||
}
|
||||
|
||||
/// Horizontal line
|
||||
int horY = top + 25;
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(tableLeftX, horY), new Point(tableRightX, horY));
|
||||
|
||||
for (int i = 0; i < rsltItems.Count; i++)
|
||||
{
|
||||
PrintAt(e, (int)columnPos[i], top + 27, rsltItems[i].ClmnHeaderText);
|
||||
}
|
||||
|
||||
/// Horizontal line
|
||||
horY = top + 27 + SpacingOne;
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(tableLeftX, horY), new Point(tableRightX, horY));
|
||||
|
||||
int testsCount = 0;
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
{
|
||||
if (mtr.Publish() == Config.Entities.Publish.Always)
|
||||
{
|
||||
testsCount++;
|
||||
for (int i = 0; i < rsltItems.Count; i++)
|
||||
{
|
||||
string itemText;
|
||||
|
||||
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.CompoundMain);
|
||||
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];
|
||||
Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
|
||||
/// TODO: How to print colors?
|
||||
}
|
||||
|
||||
PrintAt(e, (int)columnPos[i], top + 30 + SpacingOne * testsCount, itemText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Horizontal line
|
||||
horY = top + 30 + SpacingOne * (testsCount + 1);
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(tableLeftX, horY), new Point(tableRightX, horY));
|
||||
|
||||
return (testsCount + 4) * SpacingOne;
|
||||
}
|
||||
|
||||
|
||||
void PrintAt(System.Drawing.Printing.PrintPageEventArgs e, Point p, string text)
|
||||
{
|
||||
PrintAt(e, p.X, p.Y, text);
|
||||
}
|
||||
|
||||
|
||||
void PrintAt(System.Drawing.Printing.PrintPageEventArgs e, int x, int y, string text)
|
||||
{
|
||||
RectangleF printArea = new RectangleF(x, y, 667, SpacingOne);
|
||||
e.Graphics.DrawString(text, this.font, Brushes.Black, printArea);
|
||||
}
|
||||
|
||||
|
||||
void PrintBoldAt(System.Drawing.Printing.PrintPageEventArgs e, Point p, string text)
|
||||
{
|
||||
PrintBoldAt(e, p.X, p.Y, text);
|
||||
}
|
||||
|
||||
|
||||
void PrintBoldAt(System.Drawing.Printing.PrintPageEventArgs e, int x, int y, string text)
|
||||
{
|
||||
RectangleF printArea = new RectangleF(x, y, 667, SpacingOne);
|
||||
e.Graphics.DrawString(text, this.boldFont, Brushes.Black, printArea);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,8 +44,6 @@ namespace Results.Output.Printers.Enhanced
|
||||
Font font;
|
||||
Font footerFont;
|
||||
|
||||
TableStyle style;
|
||||
|
||||
///
|
||||
/// Data to print
|
||||
///
|
||||
@@ -77,7 +75,7 @@ namespace Results.Output.Printers.Enhanced
|
||||
/// <param name="textToPrint">Text to be printed</param>
|
||||
public EnhancedPrintDocument(Results.Entities.Batch batch, EnhancedPrinterCfg cfg, string documentName)
|
||||
{
|
||||
this.batch = batch;
|
||||
this.batch = batch;
|
||||
this.cfg = cfg;
|
||||
DocumentName = documentName;
|
||||
|
||||
@@ -96,20 +94,7 @@ namespace Results.Output.Printers.Enhanced
|
||||
font = new Font((cfg.BodyFntFml != null ? cfg.BodyFntFml : "Arial"), (cfg.BodyFntSz > 0 ? cfg.BodyFntSz : 10), (FontStyle)cfg.BodyFntSty);
|
||||
footerFont = new Font((cfg.FooterFntFml != null ? cfg.FooterFntFml : "Arial"), (cfg.FooterFntSz > 0 ? cfg.FooterFntSz : 10), (FontStyle)cfg.FooterFntSty);
|
||||
|
||||
/// Table style of one water meter table where tests are rows
|
||||
style = new TableStyle
|
||||
{
|
||||
Font = font,
|
||||
HeaderFont = headerFont,
|
||||
MarginX = 5,
|
||||
MarginY = 3,
|
||||
LineWidth = 1,
|
||||
TopHeadersCount = 1,
|
||||
HorizLines = TableLines.FirstSecondAndLast,
|
||||
VertLines = TableLines.All
|
||||
};
|
||||
|
||||
/// Set print area size and margins (in dots using 100 dpi)
|
||||
/// Set print area size and margins (in dots using 100 dpi)
|
||||
DefaultPageSettings.Landscape = (cfg.PageOrientation == PageOrientation.Landscape);
|
||||
///
|
||||
if (DefaultPageSettings.Landscape)
|
||||
@@ -123,15 +108,39 @@ namespace Results.Output.Printers.Enhanced
|
||||
printWidth = base.DefaultPageSettings.PaperSize.Width - leftMargin - leftMargin;
|
||||
}
|
||||
|
||||
/// Document outline preliminary calculations
|
||||
SpacingOne = System.Windows.Forms.TextRenderer.MeasureText("Abcgq", font).Height;
|
||||
SpacingOneAndHalf = (3 * SpacingOne) / 2;
|
||||
SpacingOne4Header = System.Windows.Forms.TextRenderer.MeasureText("Abcgq", headerFont).Height;
|
||||
SpacingOneAndHalf4Header = (3 * SpacingOne4Header) / 2;
|
||||
SpacingOne = System.Windows.Forms.TextRenderer.MeasureText("Abcgq", font).Height;
|
||||
SpacingOneAndHalf = (3 * SpacingOne) / 2;
|
||||
SpacingOne4Header = System.Windows.Forms.TextRenderer.MeasureText("Abcgq", headerFont).Height;
|
||||
SpacingOneAndHalf4Header = (3 * SpacingOne4Header) / 2;
|
||||
SpacingOne4Footer = System.Windows.Forms.TextRenderer.MeasureText("Abcgq", footerFont).Height;
|
||||
|
||||
TitleX = cfg.LeftMargin;
|
||||
TitleY = cfg.TopMargin;
|
||||
/// Calculate the tests count
|
||||
int testsCount = 0;
|
||||
if (batch.WaterMeters.Count > 0)
|
||||
{
|
||||
foreach (var mtr in batch.WaterMeters[0].MeterTestRslts)
|
||||
{
|
||||
if (mtr.Publish() == Config.Entities.Publish.Always && mtr.IsPilotRslt()) testsCount++;
|
||||
}
|
||||
}
|
||||
|
||||
/// Prepare document outline
|
||||
TitleX = cfg.LeftMargin;
|
||||
TitleY = cfg.TopMargin;
|
||||
|
||||
titleHeight = System.Windows.Forms.TextRenderer.MeasureText(header, titleFont).Height;
|
||||
CommonTop = TitleY + titleHeight + SpacingOne4Header;
|
||||
|
||||
commonHeight = commonItems.Count * SpacingOne;
|
||||
BodyTop = CommonTop + commonHeight + SpacingOne4Header;
|
||||
|
||||
int wmSectionHeight = (testsCount + 1) * SpacingOne + 3 * SpacingOne4Header;
|
||||
|
||||
nrWMsOnFirstPage = (printHeight - BodyTop + TitleY - 2 * SpacingOne) / wmSectionHeight;
|
||||
nrWMsOnNextPage = (printHeight - 2 * SpacingOne) / wmSectionHeight;
|
||||
nrWMsOnNextPage = Math.Max(nrWMsOnNextPage, 1); /// Prevent division by zero if there are too many WM tests
|
||||
|
||||
nrPages = 1 + (batch.WaterMeters.Count - nrWMsOnFirstPage + nrWMsOnNextPage - 1) / nrWMsOnNextPage;
|
||||
|
||||
pageNr = 1;
|
||||
nextWMNr = 0;
|
||||
@@ -174,27 +183,7 @@ namespace Results.Output.Printers.Enhanced
|
||||
|
||||
if (pageNr == 1)
|
||||
{
|
||||
///----------
|
||||
/// Prepare document outline
|
||||
///----------
|
||||
titleHeight = System.Windows.Forms.TextRenderer.MeasureText(header, titleFont).Height;
|
||||
CommonTop = TitleY + titleHeight + SpacingOne4Header;
|
||||
|
||||
commonHeight = commonItems.Count * SpacingOne;
|
||||
BodyTop = CommonTop + commonHeight + SpacingOne4Header;
|
||||
|
||||
Table table0 = Table.Create_TestsAreRows(batch.WaterMeters[0], testItems, style);
|
||||
SizeF tableSize = table0.Measure(e);
|
||||
int wmSectionHeight = (int)tableSize.Height + 3 * SpacingOne4Header;
|
||||
|
||||
nrWMsOnFirstPage = (printHeight - BodyTop + TitleY - 2 * SpacingOne) / wmSectionHeight;
|
||||
nrWMsOnNextPage = (printHeight - 2 * SpacingOne) / wmSectionHeight;
|
||||
nrWMsOnNextPage = Math.Max(nrWMsOnNextPage, 1); /// Prevent division by zero if there are too many WM tests
|
||||
|
||||
nrPages = 1 + (batch.WaterMeters.Count - nrWMsOnFirstPage + nrWMsOnNextPage - 1) / nrWMsOnNextPage;
|
||||
|
||||
|
||||
///----------
|
||||
///----------
|
||||
/// Title
|
||||
///----------
|
||||
RectangleF printArea = new RectangleF(TitleX, TitleY, printWidth, titleHeight);
|
||||
@@ -239,7 +228,8 @@ namespace Results.Output.Printers.Enhanced
|
||||
for (int wmNr = nextWMNr; wmNr < Math.Min(nextWMNr + nrWMsOnPage, batch.WaterMeters.Count); wmNr++) /// wmNr is 0-based
|
||||
{
|
||||
int wmPosition = true ? batch.WaterMeters[wmNr].WMPosition : (wmNr + 1);
|
||||
nextWmTop = (int)PrintWM(e, batch.WaterMeters[wmNr], wmPosition, nextWmTop) + SpacingOneAndHalf4Header;
|
||||
int sectionHght = PrintWM(e, batch.WaterMeters[wmNr], wmPosition, nextWmTop);
|
||||
nextWmTop += sectionHght;
|
||||
}
|
||||
|
||||
nextWMNr += nrWMsOnPage;
|
||||
@@ -264,21 +254,88 @@ namespace Results.Output.Printers.Enhanced
|
||||
/// <param name="printedWMNr">Number of the water meter printed</param>
|
||||
/// <param name="top">Top coordinate of watermeter data</param>
|
||||
/// <returns>The height of the printed section</returns>
|
||||
float PrintWM(System.Drawing.Printing.PrintPageEventArgs e,
|
||||
int PrintWM(System.Drawing.Printing.PrintPageEventArgs e,
|
||||
Results.Entities.WaterMeter wm, int printedWMNr, int top)
|
||||
{
|
||||
/// Print the water meter number and the serial number
|
||||
string wmText = string.Format("{0} {1}", Strings.Water_Meter, printedWMNr);
|
||||
PrintHeaderAt(e, leftMargin, top, wmText);
|
||||
if (!string.IsNullOrEmpty(wm.SerialNr))
|
||||
{
|
||||
PrintHeaderAt(e, leftMargin + (int)e.Graphics.MeasureString(wmText, headerFont).Width, top,
|
||||
string.Format(" {0} = {1}", Strings.sn, wm.SerialNr));
|
||||
}
|
||||
/// Determin column widths
|
||||
float[] columnPos = new float[testItems.Count + 1];
|
||||
columnPos[0] = (float)leftMargin;
|
||||
|
||||
Table table = Table.Create_TestsAreRows(wm, testItems, style);
|
||||
for (int i = 0; i < testItems.Count; i++)
|
||||
{
|
||||
float columnWidth = e.Graphics.MeasureString(testItems[i].Caption, headerFont).Width;
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
{
|
||||
if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Config.Entities.Publish.Always)
|
||||
{
|
||||
string itemText = testItems[i].Print(wm, mtr.Name());
|
||||
|
||||
return table.Draw(e, leftMargin, top + SpacingOneAndHalf4Header);
|
||||
/// Strip color information
|
||||
string[] texts = itemText.Split(new char[] { '|' });
|
||||
if (texts.Length == 2) { itemText = texts[0]; }
|
||||
|
||||
float width = e.Graphics.MeasureString(itemText, font).Width;
|
||||
if (width > columnWidth) columnWidth = width;
|
||||
}
|
||||
}
|
||||
columnPos[i + 1] = columnPos[i] + columnWidth + 20.0f;
|
||||
}
|
||||
int tableLeftX = (int)columnPos[0];
|
||||
int tableRightX = (int)columnPos[testItems.Count] - 20;
|
||||
|
||||
string wmText = string.Format("{0} {1}", Strings.Water_Meter, printedWMNr);
|
||||
PrintHeaderAt(e, leftMargin, top, wmText);
|
||||
if (!string.IsNullOrEmpty(wm.SerialNr))
|
||||
{
|
||||
PrintHeaderAt(e, leftMargin + (int)e.Graphics.MeasureString(wmText, headerFont).Width, top,
|
||||
string.Format(" {0} = {1}", Strings.sn, wm.SerialNr));
|
||||
}
|
||||
|
||||
/// Horizontal line
|
||||
int horY = top + SpacingOneAndHalf4Header;
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(tableLeftX, horY), new Point(tableRightX, horY));
|
||||
|
||||
for (int i = 0; i < testItems.Count; i++)
|
||||
{
|
||||
PrintHeaderAt(e, (int)columnPos[i], top + (int)(1.6 * SpacingOne4Header), testItems[i].Caption);
|
||||
}
|
||||
|
||||
/// Horizontal line
|
||||
horY = top + (int)(2.8 * SpacingOne4Header);
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(tableLeftX, horY), new Point(tableRightX, horY));
|
||||
|
||||
int testsCount = 0;
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
{
|
||||
if ((mtr != null) && (mtr.Publish() == Config.Entities.Publish.Always))
|
||||
{
|
||||
WMeterRsltItemSpec.TableRowNr = ++testsCount;
|
||||
|
||||
for (int i = 0; i < testItems.Count; i++)
|
||||
{
|
||||
WMeterRsltItemSpec.TableColumnNr = i + 1;
|
||||
|
||||
string itemText = testItems[i].Print(wm, mtr.Name());
|
||||
|
||||
/// Strip color information
|
||||
string[] texts = itemText.Split(new char[] { '|' });
|
||||
if (texts.Length == 2)
|
||||
{
|
||||
itemText = texts[0];
|
||||
Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
|
||||
/// TODO: How to print colors?
|
||||
}
|
||||
|
||||
PrintAt(e, (int)columnPos[i], top + 2 * SpacingOne4Header + SpacingOne * testsCount, itemText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Horizontal line
|
||||
horY = top + 2 * SpacingOneAndHalf4Header + SpacingOne * testsCount;
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(tableLeftX, horY), new Point(tableRightX, horY));
|
||||
|
||||
return (testsCount + 1) * SpacingOne + 3 * SpacingOne4Header;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2017-2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -11,7 +11,7 @@ using Results.Resources;
|
||||
|
||||
namespace Results.Output.Printers.OnePerMeter
|
||||
{
|
||||
public class OnePerMeterPrintDocument : PrintersCommon
|
||||
public class OnePerMeterPrintDocument : PrintDocument
|
||||
{
|
||||
const float GapBetweenTableColumns = 10;
|
||||
const float GapBetweenCommonColumns = 10;
|
||||
@@ -29,7 +29,11 @@ namespace Results.Output.Printers.OnePerMeter
|
||||
readonly int spacingOne;
|
||||
readonly int spacingOne4Header;
|
||||
|
||||
float titleHeight;
|
||||
float commonTop; /// = TitleY + 60
|
||||
float bodyTop; /// = HdrTop + 160
|
||||
///
|
||||
float titleHeight;
|
||||
float commonHeight;
|
||||
|
||||
/// <summary>
|
||||
/// Property variable for the Font the user wishes to use
|
||||
@@ -50,14 +54,9 @@ namespace Results.Output.Printers.OnePerMeter
|
||||
/// Items to print
|
||||
///
|
||||
string header;
|
||||
IList<WMeterRsltItemSpec> commonItems1;
|
||||
IList<WMeterRsltItemSpec> commonItems2;
|
||||
IList<WMeterRsltItemSpec> commonItems3;
|
||||
IList<WMeterRsltItemSpec> commonItems;
|
||||
IList<WMeterRsltItemSpec> testItems;
|
||||
IList<WMeterRsltItemSpec> testItems2;
|
||||
IList<WMeterRsltItemSpec> belowItems1;
|
||||
IList<WMeterRsltItemSpec> belowItems2;
|
||||
IList<WMeterRsltItemSpec> belowItems3;
|
||||
string footer;
|
||||
|
||||
int nrPages;
|
||||
@@ -79,14 +78,9 @@ namespace Results.Output.Printers.OnePerMeter
|
||||
leftMargin = cfg.LeftMargin;
|
||||
|
||||
header = string.IsNullOrEmpty(cfg.Header) ? string.Empty : cfg.Header.Replace("~", Environment.NewLine);
|
||||
commonItems1 = Results.WMeterRsltItemSpec.FromStrArray(cfg.CommonItems1);
|
||||
commonItems2 = Results.WMeterRsltItemSpec.FromStrArray(cfg.CommonItems2);
|
||||
commonItems3 = Results.WMeterRsltItemSpec.FromStrArray(cfg.CommonItems3);
|
||||
testItems = Results.WMeterRsltItemSpec.FromStrArray(cfg.TestItems); /// TestID info will be overwritten later on
|
||||
commonItems = Results.WMeterRsltItemSpec.FromStrArray(cfg.CommonItems);
|
||||
testItems = Results.WMeterRsltItemSpec.FromStrArray(cfg.TestItems); /// TestID info will be overwritten later on
|
||||
testItems2 = Results.WMeterRsltItemSpec.FromStrArray(cfg.TestItems2); /// TestID info will be overwritten later on
|
||||
belowItems1 = Results.WMeterRsltItemSpec.FromStrArray(cfg.BelowItems1);
|
||||
belowItems2 = Results.WMeterRsltItemSpec.FromStrArray(cfg.BelowItems2);
|
||||
belowItems3 = Results.WMeterRsltItemSpec.FromStrArray(cfg.BelowItems3);
|
||||
footer = string.IsNullOrEmpty(cfg.Footer) ? string.Empty : cfg.Footer.Replace("~", Environment.NewLine);
|
||||
|
||||
/// Initialize fonts
|
||||
@@ -152,12 +146,8 @@ namespace Results.Output.Printers.OnePerMeter
|
||||
}
|
||||
}
|
||||
|
||||
float tableTop = cfg.TopMargin;
|
||||
|
||||
if (pageNr == 1)
|
||||
{
|
||||
/// First page
|
||||
|
||||
///
|
||||
/// Print water meter picture
|
||||
///
|
||||
@@ -171,167 +161,99 @@ namespace Results.Output.Printers.OnePerMeter
|
||||
catch (Exception) { } /// Cope with situations when file is missing or is not correct
|
||||
}
|
||||
|
||||
titleHeight = System.Windows.Forms.TextRenderer.MeasureText(header, titleFont).Height;
|
||||
commonTop = TitleY + titleHeight + spacingOne4Header;
|
||||
|
||||
commonHeight = commonItems.Count * spacingOne;
|
||||
bodyTop = commonTop + commonHeight + spacingOne4Header;
|
||||
|
||||
///
|
||||
/// Title
|
||||
///
|
||||
RectangleF printArea = new RectangleF(TitleX, TitleY, printWidth, titleHeight);
|
||||
e.Graphics.DrawString(header, titleFont, Brushes.Black, printArea);
|
||||
|
||||
titleHeight = System.Windows.Forms.TextRenderer.MeasureText(header, titleFont).Height;
|
||||
float commonTop = TitleY + titleHeight;
|
||||
|
||||
///----------------
|
||||
/// Common items
|
||||
///----------------
|
||||
commonTop += spacingOne4Header; /// Space above common part
|
||||
float leftMarginCommon1 = leftMargin + printWidth * 0.01f * cfg.ColW0Pct;
|
||||
float leftMarginCommon2 = leftMargin + printWidth * 0.01f * (cfg.ColW0Pct + cfg.ColW1Pct);
|
||||
float leftMarginCommon3 = leftMargin + printWidth * 0.01f * (cfg.ColW0Pct + cfg.ColW1Pct + cfg.ColW2Pct);
|
||||
|
||||
Alignment[] horizAlgn = new Alignment[] { Alignment.Left, Alignment.Left };
|
||||
VertAlignment[] vertAlgn = new VertAlignment[] { VertAlignment.Top, VertAlignment.Top };
|
||||
TableStyle commonTableStyle = new TableStyle { Font = font, MarginX = 5, MarginY = 3 };
|
||||
|
||||
Table table1 = new Table(2) { Style = commonTableStyle };
|
||||
foreach (var item in commonItems1)
|
||||
|
||||
///
|
||||
/// Common items
|
||||
///
|
||||
string[] leftColumn = new string[commonItems.Count];
|
||||
string[] rightColumn = new string[commonItems.Count];
|
||||
|
||||
int cnt = 0;
|
||||
foreach (var v in commonItems)
|
||||
{
|
||||
leftColumn[cnt] = v.Caption;
|
||||
rightColumn[cnt] = (batch.WaterMeters.Count > 0) ? v.Print(batch.WaterMeters[0]) : string.Empty;
|
||||
cnt++;
|
||||
}
|
||||
|
||||
/// Determine left column width
|
||||
float maxWidth = 0;
|
||||
foreach (var str in leftColumn)
|
||||
{
|
||||
string[] row = new string[] { item.Caption, item.Print(wm).Split(new char[] { '|' })[0] };
|
||||
table1.AddRow(row, horizAlgn, vertAlgn);
|
||||
float width = e.Graphics.MeasureString(str, font).Width;
|
||||
if (width > maxWidth) maxWidth = width;
|
||||
}
|
||||
float bodyTop1 = table1.Draw(e, leftMarginCommon1, commonTop);
|
||||
|
||||
/// Write aligned columns
|
||||
for (int i = 0; i < Math.Min(leftColumn.Length, rightColumn.Length); i++)
|
||||
{
|
||||
PrintAt(e, leftMargin, commonTop + spacingOne * i, maxWidth, leftColumn[i], font, Alignment.Left);
|
||||
PrintAt(e, leftMargin + maxWidth + GapBetweenCommonColumns, commonTop + spacingOne * i, 0, rightColumn[i], font, Alignment.Left);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
table1 = new Table(2) { Style = commonTableStyle };
|
||||
foreach (var item in commonItems2)
|
||||
{
|
||||
string[] row = new string[] { item.Caption, item.Print(wm).Split(new char[] { '|' })[0] };
|
||||
table1.AddRow(row, horizAlgn, vertAlgn);
|
||||
}
|
||||
float bodyTop2 = table1.Draw(e, leftMarginCommon2, commonTop);
|
||||
|
||||
|
||||
table1 = new Table(2) { Style = commonTableStyle };
|
||||
foreach (var item in commonItems3)
|
||||
{
|
||||
string[] row = new string[] { item.Caption, item.Print(wm).Split(new char[] { '|' })[0] };
|
||||
table1.AddRow(row, horizAlgn, vertAlgn);
|
||||
}
|
||||
float bodyTop3 = table1.Draw(e, leftMarginCommon3, commonTop);
|
||||
|
||||
float bodyTop12 = (bodyTop1 > bodyTop2) ? bodyTop1 : bodyTop2;
|
||||
tableTop = (bodyTop12 > bodyTop3) ? bodyTop12 : bodyTop3; /// Max. of all three bodyTop-s
|
||||
tableTop += spacingOne4Header; /// Space between the common part and the table
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Draw table (on the 1st, as well as on the 2nd page)
|
||||
///
|
||||
float belowTop;
|
||||
TableStyle style;
|
||||
Table table;
|
||||
switch (cfg.Form)
|
||||
///
|
||||
/// Body
|
||||
///
|
||||
if (pageNr == 1)
|
||||
{
|
||||
default:
|
||||
case TableForm.Rows:
|
||||
string[] tableHeader;
|
||||
IList<string[]> tableRows;
|
||||
Alignment[] itemAlignment;
|
||||
|
||||
style = new TableStyle
|
||||
{
|
||||
Font = font,
|
||||
HeaderFont = headerFont,
|
||||
MarginX = 5,
|
||||
MarginY = 3,
|
||||
LineWidth = 1,
|
||||
TopHeadersCount = 1,
|
||||
HorizLines = TableLines.All,
|
||||
VertLines = TableLines.All
|
||||
};
|
||||
table = Table.Create_TestsAreRows(wm, (pageNr == 1) ? testItems : testItems2, style);
|
||||
break;
|
||||
///
|
||||
/// Prepare table content: tableHeader + tableRows + itemAlignment
|
||||
///
|
||||
if (cfg.TestsAreRows)
|
||||
{
|
||||
GetContentTestsAreRows(wm, testItems, out tableHeader, out tableRows, out itemAlignment);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetContentTestsAreColumns(wm, testItems, out tableHeader, out tableRows, out itemAlignment);
|
||||
}
|
||||
|
||||
case TableForm.Columns:
|
||||
|
||||
style = new TableStyle
|
||||
{
|
||||
Font = font,
|
||||
HeaderFont = headerFont,
|
||||
MarginX = 5,
|
||||
MarginY = 3,
|
||||
LineWidth = 1,
|
||||
LeftHeadersCount = 1,
|
||||
HorizLines = TableLines.FirstSecondAndLast,
|
||||
VertLines = TableLines.All
|
||||
};
|
||||
table = Table.Create_TestsAreColumns(wm, (pageNr == 1) ? testItems : testItems2, style);
|
||||
break;
|
||||
|
||||
case TableForm.ColumnsPL:
|
||||
|
||||
style = new TableStyle
|
||||
{
|
||||
Font = font,
|
||||
HeaderFont = headerFont,
|
||||
MarginX = 5,
|
||||
MarginY = 3,
|
||||
LineWidth = 1,
|
||||
TopHeadersCount = 1,
|
||||
HorizLines = TableLines.FirstSecondAndLast,
|
||||
VertLines = TableLines.All
|
||||
};
|
||||
table = Table.Create_TestsAreColumnsPL(wm, (pageNr == 1) ? testItems : testItems2, style);
|
||||
break;
|
||||
DrawTable(e, (float)leftMargin, bodyTop, tableHeader, tableRows, itemAlignment);
|
||||
}
|
||||
else
|
||||
{
|
||||
string[] tableHeader;
|
||||
IList<string[]> tableRows;
|
||||
Alignment[] itemAlignment;
|
||||
|
||||
SizeF size = table.Measure(e);
|
||||
float tableLeft = (float)leftMargin + ((float)printWidth - size.Width) / 2;
|
||||
belowTop = table.Draw(e, tableLeft, tableTop);
|
||||
///
|
||||
/// Prepare table content: tableHeader + tableRows + itemAlignment
|
||||
///
|
||||
if (cfg.TestsAreRows2)
|
||||
{
|
||||
GetContentTestsAreRows(wm, testItems2, out tableHeader, out tableRows, out itemAlignment);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetContentTestsAreColumns(wm, testItems2, out tableHeader, out tableRows, out itemAlignment);
|
||||
}
|
||||
|
||||
DrawTable(e, (float)leftMargin, (float)topMargin, tableHeader, tableRows, itemAlignment);
|
||||
}
|
||||
|
||||
if (pageNr == nrPages)
|
||||
{
|
||||
///----------------
|
||||
/// Common items
|
||||
///----------------
|
||||
belowTop += spacingOne4Header; /// Space between the table and the bottom common part
|
||||
float leftMarginBelow1 = leftMargin + printWidth * 0.01f * cfg.BelowW0Pct;
|
||||
float leftMarginBelow2 = leftMargin + printWidth * 0.01f * (cfg.BelowW0Pct + cfg.BelowW1Pct);
|
||||
float leftMarginBelow3 = leftMargin + printWidth * 0.01f * (cfg.BelowW0Pct + cfg.BelowW1Pct + cfg.BelowW2Pct);
|
||||
|
||||
Alignment[] horizAlgn = new Alignment[] { Alignment.Left, Alignment.Left };
|
||||
VertAlignment[] vertAlgn = new VertAlignment[] { VertAlignment.Top, VertAlignment.Top };
|
||||
TableStyle commonTableStyle = new TableStyle { Font = font, MarginX = 5, MarginY = 3 };
|
||||
|
||||
Table table2 = new Table(2) { Style = commonTableStyle };
|
||||
foreach (var item in belowItems1)
|
||||
{
|
||||
string[] row = new string[] { item.Caption, item.Print(wm).Split(new char[] { '|' })[0] };
|
||||
table2.AddRow(row, horizAlgn, vertAlgn);
|
||||
}
|
||||
table2.Draw(e, leftMarginBelow1, belowTop);
|
||||
|
||||
|
||||
table2 = new Table(2) { Style = commonTableStyle };
|
||||
foreach (var item in belowItems2)
|
||||
{
|
||||
string[] row = new string[] { item.Caption, item.Print(wm).Split(new char[] { '|' })[0] };
|
||||
table2.AddRow(row, horizAlgn, vertAlgn);
|
||||
}
|
||||
table2.Draw(e, leftMarginBelow2, belowTop);
|
||||
|
||||
|
||||
table2 = new Table(2) { Style = commonTableStyle };
|
||||
foreach (var item in belowItems3)
|
||||
{
|
||||
string[] row = new string[] { item.Caption, item.Print(wm).Split(new char[] { '|' })[0] };
|
||||
table2.AddRow(row, horizAlgn, vertAlgn);
|
||||
}
|
||||
table2.Draw(e, leftMarginBelow3, belowTop);
|
||||
|
||||
|
||||
///
|
||||
///
|
||||
/// Footer on the last page
|
||||
///
|
||||
float footerWidth = e.Graphics.MeasureString(footer, footerFont).Width;
|
||||
PrintAt(e, footer, footerFont, leftMargin, topMargin + printHeight - 2 * spacingOne, 0, 0, Alignment.Left, VertAlignment.Top);
|
||||
PrintAt(e, leftMargin, topMargin + printHeight - 2 * spacingOne, 0, footer, footerFont, Alignment.Left);
|
||||
}
|
||||
|
||||
///
|
||||
@@ -339,11 +261,217 @@ namespace Results.Output.Printers.OnePerMeter
|
||||
///
|
||||
string pageNrText = string.Format("{0} {1}/{2}", Strings.Page, pageNr, nrPages);
|
||||
float pageNrWidth = e.Graphics.MeasureString(pageNrText, font).Width;
|
||||
PrintAt(e, pageNrText, font, leftMargin + (printWidth - pageNrWidth) / 2, topMargin + printHeight - spacingOne, 0, 0, Alignment.Left, VertAlignment.Top);
|
||||
PrintAt(e, leftMargin + (printWidth - pageNrWidth) / 2, topMargin + printHeight - spacingOne, 0, pageNrText, font, Alignment.Left);
|
||||
|
||||
e.HasMorePages = !(pageNr == nrPages);
|
||||
|
||||
pageNr++;
|
||||
}
|
||||
|
||||
|
||||
void GetContentTestsAreRows(Results.Entities.WaterMeter wm, IList<WMeterRsltItemSpec> items, out string[] tableHeader, out IList<string[]> tableRows, out Alignment[] itemAlignment)
|
||||
{
|
||||
int tableColumnsCount = items.Count;
|
||||
|
||||
tableRows = new List<string[]>();
|
||||
tableHeader = new string[tableColumnsCount];
|
||||
itemAlignment = new Alignment[tableColumnsCount];
|
||||
|
||||
for (int i = 0; i < tableColumnsCount; i++)
|
||||
{
|
||||
tableHeader[i] = items[i].Caption;
|
||||
itemAlignment[i] = items[i].Alignment;
|
||||
}
|
||||
|
||||
WMeterRsltItemSpec.TableRowNr = 0;
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
{
|
||||
if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Config.Entities.Publish.Always)
|
||||
{
|
||||
string[] oneTableRow = new string[tableColumnsCount];
|
||||
WMeterRsltItemSpec.TableRowNr++;
|
||||
|
||||
for (int i = 0; i < tableColumnsCount; i++)
|
||||
{
|
||||
WMeterRsltItemSpec.TableColumnNr = i + 1;
|
||||
oneTableRow[i] = items[i].Print(wm, mtr.Name()).Split(new char[] { '|' })[0];
|
||||
}
|
||||
|
||||
tableRows.Add(oneTableRow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GetContentTestsAreColumns(Results.Entities.WaterMeter wm, IList<WMeterRsltItemSpec> items, out string[] tableHeader, out IList<string[]> tableRows, out Alignment[] itemAlignment)
|
||||
{
|
||||
int tableColumnsCount = 1;
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
{
|
||||
if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Config.Entities.Publish.Always)
|
||||
{
|
||||
tableColumnsCount++;
|
||||
}
|
||||
}
|
||||
|
||||
tableRows = new List<string[]>();
|
||||
tableHeader = new string[tableColumnsCount];
|
||||
itemAlignment = new Alignment[tableColumnsCount];
|
||||
|
||||
tableHeader[0] = string.Empty;
|
||||
itemAlignment[0] = Alignment.Left;
|
||||
int columnsCount = 1;
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
{
|
||||
if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Config.Entities.Publish.Always)
|
||||
{
|
||||
tableHeader[columnsCount] = mtr.Name();
|
||||
itemAlignment[columnsCount] = Alignment.Left;
|
||||
columnsCount++;
|
||||
}
|
||||
}
|
||||
|
||||
WMeterRsltItemSpec.TableRowNr = 0;
|
||||
for (int i = 0; i < items.Count; i++)
|
||||
{
|
||||
string[] oneTableRow = new string[tableColumnsCount];
|
||||
WMeterRsltItemSpec.TableRowNr++;
|
||||
|
||||
oneTableRow[0] = items[i].Caption;
|
||||
|
||||
WMeterRsltItemSpec.TableColumnNr = 1;
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
{
|
||||
if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Config.Entities.Publish.Always)
|
||||
{
|
||||
/// Strip color information
|
||||
oneTableRow[WMeterRsltItemSpec.TableColumnNr] =
|
||||
items[i].Print(wm, mtr.Name()).Split(new char[] { '|' })[0];
|
||||
WMeterRsltItemSpec.TableColumnNr++;
|
||||
}
|
||||
}
|
||||
|
||||
tableRows.Add(oneTableRow);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
float DrawTable(System.Drawing.Printing.PrintPageEventArgs e, float left, float top, string[] header, IList<string[]> rows, Alignment[] alignment)
|
||||
{
|
||||
int tblColumnsCount = header.Length;
|
||||
|
||||
float[] columnWidth = new float[tblColumnsCount];
|
||||
float[] columnPos = new float[tblColumnsCount + 1];
|
||||
columnPos[0] = left;
|
||||
|
||||
///
|
||||
/// Measure table column widths and header height
|
||||
///
|
||||
float headerHeight = 0;
|
||||
for (int i = 0; i < tblColumnsCount; i++)
|
||||
{
|
||||
SizeF size = e.Graphics.MeasureString(header[i], headerFont);
|
||||
columnWidth[i] = (int)(size.Width + 0.99f);
|
||||
if (size.Height > headerHeight) headerHeight = (int)(size.Height + 0.99f);
|
||||
|
||||
foreach (var tableRow in rows)
|
||||
{
|
||||
int width = (int)(e.Graphics.MeasureString(tableRow[i], font).Width + 0.99f);
|
||||
if (width > columnWidth[i]) columnWidth[i] = width;
|
||||
}
|
||||
columnPos[i + 1] = columnPos[i] + columnWidth[i] + GapBetweenTableColumns;
|
||||
}
|
||||
|
||||
float tableLeftX = columnPos[0];
|
||||
float tableRightX = columnPos[tblColumnsCount] - GapBetweenTableColumns;
|
||||
|
||||
/// Horizontal line
|
||||
float horY = top + 1.5f * spacingOne4Header;
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, 2), new PointF(tableLeftX, horY), new PointF(tableRightX, horY));
|
||||
|
||||
///
|
||||
/// Draw table header
|
||||
///
|
||||
for (int i = 0; i < tblColumnsCount; i++)
|
||||
{
|
||||
PrintAt(e, columnPos[i],
|
||||
top + 1.7f * spacingOne4Header,
|
||||
columnWidth[i],
|
||||
header[i],
|
||||
headerFont,
|
||||
Alignment.Center);
|
||||
}
|
||||
/// Horizontal line
|
||||
horY = top + 2.1f * spacingOne4Header + headerHeight;
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, 2), new PointF(tableLeftX, horY), new PointF(tableRightX, horY));
|
||||
|
||||
///
|
||||
/// Draw table body
|
||||
///
|
||||
int rowsCount = 0;
|
||||
foreach (var oneTableRow in rows)
|
||||
{
|
||||
for (int i = 0; i < tblColumnsCount; i++)
|
||||
{
|
||||
PrintAt(e, columnPos[i],
|
||||
horY + 0.2f * spacingOne4Header + spacingOne * rowsCount,
|
||||
columnWidth[i],
|
||||
oneTableRow[i],
|
||||
font,
|
||||
alignment[i]);
|
||||
}
|
||||
rowsCount++;
|
||||
}
|
||||
|
||||
/// Horizontal line
|
||||
horY = horY + spacingOne * rowsCount + (3 * spacingOne4Header / 10);
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, 2), new PointF(tableLeftX, horY), new PointF(tableRightX, horY));
|
||||
|
||||
return horY - top + spacingOne;
|
||||
}
|
||||
|
||||
|
||||
static Font lastFont = null;
|
||||
static float lastSpacing = 0;
|
||||
|
||||
SizeF Measure(System.Drawing.Printing.PrintPageEventArgs e, string paragraph, Font font)
|
||||
{
|
||||
if (font != lastFont)
|
||||
{
|
||||
lastFont = font;
|
||||
lastSpacing = e.Graphics.MeasureString("Abcgq", font).Height;
|
||||
}
|
||||
|
||||
string[] lines = paragraph.Split(new char[] { '~' });
|
||||
float width = 0;
|
||||
foreach (var line in lines)
|
||||
{
|
||||
float lineWid = e.Graphics.MeasureString(line, font).Width;
|
||||
if (lineWid > width) width = lineWid;
|
||||
}
|
||||
|
||||
return new SizeF(width, 0.8f * lines.Length * lastSpacing + 0.2f);
|
||||
}
|
||||
|
||||
|
||||
void PrintAt(System.Drawing.Printing.PrintPageEventArgs e, float x, float y, float width, string paragraph, Font font, Alignment alignment)
|
||||
{
|
||||
SizeF size = Measure(e, paragraph, font);
|
||||
|
||||
string[] lines = paragraph.Split(new char[] { '~' });
|
||||
foreach (var line in lines)
|
||||
{
|
||||
float xx;
|
||||
switch (alignment)
|
||||
{
|
||||
default:
|
||||
case Alignment.Left: xx = x; break;
|
||||
case Alignment.Center: xx = x + (width - e.Graphics.MeasureString(line, font).Width) / 2; break;
|
||||
case Alignment.Right: xx = x + width - e.Graphics.MeasureString(line, font).Width; break;
|
||||
}
|
||||
e.Graphics.DrawString(line, font, Brushes.Black, new PointF(xx, y));
|
||||
y += 0.8f * lastSpacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,24 +27,12 @@ namespace Results.Output.Printers.OnePerMeter
|
||||
public bool SupressPrinting; /// Bypass printing when true
|
||||
public System.Globalization.CultureInfo CultureInfo;
|
||||
public string Header; /// =Title
|
||||
public int ColW0Pct;
|
||||
public int ColW1Pct;
|
||||
public int ColW2Pct;
|
||||
public string[] CommonItems1;
|
||||
public string[] CommonItems2;
|
||||
public string[] CommonItems3;
|
||||
public Config.Entities.TableForm Form;
|
||||
public string[] TestItems;
|
||||
public Config.Entities.TableForm Form2;
|
||||
public string[] CommonItems;
|
||||
public string[] TestItems;
|
||||
public string[] TestItems2;
|
||||
public int BelowW0Pct;
|
||||
public int BelowW1Pct;
|
||||
public int BelowW2Pct;
|
||||
public string[] BelowItems1;
|
||||
public string[] BelowItems2;
|
||||
public string[] BelowItems3;
|
||||
public string Footer;
|
||||
public string Footer;
|
||||
public bool TestsAreRows;
|
||||
public bool TestsAreRows2;
|
||||
public string ImgFullPathName;
|
||||
public int ImgLeft;
|
||||
public int ImgTop;
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Printing;
|
||||
using Config.Entities;
|
||||
|
||||
namespace Results.Output.Printers
|
||||
{
|
||||
public class PrintersCommon : PrintDocument
|
||||
{
|
||||
static Font lastFont = null;
|
||||
static float lastSpacing = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Measure the size of a paragraph of text, lines are separated by '~'.
|
||||
/// </summary>
|
||||
/// <param name="e">PrintPageEventArgs</param>
|
||||
/// <param name="text">Text, lines are separated by '~'</param>
|
||||
/// <param name="font">Font</param>
|
||||
/// <returns>Size of the paragraph of text</returns>
|
||||
public static SizeF Measure(System.Drawing.Printing.PrintPageEventArgs e, string text, Font font)
|
||||
{
|
||||
if (font != lastFont)
|
||||
{
|
||||
lastFont = font;
|
||||
lastSpacing = e.Graphics.MeasureString("Abcgq", font).Height;
|
||||
}
|
||||
|
||||
string[] lines = text.Split(new char[] { '~' });
|
||||
float width = 0;
|
||||
foreach (var line in lines)
|
||||
{
|
||||
float lineWid = e.Graphics.MeasureString(line, font).Width;
|
||||
if (lineWid > width) width = lineWid;
|
||||
}
|
||||
|
||||
return new SizeF(width, 0.8f * lines.Length * lastSpacing + 0.2f);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print a paragraph of text, lines are separated by '~'.
|
||||
/// </summary>
|
||||
/// <param name="e">PrintPageEventArgs</param>
|
||||
/// <param name="text">Text, lines are separated by '~'</param>
|
||||
/// <param name="font">Font</param>
|
||||
/// <param name="x">Position x</param>
|
||||
/// <param name="y">Position y</param>
|
||||
/// <param name="width">Width (required when alignment=Alignment.Center or alignment=Aligmenr.Right</param>
|
||||
/// <param name="height">Height, 0 = no vertical centering</param>
|
||||
/// <param name="horizAlignment">Horizontal alignment</param>
|
||||
/// <param name="vertAlignment">Vertical alignment</param>
|
||||
public static void PrintAt(System.Drawing.Printing.PrintPageEventArgs e, string text, Font font,
|
||||
float x, float y, float width, float height,
|
||||
Alignment horizAlignment, VertAlignment vertAlignment)
|
||||
{
|
||||
SizeF size = PrintersCommon.Measure(e, text, font);
|
||||
|
||||
string[] lines = text.Split(new char[] { '~' });
|
||||
|
||||
if (height <= size.Height) vertAlignment = VertAlignment.Top;
|
||||
float y0;
|
||||
switch (vertAlignment)
|
||||
{
|
||||
default:
|
||||
case VertAlignment.Top: y0 = y; break;
|
||||
case VertAlignment.Middle: y0 = y + (height - size.Height) / 2; break;
|
||||
case VertAlignment.Bottom: y0 = y + (height - size.Height); break;
|
||||
}
|
||||
|
||||
foreach (var line in lines)
|
||||
{
|
||||
float x0;
|
||||
switch (horizAlignment)
|
||||
{
|
||||
default:
|
||||
case Alignment.Left: x0 = x; break;
|
||||
case Alignment.Center: x0 = x + (width - e.Graphics.MeasureString(line, font).Width) / 2; break;
|
||||
case Alignment.Right: x0 = x + width - e.Graphics.MeasureString(line, font).Width; break;
|
||||
}
|
||||
e.Graphics.DrawString(line, font, Brushes.Black, new PointF(x0, y0));
|
||||
y0 += 0.8f * lastSpacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,413 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Printing;
|
||||
using Config.Entities;
|
||||
|
||||
namespace Results.Output.Printers
|
||||
{
|
||||
public enum TableLines
|
||||
{
|
||||
None,
|
||||
FirstAndLast,
|
||||
FirstSecondAndLast,
|
||||
All,
|
||||
}
|
||||
|
||||
public class TableStyle
|
||||
{
|
||||
public float MarginX;
|
||||
public float MarginY;
|
||||
public Font Font;
|
||||
public Font HeaderFont;
|
||||
public int TopHeadersCount;
|
||||
public int LeftHeadersCount;
|
||||
public float LineWidth;
|
||||
public TableLines HorizLines;
|
||||
public TableLines VertLines;
|
||||
}
|
||||
|
||||
public class Table
|
||||
{
|
||||
public readonly int ColumnsCount;
|
||||
public int RowsCount { get { return Rows.Count; } }
|
||||
|
||||
public readonly IList<string[]> Rows;
|
||||
public readonly IList<Alignment[]> HorizAlignments;
|
||||
public readonly IList<VertAlignment[]> VertAlignments;
|
||||
public TableStyle Style;
|
||||
|
||||
|
||||
public Table(int columnsCount)
|
||||
{
|
||||
ColumnsCount = columnsCount;
|
||||
|
||||
Rows = new List<string[]>();
|
||||
HorizAlignments = new List<Alignment[]>();
|
||||
VertAlignments = new List<VertAlignment[]>();
|
||||
Style = new TableStyle();
|
||||
}
|
||||
|
||||
|
||||
public void AddRow(string[] texts, Alignment[] horizAlignment, VertAlignment[] vertAlignemnt)
|
||||
{
|
||||
Rows.Add(texts);
|
||||
HorizAlignments.Add(horizAlignment);
|
||||
VertAlignments.Add(vertAlignemnt);
|
||||
}
|
||||
|
||||
|
||||
public SizeF Measure(System.Drawing.Printing.PrintPageEventArgs e)
|
||||
{
|
||||
SizeF retVal = new SizeF(0, 0);
|
||||
if (RowsCount == 0) return retVal;
|
||||
|
||||
float[] columnWidth = new float[ColumnsCount];
|
||||
float[] rowHeight = new float[RowsCount];
|
||||
|
||||
///
|
||||
/// Measure table column widths and header height
|
||||
///
|
||||
for (int colIx = 0; colIx < ColumnsCount; colIx++)
|
||||
{
|
||||
for (int rowIx = 0; rowIx < RowsCount; rowIx++)
|
||||
{
|
||||
if (Rows[rowIx] == null)
|
||||
{
|
||||
/// Separator row -> do nothing
|
||||
}
|
||||
else
|
||||
{
|
||||
bool isHeader = (colIx < Style.LeftHeadersCount) || (rowIx < Style.TopHeadersCount);
|
||||
SizeF size = PrintersCommon.Measure(e, Rows[rowIx][colIx], isHeader ? Style.HeaderFont : Style.Font);
|
||||
if (size.Width > columnWidth[colIx]) columnWidth[colIx] = size.Width;
|
||||
if (size.Height > rowHeight[rowIx]) rowHeight[rowIx] = size.Height;
|
||||
}
|
||||
}
|
||||
|
||||
bool hasLineToTheLeft = (Style.VertLines == TableLines.All)
|
||||
|| ((Style.VertLines == TableLines.FirstAndLast) && (colIx == 0))
|
||||
|| ((Style.VertLines == TableLines.FirstSecondAndLast) && (colIx <= 1));
|
||||
|
||||
retVal.Width += columnWidth[colIx] + (hasLineToTheLeft ? (Style.LineWidth + Style.MarginX) : 0) + Style.MarginX;
|
||||
}
|
||||
for (int rowIx = 0; rowIx < RowsCount; rowIx++)
|
||||
{
|
||||
if (Rows[rowIx] == null)
|
||||
{
|
||||
/// Separator row -> do nothing
|
||||
}
|
||||
else
|
||||
{
|
||||
bool hasLineAbove = (Style.HorizLines == TableLines.All)
|
||||
|| ((Style.HorizLines == TableLines.FirstAndLast) && (rowIx == 0))
|
||||
|| ((Style.HorizLines == TableLines.FirstSecondAndLast) && (rowIx <= 1))
|
||||
|| ((rowIx >= 1) && (Rows[rowIx - 1] == null));
|
||||
|
||||
retVal.Height += rowHeight[rowIx] + (hasLineAbove ? (Style.LineWidth + Style.MarginY) : 0) + Style.MarginY;
|
||||
}
|
||||
}
|
||||
|
||||
if (Style.VertLines == TableLines.None) retVal.Width -= Style.MarginX;
|
||||
if (Style.HorizLines == TableLines.None) retVal.Height -= Style.MarginY;
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
public float Draw(System.Drawing.Printing.PrintPageEventArgs e, float left, float top)
|
||||
{
|
||||
if (RowsCount == 0) return top;
|
||||
|
||||
int tblColumnsCount = Rows[0].Length;
|
||||
|
||||
float[] columnWidth = new float[tblColumnsCount];
|
||||
float[] columnPos = new float[tblColumnsCount];
|
||||
float[] vertLinePos = new float[tblColumnsCount + 1];
|
||||
|
||||
float[] rowHeight = new float[RowsCount];
|
||||
float[] rowPos = new float[RowsCount];
|
||||
float[] horizLinePos = new float[RowsCount + 1];
|
||||
|
||||
///
|
||||
/// Measure table column widths and header height
|
||||
///
|
||||
vertLinePos[0] = left;
|
||||
horizLinePos[0] = top;
|
||||
for (int colIx = 0; colIx < tblColumnsCount; colIx++)
|
||||
{
|
||||
for (int rowIx = 0; rowIx < RowsCount; rowIx++)
|
||||
{
|
||||
if (Rows[rowIx] != null)
|
||||
{
|
||||
/// In not a separator line
|
||||
bool isHeader = (colIx < Style.LeftHeadersCount) || (rowIx < Style.TopHeadersCount);
|
||||
SizeF size = PrintersCommon.Measure(e, Rows[rowIx][colIx], isHeader ? Style.HeaderFont : Style.Font);
|
||||
if (size.Width > columnWidth[colIx]) columnWidth[colIx] = size.Width;
|
||||
if (size.Height > rowHeight[rowIx]) rowHeight[rowIx] = size.Height;
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Separator line -> do nothing
|
||||
rowHeight[rowIx] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool hasLineToTheLeft = (Style.VertLines == TableLines.All)
|
||||
|| ((Style.VertLines == TableLines.FirstAndLast) && (colIx == 0))
|
||||
|| ((Style.VertLines == TableLines.FirstSecondAndLast) && (colIx <= 1));
|
||||
|
||||
columnPos[colIx] = vertLinePos[colIx] + (hasLineToTheLeft ? (Style.LineWidth + Style.MarginX) : 0);
|
||||
vertLinePos[colIx + 1] = columnPos[colIx] + columnWidth[colIx] + Style.MarginX;
|
||||
}
|
||||
for (int rowIx = 0; rowIx < RowsCount; rowIx++)
|
||||
{
|
||||
if (Rows[rowIx] != null)
|
||||
{
|
||||
/// In not a separator line
|
||||
bool hasLineAbove = (Style.HorizLines == TableLines.All)
|
||||
|| ((Style.HorizLines == TableLines.FirstAndLast) && (rowIx == 0))
|
||||
|| ((Style.HorizLines == TableLines.FirstSecondAndLast) && (rowIx <= 1))
|
||||
|| ((rowIx >= 1) && (Rows[rowIx - 1] == null));
|
||||
|
||||
rowPos[rowIx] = horizLinePos[rowIx] + (hasLineAbove ? Style.MarginY : 0);
|
||||
horizLinePos[rowIx + 1] = rowPos[rowIx] + rowHeight[rowIx] + Style.LineWidth + Style.MarginY;
|
||||
}
|
||||
else if (rowIx > 0)
|
||||
{
|
||||
/// Separator line
|
||||
rowPos[rowIx] = rowPos[rowIx - 1];
|
||||
horizLinePos[rowIx + 1] = horizLinePos[rowIx];
|
||||
}
|
||||
}
|
||||
|
||||
/// Horizontal lines
|
||||
float tableLeftX = left;
|
||||
float tableRightX = vertLinePos[tblColumnsCount] + Style.LineWidth;
|
||||
if (Style.HorizLines != TableLines.None)
|
||||
{
|
||||
for (int rowIx = 0; rowIx <= RowsCount; rowIx++)
|
||||
{
|
||||
if (Style.HorizLines == TableLines.All || rowIx == 0
|
||||
|| rowIx == RowsCount
|
||||
|| (Style.HorizLines == TableLines.FirstSecondAndLast && rowIx == 1)
|
||||
|| ((rowIx >= 1) && (Rows[rowIx - 1] == null)))
|
||||
{
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, Style.LineWidth), new PointF(tableLeftX, horizLinePos[rowIx] + Style.LineWidth / 2), new PointF(tableRightX, horizLinePos[rowIx] + Style.LineWidth / 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Vertical lines
|
||||
float tableTopY = top;
|
||||
float tableBottomY = horizLinePos[RowsCount] + Style.LineWidth;
|
||||
if (Style.VertLines != TableLines.None)
|
||||
{
|
||||
for (int colIx = 0; colIx <= tblColumnsCount; colIx++)
|
||||
{
|
||||
if (Style.VertLines == TableLines.All || colIx == 0 || colIx == ColumnsCount || (Style.VertLines == TableLines.FirstSecondAndLast && colIx == 1))
|
||||
{
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, Style.LineWidth), new PointF(vertLinePos[colIx] + Style.LineWidth / 2, tableTopY), new PointF(vertLinePos[colIx] + Style.LineWidth / 2, tableBottomY));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Draw table body
|
||||
///
|
||||
for (int rowIndex = 0; rowIndex < RowsCount; rowIndex++)
|
||||
{
|
||||
string[] oneTableRow = Rows[rowIndex];
|
||||
if (oneTableRow != null)
|
||||
{
|
||||
Alignment[] horizAlignment = HorizAlignments[(RowsCount > rowIndex) ? rowIndex : 0];
|
||||
VertAlignment[] vertAlignment = VertAlignments[(RowsCount > rowIndex) ? rowIndex : 0];
|
||||
for (int colIndex = 0; colIndex < tblColumnsCount; colIndex++)
|
||||
{
|
||||
bool isHeader = (colIndex < Style.LeftHeadersCount) || (rowIndex < Style.TopHeadersCount);
|
||||
PrintersCommon.PrintAt(e, oneTableRow[colIndex],
|
||||
isHeader ? Style.HeaderFont : Style.Font,
|
||||
columnPos[colIndex],
|
||||
rowPos[rowIndex],
|
||||
columnWidth[colIndex],
|
||||
rowHeight[rowIndex],
|
||||
horizAlignment[colIndex],
|
||||
vertAlignment[colIndex]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tableBottomY;
|
||||
}
|
||||
|
||||
|
||||
public static Table Create_TestsAreRows(Results.Entities.WaterMeter wm, IList<WMeterRsltItemSpec> items, TableStyle style)
|
||||
{
|
||||
/// Top row contains column captions
|
||||
|
||||
Table table = new Table(items.Count);
|
||||
table.Style = style;
|
||||
|
||||
string[] tableHeader = new string[table.ColumnsCount];
|
||||
Alignment[] horizAlignment = new Alignment[table.ColumnsCount];
|
||||
VertAlignment[] vertAlignment = new VertAlignment[table.ColumnsCount];
|
||||
for (int i = 0; i < table.ColumnsCount; i++)
|
||||
{
|
||||
tableHeader[i] = items[i].Caption;
|
||||
horizAlignment[i] = Alignment.Center;
|
||||
vertAlignment[i] = VertAlignment.Middle;
|
||||
}
|
||||
table.AddRow(tableHeader, horizAlignment, vertAlignment);
|
||||
|
||||
WMeterRsltItemSpec.TableRowNr = 1;
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
{
|
||||
if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Config.Entities.Publish.Always)
|
||||
{
|
||||
string[] oneTableRow = new string[table.ColumnsCount];
|
||||
horizAlignment = new Alignment[table.ColumnsCount];
|
||||
vertAlignment = new VertAlignment[table.ColumnsCount];
|
||||
|
||||
for (int i = 0; i < table.ColumnsCount; i++)
|
||||
{
|
||||
WMeterRsltItemSpec.TableColumnNr = i + 1;
|
||||
oneTableRow[i] = items[i].Print(wm, mtr.Name()).Split(new char[] { '|' })[0];
|
||||
horizAlignment[i] = items[i].Alignment;
|
||||
vertAlignment[i] = VertAlignment.Middle;
|
||||
}
|
||||
|
||||
table.AddRow(oneTableRow, horizAlignment, vertAlignment);
|
||||
|
||||
WMeterRsltItemSpec.TableRowNr++;
|
||||
}
|
||||
}
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
|
||||
public static Table Create_TestsAreColumns(Results.Entities.WaterMeter wm, IList<WMeterRsltItemSpec> items, TableStyle style)
|
||||
{
|
||||
/// Left column contains row captions
|
||||
|
||||
///
|
||||
/// Calculate columns count
|
||||
///
|
||||
int columnsCount = 1; /// Left column contains item caption
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
{
|
||||
if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Config.Entities.Publish.Always)
|
||||
{
|
||||
columnsCount++; /// One additional column for each test to be published
|
||||
}
|
||||
}
|
||||
|
||||
Table table = new Table(columnsCount);
|
||||
table.Style = style;
|
||||
|
||||
///
|
||||
/// Table content
|
||||
///
|
||||
WMeterRsltItemSpec.TableRowNr = 1;
|
||||
for (int i = 0; i < items.Count; i++)
|
||||
{
|
||||
string[] oneTableRow = new string[columnsCount];
|
||||
Alignment[] horizAlignment = new Alignment[columnsCount];
|
||||
VertAlignment[] vertAlignment = new VertAlignment[columnsCount];
|
||||
|
||||
oneTableRow[0] = items[i].Caption;
|
||||
horizAlignment[0] = Alignment.Center;
|
||||
vertAlignment[0] = VertAlignment.Middle;
|
||||
|
||||
WMeterRsltItemSpec.TableColumnNr = 1;
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
{
|
||||
if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Config.Entities.Publish.Always)
|
||||
{
|
||||
/// Strip color information
|
||||
oneTableRow[WMeterRsltItemSpec.TableColumnNr] =
|
||||
items[i].Print(wm, mtr.Name()).Split(new char[] { '|' })[0];
|
||||
horizAlignment[WMeterRsltItemSpec.TableColumnNr] = items[i].Alignment;
|
||||
vertAlignment[WMeterRsltItemSpec.TableColumnNr] = VertAlignment.Middle;
|
||||
|
||||
WMeterRsltItemSpec.TableColumnNr++;
|
||||
}
|
||||
}
|
||||
|
||||
table.AddRow(oneTableRow, horizAlignment, vertAlignment);
|
||||
|
||||
WMeterRsltItemSpec.TableRowNr++;
|
||||
}
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
|
||||
public static Table Create_TestsAreColumnsPL(Results.Entities.WaterMeter wm, IList<WMeterRsltItemSpec> items, TableStyle style)
|
||||
{
|
||||
/// Left column contains row captions
|
||||
|
||||
///
|
||||
/// Calculate columns count
|
||||
///
|
||||
int columnsCount = 2; /// Left two columns contain item caption and units
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
{
|
||||
if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Config.Entities.Publish.Always)
|
||||
{
|
||||
columnsCount++; /// One additional column for each test to be published
|
||||
}
|
||||
}
|
||||
|
||||
Table table = new Table(columnsCount);
|
||||
table.Style = style;
|
||||
|
||||
///
|
||||
/// Table content
|
||||
///
|
||||
WMeterRsltItemSpec.TableRowNr = 1;
|
||||
for (int i = 0; i < items.Count; i++)
|
||||
{
|
||||
if (items[i].Uid == (int)ItemID.Separator)
|
||||
{
|
||||
table.AddRow(null, null, null); /// 'separator' row
|
||||
}
|
||||
else
|
||||
{
|
||||
string[] oneTableRow = new string[columnsCount];
|
||||
Alignment[] horizAlignment = new Alignment[columnsCount];
|
||||
VertAlignment[] vertAlignment = new VertAlignment[columnsCount];
|
||||
|
||||
oneTableRow[0] = items[i].Caption;
|
||||
horizAlignment[0] = Alignment.Center;
|
||||
vertAlignment[0] = VertAlignment.Middle;
|
||||
|
||||
oneTableRow[1] = (i == 0) ? "Jednostka" : items[i].Units.ToDescription();
|
||||
horizAlignment[1] = Alignment.Center;
|
||||
vertAlignment[1] = VertAlignment.Middle;
|
||||
|
||||
WMeterRsltItemSpec.TableColumnNr = 1;
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
{
|
||||
if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Config.Entities.Publish.Always)
|
||||
{
|
||||
int colIx = WMeterRsltItemSpec.TableColumnNr + 1;
|
||||
|
||||
/// Strip color information
|
||||
oneTableRow[colIx] = items[i].Print(wm, mtr.Name()).Split(new char[] { '|' })[0];
|
||||
horizAlignment[colIx] = items[i].Alignment;
|
||||
vertAlignment[colIx] = VertAlignment.Middle;
|
||||
|
||||
WMeterRsltItemSpec.TableColumnNr++;
|
||||
}
|
||||
}
|
||||
|
||||
table.AddRow(oneTableRow, horizAlignment, vertAlignment);
|
||||
}
|
||||
WMeterRsltItemSpec.TableRowNr++;
|
||||
}
|
||||
|
||||
return table;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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.18.893.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.893.0")]
|
||||
[assembly: AssemblyVersion("2.18.815.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.815.0")]
|
||||
|
||||
Generated
+3
-75
@@ -1411,7 +1411,7 @@ namespace Results.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Temperature at the diverter at start of the test – first 4 measurements after the start.
|
||||
/// Looks up a localized string similar to Temperature at the diverter at start of the test – first 4 measurements from the start.
|
||||
/// </summary>
|
||||
internal static string Tooltip_T_di_st {
|
||||
get {
|
||||
@@ -1474,7 +1474,7 @@ namespace Results.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Temperature at the outlet at start of the test – first 4 measurements after the start.
|
||||
/// Looks up a localized string similar to Temperature at the outlet at start of the test – first 4 measurements from the start.
|
||||
/// </summary>
|
||||
internal static string Tooltip_T_dw_st {
|
||||
get {
|
||||
@@ -1482,69 +1482,6 @@ namespace Results.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Actual temperature in the line.
|
||||
/// </summary>
|
||||
internal static string Tooltip_T_ln_ac {
|
||||
get {
|
||||
return ResourceManager.GetString("Tooltip_T_ln_ac", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Average temperature in the line during a test.
|
||||
/// </summary>
|
||||
internal static string Tooltip_T_ln_avg {
|
||||
get {
|
||||
return ResourceManager.GetString("Tooltip_T_ln_avg", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Temperature in the line at end of the test – last 4 measurement before the end.
|
||||
/// </summary>
|
||||
internal static string Tooltip_T_ln_en {
|
||||
get {
|
||||
return ResourceManager.GetString("Tooltip_T_ln_en", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Maximum temperature in the line during the test.
|
||||
/// </summary>
|
||||
internal static string Tooltip_T_ln_max {
|
||||
get {
|
||||
return ResourceManager.GetString("Tooltip_T_ln_max", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Mean temperature in the line during a test.
|
||||
/// </summary>
|
||||
internal static string Tooltip_T_ln_me {
|
||||
get {
|
||||
return ResourceManager.GetString("Tooltip_T_ln_me", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Minimum temperature in the line during the test.
|
||||
/// </summary>
|
||||
internal static string Tooltip_T_ln_min {
|
||||
get {
|
||||
return ResourceManager.GetString("Tooltip_T_ln_min", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Temperature in the line at start of the test – first 4 measurements after the start.
|
||||
/// </summary>
|
||||
internal static string Tooltip_T_ln_st {
|
||||
get {
|
||||
return ResourceManager.GetString("Tooltip_T_ln_st", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Temperature of water sample at water density calibration.
|
||||
/// </summary>
|
||||
@@ -1609,7 +1546,7 @@ namespace Results.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Temperature at the inlet at start of the test – first 4 measurements after the start.
|
||||
/// Looks up a localized string similar to Temperature at the inlet at start of the test – first 4 measurements from the start.
|
||||
/// </summary>
|
||||
internal static string Tooltip_T_up_st {
|
||||
get {
|
||||
@@ -1644,15 +1581,6 @@ namespace Results.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Unit.
|
||||
/// </summary>
|
||||
internal static string Unit {
|
||||
get {
|
||||
return ResourceManager.GetString("Unit", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Units.
|
||||
/// </summary>
|
||||
|
||||
@@ -210,7 +210,4 @@
|
||||
<data name="to" xml:space="preserve">
|
||||
<value>do</value>
|
||||
</data>
|
||||
<data name="Unit" xml:space="preserve">
|
||||
<value>Jednotka</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -438,7 +438,4 @@
|
||||
<data name="to" xml:space="preserve">
|
||||
<value>do</value>
|
||||
</data>
|
||||
<data name="Unit" xml:space="preserve">
|
||||
<value>Jednostka</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -529,7 +529,7 @@
|
||||
<value>Mean temperature at diverter</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_di_st" xml:space="preserve">
|
||||
<value>Temperature at the diverter at start of the test – first 4 measurements after the start</value>
|
||||
<value>Temperature at the diverter at start of the test – first 4 measurements from the start</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_dw_ac" xml:space="preserve">
|
||||
<value>Actual temperature at the outlet</value>
|
||||
@@ -544,7 +544,7 @@
|
||||
<value>Mean temperature at outlet</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_dw_st" xml:space="preserve">
|
||||
<value>Temperature at the outlet at start of the test – first 4 measurements after the start</value>
|
||||
<value>Temperature at the outlet at start of the test – first 4 measurements from the start</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_up_ac" xml:space="preserve">
|
||||
<value>Actual temperature at the inlet</value>
|
||||
@@ -559,7 +559,7 @@
|
||||
<value>Mean temperature at inlet during a test</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_up_st" xml:space="preserve">
|
||||
<value>Temperature at the inlet at start of the test – first 4 measurements after the start</value>
|
||||
<value>Temperature at the inlet at start of the test – first 4 measurements from the start</value>
|
||||
</data>
|
||||
<data name="aux" xml:space="preserve">
|
||||
<value>aux.</value>
|
||||
@@ -699,28 +699,4 @@
|
||||
<data name="Tooltip_T_rho_0" xml:space="preserve">
|
||||
<value>Temperature of water sample at water density calibration</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_ln_ac" xml:space="preserve">
|
||||
<value>Actual temperature in the line</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_ln_avg" xml:space="preserve">
|
||||
<value>Average temperature in the line during a test</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_ln_en" xml:space="preserve">
|
||||
<value>Temperature in the line at end of the test – last 4 measurement before the end</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_ln_max" xml:space="preserve">
|
||||
<value>Maximum temperature in the line during the test</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_ln_me" xml:space="preserve">
|
||||
<value>Mean temperature in the line during a test</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_ln_min" xml:space="preserve">
|
||||
<value>Minimum temperature in the line during the test</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_ln_st" xml:space="preserve">
|
||||
<value>Temperature in the line at start of the test – first 4 measurements after the start</value>
|
||||
</data>
|
||||
<data name="Unit" xml:space="preserve">
|
||||
<value>Unit</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -18,7 +18,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;SENTEC</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;GENESIS;IPERL;LANG_DE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
@@ -27,7 +27,7 @@
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;SENTEC</DefineConstants>
|
||||
<DefineConstants>TRACE;GENESIS;IPERL;LANG_DE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
@@ -97,13 +97,13 @@
|
||||
<Compile Include="Mappings\TestRsltMap.cs" />
|
||||
<Compile Include="Mappings\WaterMeterDataMap.cs" />
|
||||
<Compile Include="Mappings\WaterMeterMap.cs" />
|
||||
<Compile Include="Output\Printers\Cevak\PrintDocumentCevak.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Output\Printers\Enhanced\EnhancedPrintDocument.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Output\Printers\Enhanced\EnhancedPrinterCfg.cs" />
|
||||
<Compile Include="Output\Printers\PrintersCommon.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Output\Printers\Munich\MunichPrintDocument.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
@@ -111,12 +111,12 @@
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Output\Printers\OnePerMeter\OnePerMeterPrinterCfg.cs" />
|
||||
<Compile Include="Output\Printers\Table.cs" />
|
||||
<Compile Include="Output\Printers\Zapiska\ZapiskaPrintDocument.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Output\Printers\Zapiska\ZapiskaPrinterCfg.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ItemSpec.cs" />
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
|
||||
+106
-1
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2016-2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2016 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Text;
|
||||
@@ -31,6 +31,110 @@ namespace Results
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Converts float number to a string with the specified number of significant digits
|
||||
/// </summary>
|
||||
/// <param name="value">Float value to be converted to a string</param>
|
||||
/// <param name="validDigits">Number of significant digits: 4, 3, or 2 (otherwise a full precision number is printed)</param>
|
||||
/// <returns>String representation of the float number</returns>
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
public static string SignificantDigitsToFmt(double value, int sigDigits)
|
||||
{
|
||||
if (sigDigits == 5)
|
||||
{
|
||||
if (value >= 9999.5 || value < -9999.5) return "F0";
|
||||
else if (value >= 999.95 || value < -999.95) return "F1";
|
||||
else if (value >= 99.995 || value < -99.995) return "F2";
|
||||
else if (value >= 9.9995 || value < -9.9995) return "F3";
|
||||
else if (value >= 0.99995 || value < -0.99995) return "F4";
|
||||
else if (value >= 0.099995 || value < -0.099995) return "F5";
|
||||
else if (value >= 0.0099995 || value < -0.0099995) return "F6";
|
||||
else if (value >= 0.00099995 || value < -0.00099995) return "F7";
|
||||
else if (value >= 0.000099995 || value < -0.000099995) return "F8";
|
||||
else return "F9";
|
||||
}
|
||||
else if (sigDigits == 4)
|
||||
{
|
||||
if (value >= 999.5 || value < -999.5) return "F0";
|
||||
else if (value >= 99.95 || value < -99.95) return "F1";
|
||||
else if (value >= 9.995 || value < -9.995) return "F2";
|
||||
else if (value >= 0.9995 || value < -0.9995) return "F3";
|
||||
else if (value >= 0.09995 || value < -0.09995) return "F4";
|
||||
else if (value >= 0.009995 || value < -0.009995) return "F5";
|
||||
else if (value >= 0.0009995 || value < -0.0009995) return "F6";
|
||||
else if (value >= 0.00009995 || value < -0.00009995) return "F7";
|
||||
else return "F8";
|
||||
}
|
||||
else if (sigDigits == 3)
|
||||
{
|
||||
if (value >= 99.5 || value < -99.5) return "F0";
|
||||
else if (value >= 9.95 || value < -9.95) return "F1";
|
||||
else if (value >= 0.995 || value < -0.995) return "F2";
|
||||
else if (value >= 0.0995 || value < -0.0995) return "F3";
|
||||
else if (value >= 0.00995 || value < -0.00995) return "F4";
|
||||
else if (value >= 0.000995 || value < -0.000995) return "F5";
|
||||
else if (value >= 0.0000995 || value < -0.0000995) return "F6";
|
||||
else return "F7";
|
||||
}
|
||||
else if (sigDigits == 2)
|
||||
{
|
||||
if (value >= 9.5 || value < -9.5) return "F0";
|
||||
else if (value >= 0.95 || value < -0.95) return "F1";
|
||||
else if (value >= 0.095 || value < -0.095) return "F2";
|
||||
else if (value >= 0.0095 || value < -0.0095) return "F3";
|
||||
else if (value >= 0.00095 || value < -0.00095) return "F4";
|
||||
else if (value >= 0.000095 || value < -0.000095) return "F5";
|
||||
else return "F6";
|
||||
}
|
||||
else /// if (sigDigits == 1)
|
||||
{
|
||||
if (value >= 0.95 || value < -0.95) return "F0";
|
||||
else if (value >= 0.095 || value < -0.095) return "F1";
|
||||
else if (value >= 0.0095 || value < -0.0095) return "F2";
|
||||
else if (value >= 0.00095 || value < -0.00095) return "F3";
|
||||
else if (value >= 0.000095 || value < -0.000095) return "F4";
|
||||
else return "F5";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts ErrorFlags integer to string. Supports up to 31 flags (E1..E31).
|
||||
@@ -66,5 +170,6 @@ namespace Results
|
||||
return (useRedGreenColor) ? (passed ? "OK|Green" : "NOK|Red") : (passed ? "OK|White" : "NOK|White");
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -137,8 +137,7 @@ namespace Results
|
||||
{
|
||||
AllItems = new List<WMeterRsltItemSpec>();
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.String, "String", "", Quantity.String, ItemCategory.Other, (w, t, u, f, p) => f));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Separator, "Separator", "", Quantity.String, ItemCategory.Other, (w, t, u, f, p) => string.Empty));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.String, "String", "", Quantity.String, ItemCategory.Other, (w, t, u, f, p) => f));
|
||||
|
||||
/// Common
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_name, Strings.Test + "()", Quantity.String, ItemCategory.TestData, (w, t, u, f, p) => FormatStr(f, (w.GetTestRslt(t) == null) ? "" : w.GetTestRslt(t).Name())));
|
||||
@@ -173,10 +172,9 @@ namespace Results
|
||||
///
|
||||
/// Density
|
||||
///
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Density, Strings.Density + " ()", Quantity.Density, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetTestRslt(t).DensityLine)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Density, Strings.Density + " ()", Quantity.Density, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetTestRslt(t).DensityOut)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Density_correction, Strings.Density_correction + " ()", Quantity.Density, ItemCategory.TestResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", (w.Batch.DensityCorr))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Rho_Wa_calc, string.Format("{0} of sample", Strings.Density), Quantity.Density, ItemCategory.TestResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V4", RealDensity)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.RhoDistilledWtrAtMeLineTemp, string.Format("{0} of distilled water at T line", Strings.Density), Quantity.Density, ItemCategory.TestResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V4", (w.GetTestRslt(t) == null) ? 0 : Config.Formulas.DistilledWaterDensityFromTemp((w.GetTestRslt(t).TempUpMean + w.GetTestRslt(t).TempDownMean) / 2))));
|
||||
|
||||
///
|
||||
/// Date and time
|
||||
@@ -187,39 +185,24 @@ namespace Results
|
||||
///
|
||||
/// Time (duration)
|
||||
///
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_time, Strings.T_s + "()", Quantity.Time, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).IsPMaxTest() ? 0 : w.GetTestRslt(t).TestTime)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_time_ni, Strings.T_s + "_ni()", Quantity.Time, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null || w.GetTestRslt(t).IsPMaxTest()) ? "" : FormatDbl(u, f, p, "V3", w.GetMeterTestRslt(t).TestTime)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.PMax_test_time, "Pressure test time ()", "Pressure test time", Quantity.Time, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null || !w.GetTestRslt(t).IsPMaxTest()) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).TestTime)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Diverter_start_time, "Diverter start time ()", "Diverter start time", Quantity.Time, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F3", w.GetTestRslt(t).IsDiverter() ? w.GetTestRslt(t).DiverterStart : 0)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Diverter_end_time, "Diverter end time ()", "Diverter end time", Quantity.Time, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F3", w.GetTestRslt(t).IsDiverter() ? w.GetTestRslt(t).DiverterEnd : 0)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Start_valve_open_time, "Start valve open time ()", "Start valve open time", Quantity.Time, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F3", w.GetTestRslt(t).IsStartStop() ? w.GetTestRslt(t).DiverterStart : 0)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Start_valve_close_time, "Start valve close time ()", "Start valve close time", Quantity.Time, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F3", w.GetTestRslt(t).IsStartStop() ? w.GetTestRslt(t).DiverterEnd : 0)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Timestamp_start, "Timestamp start ()", Quantity.Time, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).TimestampStart)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Timestamp_end, "Timestamp end ()", Quantity.Time, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).TimestampEnd)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_time, Strings.T_s + "()", Quantity.Time, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).TestTime)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Diverter_start_time, "Diverter start time ()", Quantity.Time, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F3", w.GetTestRslt(t).DiverterStart)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Diverter_end_time, "Diverter end time ()", Quantity.Time, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F3", w.GetTestRslt(t).DiverterEnd)));
|
||||
|
||||
///
|
||||
/// Flow
|
||||
///
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_from, string.Format("{0} {1}", Strings.VName_Flow, Strings.from), Quantity.Flow, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).Qfrom())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_to, string.Format("{0} {1}", Strings.VName_Flow, Strings.to), Quantity.Flow, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).Qto())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Flow, string.Format("{0} v r", Strings.VName_Flow), Strings.Tooltip_Q_v_r, Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).FlowVolume)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Qc, string.Format("Qc"), "Calculated water meter flow", Quantity.Flow, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).VolumeCTV / w.GetMeterTestRslt(t).TestTime * 3.6 * w.GetMeterTestRslt(t).PulsesMaster / w.GetTestRslt(t).PulsesMaster)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_ref_mean, string.Format("{0} rim ()", Strings.VName_Flow), Strings.Tooltip_Q_rim, Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).FlowMean)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_ref_min, string.Format("{0} ref min ()", Strings.VName_Flow), Strings.Tooltip_Q_min, Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).FlowMin)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_ref_max, string.Format("{0} ref max ()", Strings.VName_Flow), Strings.Tooltip_Q_max, Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).FlowMax)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_ref_start, string.Format("{0} ref start ()",Strings.VName_Flow),Strings.Tooltip_Q_start, Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).FlowStart)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_ref_end, string.Format("{0} ref end ()", Strings.VName_Flow), Strings.Tooltip_Q_end, Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).FlowEnd)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Flow_ctv, string.Format("{0} ctv min ()", Strings.VName_Flow), "Mean CTV of the flow", Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).TestTime == 0) ? 0 : w.GetTestRslt(t).VolumeCTV / w.GetTestRslt(t).TestTime)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Flow_ctv_min, string.Format("{0} ctv min ()", Strings.VName_Flow), "Min. CTV of the flow", Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).VolumeMaster == 0) ? 0 : w.GetTestRslt(t).VolumeCTV * w.GetTestRslt(t).FlowMin / w.GetTestRslt(t).VolumeMaster)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Flow_ctv_max, string.Format("{0} ctv max ()", Strings.VName_Flow), "Max. CTV of the flow", Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).VolumeMaster == 0) ? 0 : w.GetTestRslt(t).VolumeCTV * w.GetTestRslt(t).FlowMax / w.GetTestRslt(t).VolumeMaster)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Flow_ctv_start, string.Format("{0} ctv start ()", Strings.VName_Flow), "Start flow CTV", Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).VolumeMaster == 0) ? 0 : w.GetTestRslt(t).VolumeCTV * w.GetTestRslt(t).FlowStart / w.GetTestRslt(t).VolumeMaster)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Flow_ctv_end, string.Format("{0} ctv end ()", Strings.VName_Flow), "End flow CTV", Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).VolumeMaster == 0) ? 0 : w.GetTestRslt(t).VolumeCTV * w.GetTestRslt(t).FlowEnd / w.GetTestRslt(t).VolumeMaster)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_rise, string.Format("{0} {1}", Strings.VName_Flow, Strings.rise), Quantity.Flow, ItemCategory.MeterResult, (w, t, u, f, p) => (string.IsNullOrEmpty(t) || (w.GetTestRslt(t) != null)) ? ((w.QRise == 0) ? "-" : FormatDbl(u, f, p, "V3", w.QRise)) : ""));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_fall, string.Format("{0} {1}", Strings.VName_Flow, Strings.fall), Quantity.Flow, ItemCategory.MeterResult, (w, t, u, f, p) => (string.IsNullOrEmpty(t) || (w.GetTestRslt(t) != null)) ? ((w.QFall == 0) ? "-" : FormatDbl(u, f, p, "V3", w.QFall)) : ""));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_sensitivity, string.Format("{0} {1}", Strings.VName_Flow, Strings.sensitivity), Quantity.Flow, ItemCategory.MeterResult, (w, t, u, f, p) => (string.IsNullOrEmpty(t) || (w.GetTestRslt(t) != null)) ? ((w.QRise == 0) ? "-" : FormatDbl(u, f, p, "V3", w.QRise)) : ""));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.ConstMaster, string.Format("k MID ()"), "Const. of the reference flow meter", Quantity.PulsePerLtr, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", ((w.GetTestRslt(t).ConstMaster < float.Epsilon) ? 0 : (1 / w.GetTestRslt(t).ConstMaster)))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.ConstMasterRaw, string.Format("k MID raw ()"), "Const. of the ref. flow meter uncorrected",Quantity.PulsePerLtr, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", ((w.GetTestRslt(t).ConstMasterRaw < float.Epsilon) ? 0 : (1 / w.GetTestRslt(t).ConstMasterRaw)))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_from, string.Format("{0} {1}", Strings.VName_Flow, Strings.from), Quantity.Flow, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).Qfrom())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_to, string.Format("{0} {1}", Strings.VName_Flow, Strings.to), Quantity.Flow, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).Qto())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Flow, string.Format("{0} v r", Strings.VName_Flow), Strings.Tooltip_Q_v_r, Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).FlowVolume)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_ref_mean, string.Format("{0} rim ()", Strings.VName_Flow), Strings.Tooltip_Q_rim, Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).FlowMean)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_ref_min, string.Format("{0} ref min ()", Strings.VName_Flow), Strings.Tooltip_Q_min, Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).FlowMin)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_ref_max, string.Format("{0} ref max ()", Strings.VName_Flow), Strings.Tooltip_Q_max, Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).FlowMax)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_ref_start, string.Format("{0} ref start ()", Strings.VName_Flow), Strings.Tooltip_Q_start, Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).FlowStart)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_ref_end, string.Format("{0} ref end ()", Strings.VName_Flow), Strings.Tooltip_Q_end, Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).FlowEnd)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_rise, string.Format("{0} {1}", Strings.VName_Flow, Strings.rise), Quantity.Flow, ItemCategory.MeterResult, (w, t, u, f, p) => (string.IsNullOrEmpty(t) || (w.GetTestRslt(t) != null)) ? ((w.QRise == 0) ? "-" : FormatDbl(u, f, p, "V3", w.QRise)) : ""));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_fall, string.Format("{0} {1}", Strings.VName_Flow, Strings.fall), Quantity.Flow, ItemCategory.MeterResult, (w, t, u, f, p) => (string.IsNullOrEmpty(t) || (w.GetTestRslt(t) != null)) ? ((w.QFall == 0) ? "-" : FormatDbl(u, f, p, "V3", w.QFall)) : ""));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_sensitivity, string.Format("{0} {1}", Strings.VName_Flow, Strings.sensitivity), Quantity.Flow, ItemCategory.MeterResult, (w, t, u, f, p) => (string.IsNullOrEmpty(t) || (w.GetTestRslt(t) != null)) ? ((w.QRise == 0) ? "-" : FormatDbl(u, f, p, "V3", w.QRise)) : ""));
|
||||
|
||||
///
|
||||
/// Temperature
|
||||
@@ -230,12 +213,6 @@ namespace Results
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_up_avg, string.Format("{0} UP avg ()", Strings.VName_Temp), Strings.Tooltip_T_up_avg, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).TempUpStart + w.GetTestRslt(t).TempUpEnd) / 2)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_up_min, string.Format("{0} UP min ()", Strings.VName_Temp), Strings.Tooltip_T_up_min, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).TempUpMin)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_up_max, string.Format("{0} UP max ()", Strings.VName_Temp), Strings.Tooltip_T_up_max, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).TempUpMax)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_line_mean, string.Format("{0} LN ME ()", Strings.VName_Temp), Strings.Tooltip_T_ln_me, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).TempUpMean + w.GetTestRslt(t).TempDownMean) / 2)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_line_start, string.Format("{0} LN ST ()", Strings.VName_Temp), Strings.Tooltip_T_ln_st, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).TempUpStart + w.GetTestRslt(t).TempDownStart) / 2)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_line_end, string.Format("{0} LN EN ()", Strings.VName_Temp), Strings.Tooltip_T_ln_en, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).TempUpEnd + w.GetTestRslt(t).TempDownEnd) / 2)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_line_avg, string.Format("{0} LN avg ()", Strings.VName_Temp), Strings.Tooltip_T_ln_avg, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).TempUpStart + w.GetTestRslt(t).TempDownStart + w.GetTestRslt(t).TempUpEnd + w.GetTestRslt(t).TempDownEnd) / 4)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_line_min, string.Format("{0} LN min ()", Strings.VName_Temp), Strings.Tooltip_T_ln_min, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).TempUpMin + w.GetTestRslt(t).TempDownMin) / 2)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_line_max, string.Format("{0} LN max ()", Strings.VName_Temp), Strings.Tooltip_T_ln_max, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).TempUpMax + w.GetTestRslt(t).TempDownMax) / 2)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_down_mean, string.Format("{0} DW ME ()", Strings.VName_Temp), Strings.Tooltip_T_dw_me, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).TempDownMean)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_down_start, string.Format("{0} DW ST ()", Strings.VName_Temp), Strings.Tooltip_T_dw_st, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).TempDownStart)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_down_end, string.Format("{0} DW EN ()", Strings.VName_Temp), Strings.Tooltip_T_dw_en, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).TempDownEnd)));
|
||||
@@ -250,14 +227,14 @@ namespace Results
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_div_max, string.Format("{0} DI max ()", Strings.VName_Temp), Strings.Tooltip_T_di_max, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).TempDivMax)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_rho_0, string.Format("{0} RO0", Strings.VName_Temp), Strings.Tooltip_T_rho_0, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", AtTemperature)));
|
||||
#if HEAT_METERS
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_Hi_mean, string.Format("{0} hi me", Strings.VName_Temp), Quantity.Temperature, ItemCategory.Other, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F3", w.GetTestRslt(t).Custom1)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_Hi_start, string.Format("{0} hi st", Strings.VName_Temp), Quantity.Temperature, ItemCategory.Other, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F3", w.GetTestRslt(t).Custom2)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_Hi_end, string.Format("{0} hi en", Strings.VName_Temp), Quantity.Temperature, ItemCategory.Other, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F3", w.GetTestRslt(t).Custom3)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_Hi_avg, string.Format("{0} hi av", Strings.VName_Temp), Quantity.Temperature, ItemCategory.Other, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F3", (w.GetTestRslt(t).Custom2 + w.GetTestRslt(t).Custom3) / 2)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_Lo_mean, string.Format("{0} lo me", Strings.VName_Temp), Quantity.Temperature, ItemCategory.Other, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F3", w.GetTestRslt(t).Custom6)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_Lo_start, string.Format("{0} lo st", Strings.VName_Temp), Quantity.Temperature, ItemCategory.Other, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F3", w.GetTestRslt(t).Custom7)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_Lo_end, string.Format("{0} lo en", Strings.VName_Temp), Quantity.Temperature, ItemCategory.Other, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F3", w.GetTestRslt(t).Custom8)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_Lo_avg, string.Format("{0} lo av", Strings.VName_Temp), Quantity.Temperature, ItemCategory.Other, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F3", (w.GetTestRslt(t).Custom7 + w.GetTestRslt(t).Custom8) / 2)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_Hi_mean, string.Format("{0} hi me", Strings.VName_Temp), Quantity.Temperature, ItemCategory.Other, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : (w.GetTestRslt(t).Custom1).ToString(GetPr(p, "F3"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_Hi_start, string.Format("{0} hi st", Strings.VName_Temp), Quantity.Temperature, ItemCategory.Other, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : (w.GetTestRslt(t).Custom2).ToString(GetPr(p, "F3"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_Hi_end, string.Format("{0} hi en", Strings.VName_Temp), Quantity.Temperature, ItemCategory.Other, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : (w.GetTestRslt(t).Custom3).ToString(GetPr(p, "F3"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_Hi_avg, string.Format("{0} hi av", Strings.VName_Temp), Quantity.Temperature, ItemCategory.Other, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : ((w.GetTestRslt(t).Custom2 + w.GetTestRslt(t).Custom3) / 2).ToString(GetPr(p, "F3"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_Lo_mean, string.Format("{0} lo me", Strings.VName_Temp), Quantity.Temperature, ItemCategory.Other, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : (w.GetTestRslt(t).Custom6).ToString(GetPr(p, "F3"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_Lo_start, string.Format("{0} lo st", Strings.VName_Temp), Quantity.Temperature, ItemCategory.Other, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : (w.GetTestRslt(t).Custom7).ToString(GetPr(p, "F3"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_Lo_end, string.Format("{0} lo en", Strings.VName_Temp), Quantity.Temperature, ItemCategory.Other, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : (w.GetTestRslt(t).Custom8).ToString(GetPr(p, "F3"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_Lo_avg, string.Format("{0} lo av", Strings.VName_Temp), Quantity.Temperature, ItemCategory.Other, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : ((w.GetTestRslt(t).Custom7 + w.GetTestRslt(t).Custom8) / 2).ToString(GetPr(p, "F3"))));
|
||||
#endif
|
||||
|
||||
///
|
||||
@@ -281,10 +258,6 @@ namespace Results
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_delta_avg, string.Format("{0} DE avg ()", Strings.VName_Press), Strings.Tooltip_P_de_avg, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).PressDeltaStart + w.GetTestRslt(t).PressDeltaEnd) / 2)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_delta_min, string.Format("{0} DE min ()", Strings.VName_Press), Strings.Tooltip_P_de_min, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).PressDeltaMin)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_delta_max, string.Format("{0} DE max ()", Strings.VName_Press), Strings.Tooltip_P_de_max, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).PressDeltaMax)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_delta_mean_per_mtr, string.Format("{0} DE ME per mtr.()", Strings.VName_Press), "P delta mean per one meter", Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).PressDeltaMean / Math.Max(1, w.GetTestRslt(t).Batch.WaterMeters.Count))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_delta_mean_from_up_down, string.Format("{0} UP-DW ME ()", Strings.VName_Press), "P delta mean from UP/DW", Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).PressUpMean - w.GetTestRslt(t).PressDownMean)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_delta_mean_from_up_down_per_mtr, string.Format("{0} UP-DW ME per mtr ()", Strings.VName_Press), "P delta mean from UP/DW per one meter", Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).PressUpMean - w.GetTestRslt(t).PressDownMean) / Math.Max(1, w.GetTestRslt(t).Batch.WaterMeters.Count))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_PMax_test_mean, string.Format("{0} PMax mean ()", Strings.VName_Press), "Mean PMax test pressure", Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null || !w.GetTestRslt(t).IsPMaxTest()) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).PressUpMean + w.GetTestRslt(t).PressDownMean) / 2)));
|
||||
|
||||
///
|
||||
/// Ambient temperature/pressure/humidity/Buoyancy
|
||||
@@ -304,14 +277,14 @@ namespace Results
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error_limit_Hi, Strings.ErrLimHi + "()", Quantity.Error, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetTestRslt(t).ErrLimHi())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Uncertainty, Strings.Uncertainty + "()", Quantity.Error, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetTestRslt(t).Uncertainty())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_error, string.Format("{0} rel.ref. ()", Strings.VName_Error), Strings.Tooltip_E_rel_ref, Quantity.Error, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetTestRslt(t).ErrorMaster)));
|
||||
#if TURA_IPERL || TURA_SPECIAL
|
||||
#if TURA_IPERL || TURA_SPECIAL
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error, string.Format("{0} rel. ()", Strings.VName_Error), Strings.Tooltip_E_rel, Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "0" : FormatDbl(u, f, p, "V2", w.GetMeterTestRslt(t).Error)));
|
||||
#else
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error, string.Format("{0} rel. ()", Strings.VName_Error), Strings.Tooltip_E_rel, Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetMeterTestRslt(t).Error)));
|
||||
#endif
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Passed, Strings.Result, Quantity.Boolean, ItemCategory.MeterResult, (w, t, u, f, p) => string.IsNullOrEmpty(t) ? w.PassedColorStr() : ((w.GetMeterTestRslt(t) == null) ? "" : w.GetMeterTestRslt(t).PassedColorStr())));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.ResultOrErrorFlags, "Winiki lub E", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.PassedOrErrorFlagsStr()))); /// PL specific result
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.ResultOrErrorFlags, "Winiki lub E", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, string.IsNullOrEmpty(w.ErrorFlagstStr()) ? (w.WaterMeterData.Text4 + w.PassedColorStr()) : w.ErrorFlagstStr()))); /// PL specific result
|
||||
|
||||
///
|
||||
/// Water meter info
|
||||
@@ -334,7 +307,8 @@ namespace Results
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Flow_profile_sensitivity_class, "Flow profile sensitivity class", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => FormatStr(f, w.WaterMeterData.FlowProfileSensitivityClass.ToDescription())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Approval_info, Strings.Approval, Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => FormatStr(f, w.WaterMeterData.ApprovalInfo)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Certificate, "Certificate", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => FormatStr(f, w.WaterMeterData.Certificate)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Medium, "Water cold/hot", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => FormatStr(f, w.WaterMeterData.Medium.ToDescription())));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Pulses_per_liter, Strings.PulsesLiter, Quantity.PulsePerLtr, ItemCategory.MeterData, (w, t, u, f, p) => FormatDbl(u, f, p, "V4", w.WaterMeterData.PulsesPerLtr)));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Text1, "Text1", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => FormatStr(f, w.WaterMeterData.Text1)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Text2, "Text2", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => FormatStr(f, w.WaterMeterData.Text2)));
|
||||
@@ -350,17 +324,10 @@ namespace Results
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Formatted_WM_ID, "Formatted WM ID", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => string.IsNullOrEmpty(f) ? string.Format("{0}-{1}", w.BatchNr(), w.WMPosition) : string.Format(f, w.StartTime(), w.EndTime(), w.BatchNr(), w.WMPosition, w.SerialNr)));
|
||||
|
||||
/// Water meters results (single)
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.End_state, Strings.End_state, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.EndState)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Pulses, Strings.Pulses + "()", Quantity.Pulses, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F0", w.GetMeterTestRslt(t).IsPulses() ? w.GetMeterTestRslt(t).PulsesMeter : 0)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_pulses_ni, Strings.RefPulses + "_ni()", Quantity.Pulses, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F0", w.GetMeterTestRslt(t).PulsesMaster)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_pulses, Strings.RefPulses + "()", Quantity.Pulses, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F0", w.GetTestRslt(t).PulsesMaster)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Camera_angle, "Angle ()", "Angle measured by a camera", Quantity.Pulses, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F0", w.GetMeterTestRslt(t).IsCamera() ? w.GetMeterTestRslt(t).PulsesMeter : 0)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Camera_angle_start, "Start angle ()", "Start angle measured by a camera", Quantity.Pulses, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F0", w.GetMeterTestRslt(t).IsCamera() ? w.GetMeterTestRslt(t).VolumeStart * w.GetMeterTestRslt(t).PulsesPerLiter : 0)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Camera_angle_end, "End angle ()", "End angle measured by a camera", Quantity.Pulses, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F0", w.GetMeterTestRslt(t).IsCamera() ? w.GetMeterTestRslt(t).VolumeEnd * w.GetMeterTestRslt(t).PulsesPerLiter : 0)));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Pulses_per_liter, Strings.PulsesLiter, Quantity.PulsePerLtr, ItemCategory.MeterData, (w, t, u, f, p) => FormatDbl(u, f, p, "V4", w.WaterMeterData.PulsesPerLtr)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Pulse__liter, Strings.PulsesLiter + "()", Quantity.PulsePerLtr, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).IsCamera() ? 0 : w.GetMeterTestRslt(t).PulsesPerLiter)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Degree__liter, "Degree per liter ()", Quantity.PulsePerLtr, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).IsCamera() ? w.GetMeterTestRslt(t).PulsesPerLiter : 0)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.End_state, Strings.End_state, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.EndState)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Pulses, Strings.Pulses + "()", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F0", w.GetMeterTestRslt(t).PulsesMeter)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_pulses, Strings.RefPulses + "()", Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F1", w.GetMeterTestRslt(t).PulsesMaster)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Pulses__liter, Strings.PulsesLiter + "()", Quantity.PulsePerLtr, ItemCategory.Other, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).PulsesPerLiter)));
|
||||
|
||||
/// Water meters results (combined)
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error_main, Strings.Err_main + "()", Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain).Error)));
|
||||
@@ -392,8 +359,8 @@ namespace Results
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Meter_type, Strings.Meter_type, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, w.WaterMeterData.Compound ? Strings.Compound : (w.WaterMeterData.HeatMeter ? Strings.Heat_meter : Strings.Single))));
|
||||
|
||||
#if HEAT_METERS
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Energy, Strings.Energy + "()", Quantity.Energy, ItemCategory.Other, (w, t, u, f, p) => (w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy) == null) ? "" : FormatDbl(u, f, p, "F1", (w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy).VolumeMeter))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_energy, Strings.Energy_ref + "()", Quantity.Energy, ItemCategory.Other, (w, t, u, f, p) => (w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy) == null) ? "" : FormatDbl(u, f, p, "F1", (w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy).VolumeRef))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Energy, Strings.Energy + "()", Quantity.Energy, ItemCategory.Other, (w, t, u, f, p) => (w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy) == null) ? "" : (w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy).VolumeMeter).ToString(GetPr(p, "F1"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_energy, Strings.Energy_ref + "()", Quantity.Energy, ItemCategory.Other, (w, t, u, f, p) => (w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy) == null) ? "" : (w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy).VolumeRef).ToString(GetPr(p, "F1"))));
|
||||
#endif
|
||||
|
||||
#if IPERL
|
||||
@@ -408,9 +375,8 @@ namespace Results
|
||||
#endif
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.TestDone, Strings.Test_done + "()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) != null && w.GetMeterTestRslt(t).TestDone) ? Strings.Yes : Strings.No));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.TestPassed, Strings.Test_passed + "()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) != null && w.GetMeterTestRslt(t).Passed) ? Strings.Yes : Strings.No));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.ErrorFlags, Strings.Error_flags + "()", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => FormatStr(f, (w.GetTestRslt(t) != null) ? w.GetTestRslt(t).ErrorFlagsStr() : w.ErrorFlagsStr())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.ErrorFlagsEx, Strings.Error_flags + "Ex", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.ErrorFlagsStrEx())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.E1, "E1 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & 0x0001) != 0) ? Strings.Yes : Strings.No));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.ErrorFlags, Strings.Error_flags + "()", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => FormatStr(f, (w.GetTestRslt(t) != null) ? w.GetTestRslt(t).ErrorFlagsStr() : w.ErrorFlagstStr())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.E1, "E1 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & 0x0001) != 0) ? Strings.Yes : Strings.No));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.E2, "E2 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & 0x0002) != 0) ? Strings.Yes : Strings.No));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.E3, "E3 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & 0x0004) != 0) ? Strings.Yes : Strings.No));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.E4, "E4 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & 0x0008) != 0) ? Strings.Yes : Strings.No));
|
||||
@@ -465,7 +431,7 @@ namespace Results
|
||||
int significantDigits;
|
||||
if (int.TryParse(precision.Substring(1), out significantDigits))
|
||||
{
|
||||
precision = Config.Utils.SignificantDigitsToFmt(val, significantDigits);
|
||||
precision = Utils.SignificantDigitsToFmt(val, significantDigits);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -503,7 +469,7 @@ namespace Results
|
||||
int significantDigits;
|
||||
if (int.TryParse(precision.Substring(1), out significantDigits))
|
||||
{
|
||||
precision = Config.Utils.SignificantDigitsToFmt(val1, significantDigits);
|
||||
precision = Utils.SignificantDigitsToFmt(val1, significantDigits);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,9 +27,6 @@ namespace ResultsBrowser
|
||||
|
||||
public string[] ResultItems;
|
||||
|
||||
public string PrinterClass;
|
||||
public string PrinterCfg;
|
||||
|
||||
[XmlArrayAttribute("ResultsClmnWidths")]
|
||||
public int[] ResultsClmnWidths;
|
||||
[XmlIgnore]
|
||||
|
||||
+199
-199
@@ -28,204 +28,204 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.connectionStringTextBox1 = new System.Windows.Forms.TextBox();
|
||||
this.benchNameLabel = new System.Windows.Forms.Label();
|
||||
this.connectionStringLabel = new System.Windows.Forms.Label();
|
||||
this.connectionStringTextBox2 = new System.Windows.Forms.TextBox();
|
||||
this.connectionStringTextBox3 = new System.Windows.Forms.TextBox();
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.benchNameTextBox1 = new System.Windows.Forms.TextBox();
|
||||
this.benchNameTextBox2 = new System.Windows.Forms.TextBox();
|
||||
this.benchNameTextBox3 = new System.Windows.Forms.TextBox();
|
||||
this.languageLabel = new System.Windows.Forms.Label();
|
||||
this.languageTextBox = new System.Windows.Forms.TextBox();
|
||||
this.formatLabel = new System.Windows.Forms.Label();
|
||||
this.timePeriodFormatTextBox = new System.Windows.Forms.TextBox();
|
||||
this.benchNameTextBox5 = new System.Windows.Forms.TextBox();
|
||||
this.benchNameTextBox4 = new System.Windows.Forms.TextBox();
|
||||
this.connectionStringTextBox5 = new System.Windows.Forms.TextBox();
|
||||
this.connectionStringTextBox4 = new System.Windows.Forms.TextBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// connectionStringTextBox1
|
||||
//
|
||||
this.connectionStringTextBox1.Location = new System.Drawing.Point(157, 45);
|
||||
this.connectionStringTextBox1.Name = "connectionStringTextBox1";
|
||||
this.connectionStringTextBox1.Size = new System.Drawing.Size(555, 20);
|
||||
this.connectionStringTextBox1.TabIndex = 3;
|
||||
//
|
||||
// benchNameLabel
|
||||
//
|
||||
this.benchNameLabel.AutoSize = true;
|
||||
this.benchNameLabel.Location = new System.Drawing.Point(26, 20);
|
||||
this.benchNameLabel.Name = "benchNameLabel";
|
||||
this.benchNameLabel.Size = new System.Drawing.Size(67, 13);
|
||||
this.benchNameLabel.TabIndex = 0;
|
||||
this.benchNameLabel.Text = "Bench name";
|
||||
//
|
||||
// connectionStringLabel
|
||||
//
|
||||
this.connectionStringLabel.AutoSize = true;
|
||||
this.connectionStringLabel.Location = new System.Drawing.Point(154, 20);
|
||||
this.connectionStringLabel.Name = "connectionStringLabel";
|
||||
this.connectionStringLabel.Size = new System.Drawing.Size(89, 13);
|
||||
this.connectionStringLabel.TabIndex = 1;
|
||||
this.connectionStringLabel.Text = "Connection string";
|
||||
//
|
||||
// connectionStringTextBox2
|
||||
//
|
||||
this.connectionStringTextBox2.Location = new System.Drawing.Point(157, 71);
|
||||
this.connectionStringTextBox2.Name = "connectionStringTextBox2";
|
||||
this.connectionStringTextBox2.Size = new System.Drawing.Size(555, 20);
|
||||
this.connectionStringTextBox2.TabIndex = 5;
|
||||
//
|
||||
// connectionStringTextBox3
|
||||
//
|
||||
this.connectionStringTextBox3.Location = new System.Drawing.Point(157, 97);
|
||||
this.connectionStringTextBox3.Name = "connectionStringTextBox3";
|
||||
this.connectionStringTextBox3.Size = new System.Drawing.Size(555, 20);
|
||||
this.connectionStringTextBox3.TabIndex = 7;
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.okButton.Location = new System.Drawing.Point(506, 250);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(95, 38);
|
||||
this.okButton.TabIndex = 18;
|
||||
this.okButton.Text = "OK";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.cancelButton.Location = new System.Drawing.Point(617, 250);
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.Size = new System.Drawing.Size(95, 38);
|
||||
this.cancelButton.TabIndex = 19;
|
||||
this.cancelButton.Text = "Cancel";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
|
||||
//
|
||||
// benchNameTextBox1
|
||||
//
|
||||
this.benchNameTextBox1.Location = new System.Drawing.Point(29, 45);
|
||||
this.benchNameTextBox1.Name = "benchNameTextBox1";
|
||||
this.benchNameTextBox1.Size = new System.Drawing.Size(100, 20);
|
||||
this.benchNameTextBox1.TabIndex = 2;
|
||||
//
|
||||
// benchNameTextBox2
|
||||
//
|
||||
this.benchNameTextBox2.Location = new System.Drawing.Point(29, 71);
|
||||
this.benchNameTextBox2.Name = "benchNameTextBox2";
|
||||
this.benchNameTextBox2.Size = new System.Drawing.Size(100, 20);
|
||||
this.benchNameTextBox2.TabIndex = 4;
|
||||
//
|
||||
// benchNameTextBox3
|
||||
//
|
||||
this.benchNameTextBox3.Location = new System.Drawing.Point(29, 97);
|
||||
this.benchNameTextBox3.Name = "benchNameTextBox3";
|
||||
this.benchNameTextBox3.Size = new System.Drawing.Size(100, 20);
|
||||
this.benchNameTextBox3.TabIndex = 6;
|
||||
//
|
||||
// languageLabel
|
||||
//
|
||||
this.languageLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.languageLabel.AutoSize = true;
|
||||
this.languageLabel.Location = new System.Drawing.Point(26, 239);
|
||||
this.languageLabel.Name = "languageLabel";
|
||||
this.languageLabel.Size = new System.Drawing.Size(55, 13);
|
||||
this.languageLabel.TabIndex = 14;
|
||||
this.languageLabel.Text = "Language";
|
||||
//
|
||||
// languageTextBox
|
||||
//
|
||||
this.languageTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.languageTextBox.Location = new System.Drawing.Point(29, 263);
|
||||
this.languageTextBox.Name = "languageTextBox";
|
||||
this.languageTextBox.Size = new System.Drawing.Size(100, 20);
|
||||
this.languageTextBox.TabIndex = 15;
|
||||
//
|
||||
// formatLabel
|
||||
//
|
||||
this.formatLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.formatLabel.AutoSize = true;
|
||||
this.formatLabel.Location = new System.Drawing.Point(26, 185);
|
||||
this.formatLabel.Name = "formatLabel";
|
||||
this.formatLabel.Size = new System.Drawing.Size(94, 13);
|
||||
this.formatLabel.TabIndex = 12;
|
||||
this.formatLabel.Text = "Time period format";
|
||||
//
|
||||
// timePeriodFormatTextBox
|
||||
//
|
||||
this.timePeriodFormatTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.timePeriodFormatTextBox.Location = new System.Drawing.Point(29, 207);
|
||||
this.timePeriodFormatTextBox.Name = "timePeriodFormatTextBox";
|
||||
this.timePeriodFormatTextBox.Size = new System.Drawing.Size(683, 20);
|
||||
this.timePeriodFormatTextBox.TabIndex = 13;
|
||||
//
|
||||
// benchNameTextBox5
|
||||
//
|
||||
this.benchNameTextBox5.Location = new System.Drawing.Point(29, 149);
|
||||
this.benchNameTextBox5.Name = "benchNameTextBox5";
|
||||
this.benchNameTextBox5.Size = new System.Drawing.Size(100, 20);
|
||||
this.benchNameTextBox5.TabIndex = 10;
|
||||
//
|
||||
// benchNameTextBox4
|
||||
//
|
||||
this.benchNameTextBox4.Location = new System.Drawing.Point(29, 123);
|
||||
this.benchNameTextBox4.Name = "benchNameTextBox4";
|
||||
this.benchNameTextBox4.Size = new System.Drawing.Size(100, 20);
|
||||
this.benchNameTextBox4.TabIndex = 8;
|
||||
//
|
||||
// connectionStringTextBox5
|
||||
//
|
||||
this.connectionStringTextBox5.Location = new System.Drawing.Point(157, 149);
|
||||
this.connectionStringTextBox5.Name = "connectionStringTextBox5";
|
||||
this.connectionStringTextBox5.Size = new System.Drawing.Size(555, 20);
|
||||
this.connectionStringTextBox5.TabIndex = 11;
|
||||
//
|
||||
// connectionStringTextBox4
|
||||
//
|
||||
this.connectionStringTextBox4.Location = new System.Drawing.Point(157, 123);
|
||||
this.connectionStringTextBox4.Name = "connectionStringTextBox4";
|
||||
this.connectionStringTextBox4.Size = new System.Drawing.Size(555, 20);
|
||||
this.connectionStringTextBox4.TabIndex = 9;
|
||||
//
|
||||
// DatabaseSettingsDlg
|
||||
//
|
||||
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(743, 310);
|
||||
this.Controls.Add(this.benchNameTextBox5);
|
||||
this.Controls.Add(this.benchNameTextBox4);
|
||||
this.Controls.Add(this.connectionStringTextBox5);
|
||||
this.Controls.Add(this.connectionStringTextBox4);
|
||||
this.Controls.Add(this.timePeriodFormatTextBox);
|
||||
this.Controls.Add(this.formatLabel);
|
||||
this.Controls.Add(this.languageTextBox);
|
||||
this.Controls.Add(this.languageLabel);
|
||||
this.Controls.Add(this.benchNameTextBox3);
|
||||
this.Controls.Add(this.benchNameTextBox2);
|
||||
this.Controls.Add(this.benchNameTextBox1);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.Controls.Add(this.connectionStringTextBox3);
|
||||
this.Controls.Add(this.connectionStringLabel);
|
||||
this.Controls.Add(this.connectionStringTextBox2);
|
||||
this.Controls.Add(this.benchNameLabel);
|
||||
this.Controls.Add(this.connectionStringTextBox1);
|
||||
this.Name = "DatabaseSettingsDlg";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Settings";
|
||||
this.Load += new System.EventHandler(this.DatabaseSettings_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
this.connectionStringTextBox1 = new System.Windows.Forms.TextBox();
|
||||
this.benchNameLabel = new System.Windows.Forms.Label();
|
||||
this.connectionStringLabel = new System.Windows.Forms.Label();
|
||||
this.connectionStringTextBox2 = new System.Windows.Forms.TextBox();
|
||||
this.connectionStringTextBox3 = new System.Windows.Forms.TextBox();
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.benchNameTextBox1 = new System.Windows.Forms.TextBox();
|
||||
this.benchNameTextBox2 = new System.Windows.Forms.TextBox();
|
||||
this.benchNameTextBox3 = new System.Windows.Forms.TextBox();
|
||||
this.languageLabel = new System.Windows.Forms.Label();
|
||||
this.languageTextBox = new System.Windows.Forms.TextBox();
|
||||
this.formatLabel = new System.Windows.Forms.Label();
|
||||
this.timePeriodFormatTextBox = new System.Windows.Forms.TextBox();
|
||||
this.benchNameTextBox5 = new System.Windows.Forms.TextBox();
|
||||
this.benchNameTextBox4 = new System.Windows.Forms.TextBox();
|
||||
this.connectionStringTextBox5 = new System.Windows.Forms.TextBox();
|
||||
this.connectionStringTextBox4 = new System.Windows.Forms.TextBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// connectionStringTextBox1
|
||||
//
|
||||
this.connectionStringTextBox1.Location = new System.Drawing.Point(157, 45);
|
||||
this.connectionStringTextBox1.Name = "connectionStringTextBox1";
|
||||
this.connectionStringTextBox1.Size = new System.Drawing.Size(555, 20);
|
||||
this.connectionStringTextBox1.TabIndex = 3;
|
||||
//
|
||||
// benchNameLabel
|
||||
//
|
||||
this.benchNameLabel.AutoSize = true;
|
||||
this.benchNameLabel.Location = new System.Drawing.Point(26, 20);
|
||||
this.benchNameLabel.Name = "benchNameLabel";
|
||||
this.benchNameLabel.Size = new System.Drawing.Size(67, 13);
|
||||
this.benchNameLabel.TabIndex = 0;
|
||||
this.benchNameLabel.Text = "Bench name";
|
||||
//
|
||||
// connectionStringLabel
|
||||
//
|
||||
this.connectionStringLabel.AutoSize = true;
|
||||
this.connectionStringLabel.Location = new System.Drawing.Point(154, 20);
|
||||
this.connectionStringLabel.Name = "connectionStringLabel";
|
||||
this.connectionStringLabel.Size = new System.Drawing.Size(89, 13);
|
||||
this.connectionStringLabel.TabIndex = 1;
|
||||
this.connectionStringLabel.Text = "Connection string";
|
||||
//
|
||||
// connectionStringTextBox2
|
||||
//
|
||||
this.connectionStringTextBox2.Location = new System.Drawing.Point(157, 71);
|
||||
this.connectionStringTextBox2.Name = "connectionStringTextBox2";
|
||||
this.connectionStringTextBox2.Size = new System.Drawing.Size(555, 20);
|
||||
this.connectionStringTextBox2.TabIndex = 5;
|
||||
//
|
||||
// connectionStringTextBox3
|
||||
//
|
||||
this.connectionStringTextBox3.Location = new System.Drawing.Point(157, 97);
|
||||
this.connectionStringTextBox3.Name = "connectionStringTextBox3";
|
||||
this.connectionStringTextBox3.Size = new System.Drawing.Size(555, 20);
|
||||
this.connectionStringTextBox3.TabIndex = 7;
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.okButton.Location = new System.Drawing.Point(506, 250);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(95, 38);
|
||||
this.okButton.TabIndex = 16;
|
||||
this.okButton.Text = "OK";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.cancelButton.Location = new System.Drawing.Point(617, 250);
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.Size = new System.Drawing.Size(95, 38);
|
||||
this.cancelButton.TabIndex = 17;
|
||||
this.cancelButton.Text = "Cancel";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
|
||||
//
|
||||
// benchNameTextBox1
|
||||
//
|
||||
this.benchNameTextBox1.Location = new System.Drawing.Point(29, 45);
|
||||
this.benchNameTextBox1.Name = "benchNameTextBox1";
|
||||
this.benchNameTextBox1.Size = new System.Drawing.Size(100, 20);
|
||||
this.benchNameTextBox1.TabIndex = 2;
|
||||
//
|
||||
// benchNameTextBox2
|
||||
//
|
||||
this.benchNameTextBox2.Location = new System.Drawing.Point(29, 71);
|
||||
this.benchNameTextBox2.Name = "benchNameTextBox2";
|
||||
this.benchNameTextBox2.Size = new System.Drawing.Size(100, 20);
|
||||
this.benchNameTextBox2.TabIndex = 4;
|
||||
//
|
||||
// benchNameTextBox3
|
||||
//
|
||||
this.benchNameTextBox3.Location = new System.Drawing.Point(29, 97);
|
||||
this.benchNameTextBox3.Name = "benchNameTextBox3";
|
||||
this.benchNameTextBox3.Size = new System.Drawing.Size(100, 20);
|
||||
this.benchNameTextBox3.TabIndex = 6;
|
||||
//
|
||||
// languageLabel
|
||||
//
|
||||
this.languageLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.languageLabel.AutoSize = true;
|
||||
this.languageLabel.Location = new System.Drawing.Point(26, 239);
|
||||
this.languageLabel.Name = "languageLabel";
|
||||
this.languageLabel.Size = new System.Drawing.Size(55, 13);
|
||||
this.languageLabel.TabIndex = 14;
|
||||
this.languageLabel.Text = "Language";
|
||||
//
|
||||
// languageTextBox
|
||||
//
|
||||
this.languageTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.languageTextBox.Location = new System.Drawing.Point(29, 263);
|
||||
this.languageTextBox.Name = "languageTextBox";
|
||||
this.languageTextBox.Size = new System.Drawing.Size(100, 20);
|
||||
this.languageTextBox.TabIndex = 15;
|
||||
//
|
||||
// formatLabel
|
||||
//
|
||||
this.formatLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.formatLabel.AutoSize = true;
|
||||
this.formatLabel.Location = new System.Drawing.Point(26, 185);
|
||||
this.formatLabel.Name = "formatLabel";
|
||||
this.formatLabel.Size = new System.Drawing.Size(39, 13);
|
||||
this.formatLabel.TabIndex = 12;
|
||||
this.formatLabel.Text = "Format";
|
||||
//
|
||||
// timePeriodFormatTextBox
|
||||
//
|
||||
this.timePeriodFormatTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.timePeriodFormatTextBox.Location = new System.Drawing.Point(29, 207);
|
||||
this.timePeriodFormatTextBox.Name = "timePeriodFormatTextBox";
|
||||
this.timePeriodFormatTextBox.Size = new System.Drawing.Size(683, 20);
|
||||
this.timePeriodFormatTextBox.TabIndex = 13;
|
||||
//
|
||||
// benchNameTextBox5
|
||||
//
|
||||
this.benchNameTextBox5.Location = new System.Drawing.Point(29, 149);
|
||||
this.benchNameTextBox5.Name = "benchNameTextBox5";
|
||||
this.benchNameTextBox5.Size = new System.Drawing.Size(100, 20);
|
||||
this.benchNameTextBox5.TabIndex = 10;
|
||||
//
|
||||
// benchNameTextBox4
|
||||
//
|
||||
this.benchNameTextBox4.Location = new System.Drawing.Point(29, 123);
|
||||
this.benchNameTextBox4.Name = "benchNameTextBox4";
|
||||
this.benchNameTextBox4.Size = new System.Drawing.Size(100, 20);
|
||||
this.benchNameTextBox4.TabIndex = 8;
|
||||
//
|
||||
// connectionStringTextBox5
|
||||
//
|
||||
this.connectionStringTextBox5.Location = new System.Drawing.Point(157, 149);
|
||||
this.connectionStringTextBox5.Name = "connectionStringTextBox5";
|
||||
this.connectionStringTextBox5.Size = new System.Drawing.Size(555, 20);
|
||||
this.connectionStringTextBox5.TabIndex = 11;
|
||||
//
|
||||
// connectionStringTextBox4
|
||||
//
|
||||
this.connectionStringTextBox4.Location = new System.Drawing.Point(157, 123);
|
||||
this.connectionStringTextBox4.Name = "connectionStringTextBox4";
|
||||
this.connectionStringTextBox4.Size = new System.Drawing.Size(555, 20);
|
||||
this.connectionStringTextBox4.TabIndex = 9;
|
||||
//
|
||||
// DatabaseSettingsDlg
|
||||
//
|
||||
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(743, 310);
|
||||
this.Controls.Add(this.benchNameTextBox5);
|
||||
this.Controls.Add(this.benchNameTextBox4);
|
||||
this.Controls.Add(this.connectionStringTextBox5);
|
||||
this.Controls.Add(this.connectionStringTextBox4);
|
||||
this.Controls.Add(this.timePeriodFormatTextBox);
|
||||
this.Controls.Add(this.formatLabel);
|
||||
this.Controls.Add(this.languageTextBox);
|
||||
this.Controls.Add(this.languageLabel);
|
||||
this.Controls.Add(this.benchNameTextBox3);
|
||||
this.Controls.Add(this.benchNameTextBox2);
|
||||
this.Controls.Add(this.benchNameTextBox1);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.Controls.Add(this.connectionStringTextBox3);
|
||||
this.Controls.Add(this.connectionStringLabel);
|
||||
this.Controls.Add(this.connectionStringTextBox2);
|
||||
this.Controls.Add(this.benchNameLabel);
|
||||
this.Controls.Add(this.connectionStringTextBox1);
|
||||
this.Name = "DatabaseSettingsDlg";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Database Settings";
|
||||
this.Load += new System.EventHandler(this.DatabaseSettings_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
@@ -248,6 +248,6 @@
|
||||
private System.Windows.Forms.TextBox benchNameTextBox5;
|
||||
private System.Windows.Forms.TextBox benchNameTextBox4;
|
||||
private System.Windows.Forms.TextBox connectionStringTextBox5;
|
||||
private System.Windows.Forms.TextBox connectionStringTextBox4;
|
||||
private System.Windows.Forms.TextBox connectionStringTextBox4;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using ResultsBrowser.Resources;
|
||||
using TBF.BenchControl;
|
||||
|
||||
namespace ResultsBrowser.Forms
|
||||
{
|
||||
|
||||
-112
@@ -1,112 +0,0 @@
|
||||
namespace ResultsBrowser.Forms
|
||||
{
|
||||
partial class PrinterConfigDlg
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.printerClassComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.changePrinterClassButton = new System.Windows.Forms.Button();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.configureButton = new System.Windows.Forms.Button();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// printerClassComboBox
|
||||
//
|
||||
this.printerClassComboBox.Enabled = false;
|
||||
this.printerClassComboBox.FormattingEnabled = true;
|
||||
this.printerClassComboBox.Location = new System.Drawing.Point(12, 29);
|
||||
this.printerClassComboBox.Name = "printerClassComboBox";
|
||||
this.printerClassComboBox.Size = new System.Drawing.Size(389, 21);
|
||||
this.printerClassComboBox.TabIndex = 0;
|
||||
//
|
||||
// changePrinterClassButton
|
||||
//
|
||||
this.changePrinterClassButton.Location = new System.Drawing.Point(15, 67);
|
||||
this.changePrinterClassButton.Name = "changePrinterClassButton";
|
||||
this.changePrinterClassButton.Size = new System.Drawing.Size(161, 43);
|
||||
this.changePrinterClassButton.TabIndex = 1;
|
||||
this.changePrinterClassButton.Text = "Change printer type (configuration will be deleted)";
|
||||
this.changePrinterClassButton.UseVisualStyleBackColor = true;
|
||||
this.changePrinterClassButton.Click += new System.EventHandler(this.changePrinterClassButton_Click);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(12, 9);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(60, 13);
|
||||
this.label1.TabIndex = 2;
|
||||
this.label1.Text = "Printer type";
|
||||
//
|
||||
// configureButton
|
||||
//
|
||||
this.configureButton.Location = new System.Drawing.Point(196, 67);
|
||||
this.configureButton.Name = "configureButton";
|
||||
this.configureButton.Size = new System.Drawing.Size(95, 43);
|
||||
this.configureButton.TabIndex = 3;
|
||||
this.configureButton.Text = "Configure";
|
||||
this.configureButton.UseVisualStyleBackColor = true;
|
||||
this.configureButton.Click += new System.EventHandler(this.configureButton_Click);
|
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
this.cancelButton.Location = new System.Drawing.Point(306, 67);
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.Size = new System.Drawing.Size(95, 43);
|
||||
this.cancelButton.TabIndex = 4;
|
||||
this.cancelButton.Text = "Cancel";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
|
||||
//
|
||||
// PrinterConfigDlg
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(416, 122);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.configureButton);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.changePrinterClassButton);
|
||||
this.Controls.Add(this.printerClassComboBox);
|
||||
this.Name = "PrinterConfigDlg";
|
||||
this.Text = "Printer configuration";
|
||||
this.Load += new System.EventHandler(this.PrinterClassDlg_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.ComboBox printerClassComboBox;
|
||||
private System.Windows.Forms.Button changePrinterClassButton;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Button configureButton;
|
||||
private System.Windows.Forms.Button cancelButton;
|
||||
}
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using TBF.BenchControl;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace ResultsBrowser.Forms
|
||||
{
|
||||
public partial class PrinterConfigDlg : Form
|
||||
{
|
||||
public string PrinterClass; /// To be initialized in the constructor
|
||||
public string PrinterCfg;
|
||||
|
||||
IList<IComponentFactory> printerFactories; /// Printer components classes
|
||||
IComponentFactory printerFactory;
|
||||
|
||||
|
||||
public PrinterConfigDlg()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
printerFactories = new List<IComponentFactory>();
|
||||
foreach (var fctry in TbfComponents.Factories)
|
||||
{
|
||||
if (fctry.ClassName.Contains("Output.Printers.")) printerFactories.Add(fctry);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void PrinterClassDlg_Load(object sender, EventArgs e)
|
||||
{
|
||||
printerClassComboBox.Items.Add("---");
|
||||
foreach (var fctry in printerFactories)
|
||||
{
|
||||
printerClassComboBox.Items.Add(fctry.ClassName);
|
||||
}
|
||||
printerClassComboBox.Text = string.IsNullOrEmpty(PrinterClass) ? "---" : PrinterClass;
|
||||
}
|
||||
|
||||
|
||||
private void changePrinterClassButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
printerClassComboBox.Enabled = true;
|
||||
}
|
||||
|
||||
|
||||
private void cancelButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
|
||||
|
||||
private void configureButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
string oriClassName = PrinterClass;
|
||||
|
||||
PrinterClass = string.Empty;
|
||||
if (printerClassComboBox.Text != "---")
|
||||
{
|
||||
foreach (var pc in printerFactories)
|
||||
{
|
||||
if (printerClassComboBox.Text == pc.ClassName) PrinterClass = pc.ClassName;
|
||||
}
|
||||
}
|
||||
|
||||
printerFactory = GetFactory(PrinterClass);
|
||||
if (printerFactory == null)
|
||||
{
|
||||
MessageBox.Show("Invalid printer");
|
||||
return;
|
||||
}
|
||||
|
||||
IComponentCfg printerCfg;
|
||||
if ((oriClassName != printerFactory.ClassName) || string.IsNullOrEmpty(PrinterCfg))
|
||||
{
|
||||
printerCfg = printerFactory.DefaultConfig();
|
||||
}
|
||||
else
|
||||
{
|
||||
Config.Entities.Component cmpnt = new Config.Entities.Component();
|
||||
cmpnt.Name = "printer";
|
||||
cmpnt.ClassName = PrinterClass;
|
||||
cmpnt.Parameters = PrinterCfg;
|
||||
printerCfg = printerFactory.CmpntCfgFromCmpntEntity(cmpnt);
|
||||
}
|
||||
|
||||
IComponentCfgCtrl cfgControl = printerCfg.GetControl();
|
||||
cfgControl.Config = printerCfg;
|
||||
cfgControl.Config.ItemNr = 0;
|
||||
|
||||
TBF.ComponentParametersDlg cfgForm = new TBF.ComponentParametersDlg();
|
||||
cfgForm.TbfComponents = new List<Config.Entities.Component>();
|
||||
|
||||
cfgForm.ComponentCfgCtrl = cfgControl;
|
||||
cfgForm.UnlockAfterStart = true;
|
||||
DialogResult dr = cfgForm.ShowDialog();
|
||||
if (dr != DialogResult.OK) return;
|
||||
|
||||
PrinterCfg = (printerCfg != null) ? printerCfg.CreateDbEntity().Parameters : string.Empty;
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Updates component factory
|
||||
/// </summary>
|
||||
/// <param name="className">Component class name</param>
|
||||
/// <param name="factory">Reference to a factory</param>
|
||||
/// <returns>true when factory changed</returns>
|
||||
IComponentFactory GetFactory(string className)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(className))
|
||||
{
|
||||
foreach (var fac in TbfComponents.Factories)
|
||||
{
|
||||
if (fac.ClassName == className) return fac;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
+97
-113
@@ -28,118 +28,103 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.statisticsListView = new System.Windows.Forms.ListView();
|
||||
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
|
||||
this.printButton = new System.Windows.Forms.Button();
|
||||
this.closeButton = new System.Windows.Forms.Button();
|
||||
this.exportButton = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
this.splitContainer1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
|
||||
this.splitContainer2.Panel2.SuspendLayout();
|
||||
this.splitContainer2.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// splitContainer1
|
||||
//
|
||||
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
|
||||
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
|
||||
this.splitContainer1.Name = "splitContainer1";
|
||||
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
//
|
||||
// splitContainer1.Panel1
|
||||
//
|
||||
this.splitContainer1.Panel1.Controls.Add(this.statisticsListView);
|
||||
//
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(572, 409);
|
||||
this.splitContainer1.SplitterDistance = 320;
|
||||
this.splitContainer1.TabIndex = 0;
|
||||
//
|
||||
// statisticsListView
|
||||
//
|
||||
this.statisticsListView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.statisticsListView.GridLines = true;
|
||||
this.statisticsListView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
|
||||
this.statisticsListView.Location = new System.Drawing.Point(0, 0);
|
||||
this.statisticsListView.Name = "statisticsListView";
|
||||
this.statisticsListView.Size = new System.Drawing.Size(572, 320);
|
||||
this.statisticsListView.TabIndex = 0;
|
||||
this.statisticsListView.UseCompatibleStateImageBehavior = false;
|
||||
//
|
||||
// splitContainer2
|
||||
//
|
||||
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
|
||||
this.splitContainer2.Location = new System.Drawing.Point(0, 0);
|
||||
this.splitContainer2.Name = "splitContainer2";
|
||||
//
|
||||
// splitContainer2.Panel2
|
||||
//
|
||||
this.splitContainer2.Panel2.Controls.Add(this.exportButton);
|
||||
this.splitContainer2.Panel2.Controls.Add(this.printButton);
|
||||
this.splitContainer2.Panel2.Controls.Add(this.closeButton);
|
||||
this.splitContainer2.Size = new System.Drawing.Size(572, 85);
|
||||
this.splitContainer2.SplitterDistance = 249;
|
||||
this.splitContainer2.TabIndex = 0;
|
||||
//
|
||||
// printButton
|
||||
//
|
||||
this.printButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.printButton.Location = new System.Drawing.Point(4, 21);
|
||||
this.printButton.Name = "printButton";
|
||||
this.printButton.Size = new System.Drawing.Size(94, 41);
|
||||
this.printButton.TabIndex = 0;
|
||||
this.printButton.Text = "Print";
|
||||
this.printButton.UseVisualStyleBackColor = true;
|
||||
this.printButton.Click += new System.EventHandler(this.printButton_Click);
|
||||
//
|
||||
// closeButton
|
||||
//
|
||||
this.closeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.closeButton.Location = new System.Drawing.Point(203, 21);
|
||||
this.closeButton.Name = "closeButton";
|
||||
this.closeButton.Size = new System.Drawing.Size(94, 41);
|
||||
this.closeButton.TabIndex = 2;
|
||||
this.closeButton.Text = "Close";
|
||||
this.closeButton.UseVisualStyleBackColor = true;
|
||||
this.closeButton.Click += new System.EventHandler(this.closeButton_Click);
|
||||
//
|
||||
// exportButton
|
||||
//
|
||||
this.exportButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.exportButton.Location = new System.Drawing.Point(103, 21);
|
||||
this.exportButton.Name = "exportButton";
|
||||
this.exportButton.Size = new System.Drawing.Size(94, 41);
|
||||
this.exportButton.TabIndex = 1;
|
||||
this.exportButton.Text = "Export";
|
||||
this.exportButton.UseVisualStyleBackColor = true;
|
||||
this.exportButton.Click += new System.EventHandler(this.exportButton_Click);
|
||||
//
|
||||
// StatisticsDlg
|
||||
//
|
||||
this.AcceptButton = this.closeButton;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(572, 409);
|
||||
this.Controls.Add(this.splitContainer1);
|
||||
this.Name = "StatisticsDlg";
|
||||
this.Text = "StatisticsDlg";
|
||||
this.Load += new System.EventHandler(this.StatisticsDlg_Load);
|
||||
this.splitContainer1.Panel1.ResumeLayout(false);
|
||||
this.splitContainer1.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
|
||||
this.splitContainer1.ResumeLayout(false);
|
||||
this.splitContainer2.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
|
||||
this.splitContainer2.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.statisticsListView = new System.Windows.Forms.ListView();
|
||||
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
|
||||
this.printButton = new System.Windows.Forms.Button();
|
||||
this.closeButton = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
this.splitContainer1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
|
||||
this.splitContainer2.Panel2.SuspendLayout();
|
||||
this.splitContainer2.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// splitContainer1
|
||||
//
|
||||
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
|
||||
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
|
||||
this.splitContainer1.Name = "splitContainer1";
|
||||
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
//
|
||||
// splitContainer1.Panel1
|
||||
//
|
||||
this.splitContainer1.Panel1.Controls.Add(this.statisticsListView);
|
||||
//
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(572, 409);
|
||||
this.splitContainer1.SplitterDistance = 320;
|
||||
this.splitContainer1.TabIndex = 0;
|
||||
//
|
||||
// statisticsListView
|
||||
//
|
||||
this.statisticsListView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.statisticsListView.GridLines = true;
|
||||
this.statisticsListView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
|
||||
this.statisticsListView.Location = new System.Drawing.Point(0, 0);
|
||||
this.statisticsListView.Name = "statisticsListView";
|
||||
this.statisticsListView.Size = new System.Drawing.Size(572, 320);
|
||||
this.statisticsListView.TabIndex = 0;
|
||||
this.statisticsListView.UseCompatibleStateImageBehavior = false;
|
||||
//
|
||||
// splitContainer2
|
||||
//
|
||||
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
|
||||
this.splitContainer2.Location = new System.Drawing.Point(0, 0);
|
||||
this.splitContainer2.Name = "splitContainer2";
|
||||
//
|
||||
// splitContainer2.Panel2
|
||||
//
|
||||
this.splitContainer2.Panel2.Controls.Add(this.printButton);
|
||||
this.splitContainer2.Panel2.Controls.Add(this.closeButton);
|
||||
this.splitContainer2.Size = new System.Drawing.Size(572, 85);
|
||||
this.splitContainer2.SplitterDistance = 249;
|
||||
this.splitContainer2.TabIndex = 0;
|
||||
//
|
||||
// printButton
|
||||
//
|
||||
this.printButton.Location = new System.Drawing.Point(38, 22);
|
||||
this.printButton.Name = "printButton";
|
||||
this.printButton.Size = new System.Drawing.Size(108, 41);
|
||||
this.printButton.TabIndex = 0;
|
||||
this.printButton.Text = "Print";
|
||||
this.printButton.UseVisualStyleBackColor = true;
|
||||
this.printButton.Click += new System.EventHandler(this.printButton_Click);
|
||||
//
|
||||
// closeButton
|
||||
//
|
||||
this.closeButton.Location = new System.Drawing.Point(176, 22);
|
||||
this.closeButton.Name = "closeButton";
|
||||
this.closeButton.Size = new System.Drawing.Size(108, 41);
|
||||
this.closeButton.TabIndex = 1;
|
||||
this.closeButton.Text = "Close";
|
||||
this.closeButton.UseVisualStyleBackColor = true;
|
||||
this.closeButton.Click += new System.EventHandler(this.closeButton_Click);
|
||||
//
|
||||
// StatisticsDlg
|
||||
//
|
||||
this.AcceptButton = this.closeButton;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(572, 409);
|
||||
this.Controls.Add(this.splitContainer1);
|
||||
this.Name = "StatisticsDlg";
|
||||
this.Text = "StatisticsDlg";
|
||||
this.Load += new System.EventHandler(this.StatisticsDlg_Load);
|
||||
this.splitContainer1.Panel1.ResumeLayout(false);
|
||||
this.splitContainer1.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
|
||||
this.splitContainer1.ResumeLayout(false);
|
||||
this.splitContainer2.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
|
||||
this.splitContainer2.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
@@ -150,6 +135,5 @@
|
||||
private System.Windows.Forms.SplitContainer splitContainer2;
|
||||
private System.Windows.Forms.Button closeButton;
|
||||
private System.Windows.Forms.Button printButton;
|
||||
private System.Windows.Forms.Button exportButton;
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,6 @@ using System.Windows.Forms;
|
||||
using Results.Entities;
|
||||
using ResultsBrowser.Resources;
|
||||
using ResultsBrowser.Output.Printers.Statistics;
|
||||
using System.IO;
|
||||
|
||||
namespace ResultsBrowser.Forms
|
||||
{
|
||||
@@ -218,55 +217,5 @@ namespace ResultsBrowser.Forms
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void exportButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (rowValues == null || columnValues == null || occurances == null) return;
|
||||
|
||||
SaveFileDialog dlg = new SaveFileDialog();
|
||||
dlg.Filter = "CSV files (*.csv)|*.csv|All files (*.*)|*.*";
|
||||
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
//IList<MonitoringDB.ItemSpec> items = currentQR.ProjectedItems;
|
||||
|
||||
try
|
||||
{
|
||||
using (TextWriter writer = new StreamWriter(dlg.FileName, false, System.Text.Encoding.UTF8))
|
||||
{
|
||||
if (twoDim)
|
||||
{
|
||||
/// Write column headers
|
||||
for (int i = 0; i < columnValues.Count; i++)
|
||||
{
|
||||
writer.Write(string.Format(";\"{0}\"", columnValues[i]));
|
||||
}
|
||||
writer.WriteLine();
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteLine(string.Format("\"{0}\";\"{1}\"", rowItem.Caption, Strings.Count));
|
||||
}
|
||||
|
||||
int nrColumns = Math.Max(1, columnValues.Count);
|
||||
|
||||
/// Write rows, row header first
|
||||
for (int j = 0; j < rowValues.Count; j++)
|
||||
{
|
||||
writer.Write(string.Format("\"{0}\"", rowValues[j]));
|
||||
for (int i = 0; i < nrColumns; i++)
|
||||
{
|
||||
writer.Write(string.Format(";{0}", occurances[j,i]));
|
||||
}
|
||||
writer.WriteLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
MessageBox.Show(exc.Message, Strings.Error_exporting_results, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,386 @@
|
||||
///
|
||||
/// Copyright (c) 2016 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Printing;
|
||||
using Config.Entities;
|
||||
|
||||
namespace ResultsBrowser.Output.Printers.QueryResults
|
||||
{
|
||||
public class QueryResultsPrintDocument : PrintDocument
|
||||
{
|
||||
const string FontFamilyName = "Arial"; //"Times New Roman";
|
||||
|
||||
const int SpacingOne = 18;
|
||||
const int SpacingOneAndHalf = (3 * SpacingOne) / 2;
|
||||
const int TitleX = 240;
|
||||
const int TitleY = 180; /// Depends on the size of the header
|
||||
const int FirstLineNr = 14; /// Depends on the size of the header
|
||||
const int Tab1 = 80; /// Positions of columns above the table
|
||||
const int Tab2 = 240;
|
||||
const int Tab3 = 430;
|
||||
const int Tab4 = 590;
|
||||
const int BorderW = 1; /// Table border line width
|
||||
const int MarginTop = 7; /// Margins of the text from table lines
|
||||
const int MarginLeft = 4; /// Margins of the text from table lines
|
||||
|
||||
///
|
||||
/// Data to print
|
||||
///
|
||||
readonly string docVersion;
|
||||
readonly Results.Entities.WaterMeter wm;
|
||||
string zaehlertyp;
|
||||
string pruefvorlage;
|
||||
|
||||
readonly IList<Results.Entities.MeterTestRslt> results;
|
||||
readonly int resultsCount;
|
||||
readonly bool compound; /// true when MetersKind is MetersKind.Combined
|
||||
|
||||
readonly int secondTableOffset; /// Calculated in the constructor
|
||||
|
||||
/// Top coordinate of the table
|
||||
int top;
|
||||
|
||||
/// <summary>
|
||||
/// Property variable for the Font the user wishes to use
|
||||
/// </summary>
|
||||
Font font;
|
||||
Font boldFont;
|
||||
Font fontTitle;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="textToPrint">Text to be printed</param>
|
||||
public QueryResultsPrintDocument(string docVersion,
|
||||
Results.Entities.WaterMeter wm,
|
||||
PageOrientation pageOrientation)
|
||||
{
|
||||
this.docVersion = docVersion;
|
||||
this.wm = wm;
|
||||
compound = wm.Compound();
|
||||
|
||||
string[] info = wm.ProductName().Split(new char[] { ';' });
|
||||
if (info.Length >= 2)
|
||||
{
|
||||
pruefvorlage = info[0];
|
||||
zaehlertyp = info[1];
|
||||
}
|
||||
else if (info.Length == 1)
|
||||
{
|
||||
pruefvorlage = info[0];
|
||||
zaehlertyp = compound ? "Verbundzähler" : "Einzelzähler";
|
||||
}
|
||||
else
|
||||
{
|
||||
pruefvorlage = wm.ProcedureName();
|
||||
zaehlertyp = compound ? "Verbundzähler" : "Einzelzähler";
|
||||
}
|
||||
|
||||
results = wm.MeterTestRslts;
|
||||
this.resultsCount = compound ? (results.Count / 3) : results.Count;
|
||||
|
||||
int resultsCount = wm.MeterTestRslts.Count;
|
||||
if (compound) resultsCount /= 3;
|
||||
|
||||
secondTableOffset = (resultsCount + 2) * SpacingOneAndHalf;
|
||||
|
||||
DefaultPageSettings.Landscape = (pageOrientation == PageOrientation.Landscape);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override the default onbeginPrint method of the PrintDocument Object.
|
||||
/// </summary>
|
||||
/// <param name=e></param>
|
||||
/// <remarks></remarks>
|
||||
protected override void OnBeginPrint(System.Drawing.Printing.PrintEventArgs e)
|
||||
{
|
||||
base.OnBeginPrint(e);
|
||||
|
||||
if (font == null) { font = new Font(FontFamilyName, 10, FontStyle.Regular); }
|
||||
if (boldFont == null) { boldFont = new Font(FontFamilyName, 10, FontStyle.Bold); }
|
||||
if (fontTitle == null) { fontTitle = new Font(FontFamilyName, 24, FontStyle.Bold); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override the default OnPrintPage method of the PrintDocument.
|
||||
/// </summary>
|
||||
/// <param name=e></param>
|
||||
/// <remarks>This provides the print logic for our document</remarks>
|
||||
protected override void OnPrintPage(System.Drawing.Printing.PrintPageEventArgs e)
|
||||
{
|
||||
// Run base code
|
||||
base.OnPrintPage(e);
|
||||
|
||||
/// Set print area size and margins (in dots using 80 dpi)
|
||||
int printHeight = base.DefaultPageSettings.PaperSize.Height - base.DefaultPageSettings.Margins.Top - base.DefaultPageSettings.Margins.Bottom;
|
||||
int printWidth = base.DefaultPageSettings.PaperSize.Width - base.DefaultPageSettings.Margins.Left - base.DefaultPageSettings.Margins.Right;
|
||||
int leftMargin = base.DefaultPageSettings.Margins.Left; /// X
|
||||
int topMargin = base.DefaultPageSettings.Margins.Top; /// Y
|
||||
|
||||
/// Check if the user selected to print in Landscape mode
|
||||
/// if they did then we need to swap height/width parameters
|
||||
if (base.DefaultPageSettings.Landscape)
|
||||
{
|
||||
int tmp = printHeight;
|
||||
printHeight = printWidth;
|
||||
printWidth = tmp;
|
||||
}
|
||||
|
||||
int x = leftMargin;
|
||||
int y = topMargin;
|
||||
|
||||
/// Use the StringFormat class for the text layout of our document
|
||||
StringFormat format = new StringFormat(StringFormatFlags.LineLimit);
|
||||
|
||||
RectangleF printArea = new RectangleF(TitleX, TitleY, 667, 50);
|
||||
e.Graphics.DrawString(wm.Batch.ProtocolTitle, this.fontTitle, Brushes.Black, printArea);
|
||||
|
||||
int lineNr = FirstLineNr;
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, docVersion);
|
||||
lineNr++;
|
||||
PrintBoldAt(e, Tab1, lineNr * SpacingOne, "Prüfstand Nr :");
|
||||
PrintBoldAt(e, Tab2, lineNr * SpacingOne, wm.BenchId().ToString());
|
||||
PrintBoldAt(e, Tab3, lineNr * SpacingOne, "Datum :");
|
||||
PrintBoldAt(e, Tab4, lineNr * SpacingOne, wm.Batch.EndTime.Date.ToString("d"));
|
||||
lineNr++;
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Zählertyp :");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, zaehlertyp);
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, "Eichjahr :");
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, wm.YearOfProduction.ToString());
|
||||
lineNr++;
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Prüfvorlage :");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, pruefvorlage);
|
||||
lineNr += 2;
|
||||
|
||||
if (compound)
|
||||
{
|
||||
PrintBoldAt(e, Tab1, lineNr * SpacingOne, "Hauptzahler");
|
||||
PrintBoldAt(e, Tab3, lineNr * SpacingOne, "Nebenzahler");
|
||||
lineNr++;
|
||||
}
|
||||
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Hersteller :");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, wm.Producer());
|
||||
if (compound)
|
||||
{
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, "Hersteller :");
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, wm.ProducerAux());
|
||||
}
|
||||
lineNr++;
|
||||
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Seriennummer :");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, wm.SerialNr);
|
||||
if (compound)
|
||||
{
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, "Seriennummer :");
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, wm.SerialNrAux);
|
||||
}
|
||||
lineNr++;
|
||||
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Qn :");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, wm.Q3_Qn().ToString());
|
||||
if (compound)
|
||||
{
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, "Qn :");
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, wm.Q3_Qn_Aux().ToString());
|
||||
}
|
||||
lineNr++;
|
||||
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Zulassungszeichen :");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, wm.ApprovalInfo());
|
||||
if (compound)
|
||||
{
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, "Zulassungszeichen :");
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, wm.ApprovalInfoAux());
|
||||
}
|
||||
lineNr++;
|
||||
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Metr. klasse :");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, wm.MetrologicalClass());
|
||||
if (compound)
|
||||
{
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, "Metr. klasse :");
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, wm.MetrologicalClassAux());
|
||||
}
|
||||
lineNr++;
|
||||
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Stand :");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, wm.EndState);
|
||||
if (compound)
|
||||
{
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, "Stand :");
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, wm.EndStateAux);
|
||||
|
||||
lineNr += 2;
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Umschaltpunkte :");
|
||||
lineNr++;
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Qsteig");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, (1000.0 * wm.QRise).ToString("F1") + " l/h");
|
||||
lineNr++;
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Qfall");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, (1000.0 * wm.QFall).ToString("F1") + " l/h");
|
||||
}
|
||||
|
||||
lineNr += 2;
|
||||
top = SpacingOne * lineNr;
|
||||
|
||||
PrintTable(e);
|
||||
DrawTable(e);
|
||||
|
||||
lineNr += (secondTableOffset * 2) / SpacingOne;
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Temperatur");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, wm.Batch.AmbTempMean().ToString("F1") + " \x00b0C");
|
||||
lineNr++;
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Feuchtigkeit");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, wm.Batch.AmbHumiMean().ToString("F0") + " %");
|
||||
lineNr++;
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Luftdruck");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, wm.Batch.AmbPressMean().ToString("F0") + " mbar");
|
||||
|
||||
lineNr++;
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, wm.Batch.EndTime.Date.ToString("d"));
|
||||
lineNr ++;
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, "Datum");
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, "Unterschrift");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print table texts.
|
||||
/// </summary>
|
||||
void PrintTable(System.Drawing.Printing.PrintPageEventArgs e)
|
||||
{
|
||||
PrintAt(e, FromTest(-1, -1), "Prüflauf");
|
||||
PrintAt(e, FromTest(-1, 0), "Q [l/h]");
|
||||
PrintAt(e, FromTest(-1, 1), "Prüf-Vol.[l]");
|
||||
PrintAt(e, FromTest(-1, 2), compound ? "HZ-Vol.[l]" : "Z-Vol.[l]");
|
||||
PrintAt(e, FromTest(-1, 3), compound ? "NZ-Vol.[l]" : "-");
|
||||
PrintAt(e, FromTest(-1, 4), "Fehler [%]");
|
||||
PrintAt(e, FromTest(-1, 5), "Ergebnis");
|
||||
|
||||
PrintAt(e, FromTest(-1, 6), "Q [l/h]");
|
||||
PrintAt(e, FromTest(-1, 7), "Temperatur");
|
||||
PrintAt(e, FromTest(-1, 8), "Dichte");
|
||||
PrintAt(e, FromTest(-1, 9), "Prüfzeit");
|
||||
PrintAt(e, FromTest(-1, 10), "Druck Eing.");
|
||||
PrintAt(e, FromTest(-1, 11), "Druck Ausg.");
|
||||
|
||||
int rowCnt = 0;
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
{
|
||||
if (!compound || mtr.CompoundMeterId == (byte)CompoundMeterId.Compound)
|
||||
{
|
||||
Point p = FromTest(rowCnt, -1);
|
||||
PrintAt(e, p.X, p.Y, mtr.Name());
|
||||
PrintAt(e, p.X, p.Y + (resultsCount + 2) * SpacingOneAndHalf, mtr.Name());
|
||||
|
||||
PrintAt(e, FromTest(rowCnt, 0), mtr.TestRslt.FlowMass.ToString("F1"));
|
||||
PrintAt(e, FromTest(rowCnt, 1), mtr.TestRslt.VolumeCTV.ToString("F2"));
|
||||
if (compound)
|
||||
{
|
||||
Results.Entities.MeterTestRslt mainMtr = wm.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundMain);
|
||||
Results.Entities.MeterTestRslt auxMtr = wm.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundAux);
|
||||
|
||||
PrintAt(e, FromTest(rowCnt, 2), mainMtr.VolumeMeter.ToString("F2"));
|
||||
PrintAt(e, FromTest(rowCnt, 3), auxMtr.VolumeMeter.ToString("F2"));
|
||||
PrintAt(e, FromTest(rowCnt, 4), mtr.Error.ToString("F2"));
|
||||
PrintAt(e, FromTest(rowCnt, 5), mtr.Passed ? "iO" : "NiO");
|
||||
}
|
||||
else
|
||||
{
|
||||
PrintAt(e, FromTest(rowCnt, 2), mtr.VolumeMeter.ToString("F2"));
|
||||
PrintAt(e, FromTest(rowCnt, 3), "-");
|
||||
PrintAt(e, FromTest(rowCnt, 4), mtr.Error.ToString("F2"));
|
||||
PrintAt(e, FromTest(rowCnt, 5), mtr.Passed ? "iO" : "NiO");
|
||||
}
|
||||
PrintAt(e, FromTest(rowCnt, 6), mtr.TestRslt.FlowMass.ToString("F1"));
|
||||
PrintAt(e, FromTest(rowCnt, 7), mtr.TestRslt.TempDownMean.ToString("F2"));
|
||||
PrintAt(e, FromTest(rowCnt, 8), mtr.TestRslt.DensityDiv.ToString("F2"));
|
||||
PrintAt(e, FromTest(rowCnt, 9), mtr.TestTime.ToString("F1"));
|
||||
PrintAt(e, FromTest(rowCnt, 10), Config.Units.ConvertTo(Config.Unit.bar, mtr.TestRslt.PressUpMean).ToString("F3"));
|
||||
PrintAt(e, FromTest(rowCnt, 11), Config.Units.ConvertTo(Config.Unit.bar, mtr.TestRslt.PressDownMean).ToString("F3"));
|
||||
|
||||
rowCnt++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draw table lines.
|
||||
/// </summary>
|
||||
void DrawTable(System.Drawing.Printing.PrintPageEventArgs e)
|
||||
{
|
||||
int mid = top + SpacingOneAndHalf;
|
||||
int bot = top + (resultsCount + 1) * SpacingOneAndHalf;
|
||||
|
||||
int top2 = top + secondTableOffset;
|
||||
int mid2 = mid + secondTableOffset;
|
||||
int bot2 = bot + secondTableOffset;
|
||||
|
||||
// Horizontal lines
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(80, top), new Point(747, top));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(80, mid), new Point(747, mid));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(80, bot), new Point(747, bot));
|
||||
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(80, top2), new Point(747, top2));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(80, mid2), new Point(747, mid2));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(80, bot2), new Point(747, bot2));
|
||||
|
||||
// Vertical lines
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point( 80, top), new Point( 80, bot));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(267, top), new Point(267, bot));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(347, top), new Point(347, bot));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(427, top), new Point(427, bot));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(507, top), new Point(507, bot));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(587, top), new Point(587, bot));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(667, top), new Point(667, bot));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(747, top), new Point(747, bot));
|
||||
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point( 80, top2), new Point( 80, bot2));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(267, top2), new Point(267, bot2));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(347, top2), new Point(347, bot2));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(427, top2), new Point(427, bot2));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(507, top2), new Point(507, bot2));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(587, top2), new Point(587, bot2));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(667, top2), new Point(667, bot2));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(747, top2), new Point(747, bot2));
|
||||
}
|
||||
|
||||
void PrintAt(System.Drawing.Printing.PrintPageEventArgs e, Point p, string text)
|
||||
{
|
||||
PrintAt(e, p.X, p.Y, text);
|
||||
}
|
||||
|
||||
void PrintAt(System.Drawing.Printing.PrintPageEventArgs e, int x, int y, string text)
|
||||
{
|
||||
RectangleF printArea = new RectangleF(x, y, 667, SpacingOne);
|
||||
e.Graphics.DrawString(text, this.font, Brushes.Black, printArea);
|
||||
}
|
||||
|
||||
void PrintBoldAt(System.Drawing.Printing.PrintPageEventArgs e, Point p, string text)
|
||||
{
|
||||
PrintBoldAt(e, p.X, p.Y, text);
|
||||
}
|
||||
|
||||
void PrintBoldAt(System.Drawing.Printing.PrintPageEventArgs e, int x, int y, string text)
|
||||
{
|
||||
RectangleF printArea = new RectangleF(x, y, 667, SpacingOne);
|
||||
e.Graphics.DrawString(text, this.boldFont, Brushes.Black, printArea);
|
||||
}
|
||||
|
||||
Point FromTest(int testNr, int parNr)
|
||||
{
|
||||
const int NrParamsInOneTableRow = 6;
|
||||
|
||||
int x = 267 + (parNr % NrParamsInOneTableRow) * 80 + MarginLeft;
|
||||
int y = top + SpacingOneAndHalf + MarginTop + testNr * SpacingOneAndHalf
|
||||
+ ((parNr >= NrParamsInOneTableRow) ? secondTableOffset : 0);
|
||||
|
||||
if (parNr < 0) x = 80 + MarginLeft; /// When parNr == -1 return the left column x coordinate
|
||||
|
||||
return new Point(x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Sensus")]
|
||||
[assembly: AssemblyProduct("ResultsBrowser")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015 - 2018 Sensus Slovensko a.s.")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015 - 2017 Sensus Slovensko a.s.")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
@@ -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.18.856.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.856.0")]
|
||||
[assembly: AssemblyVersion("2.18.796.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.796.0")]
|
||||
|
||||
@@ -637,7 +637,7 @@
|
||||
<value>zimna</value>
|
||||
</data>
|
||||
<data name="hot" xml:space="preserve">
|
||||
<value>ciepła</value>
|
||||
<value>gorąca</value>
|
||||
</data>
|
||||
<data name="Product_name" xml:space="preserve">
|
||||
<value>Nazwa produktu</value>
|
||||
|
||||
@@ -706,7 +706,7 @@
|
||||
<value>Filters</value>
|
||||
</data>
|
||||
<data name="Format_of_results" xml:space="preserve">
|
||||
<value>Configure output</value>
|
||||
<value>Format of results</value>
|
||||
</data>
|
||||
<data name="Load_filters" xml:space="preserve">
|
||||
<value>Load filters</value>
|
||||
@@ -810,19 +810,4 @@
|
||||
<data name="Print" xml:space="preserve">
|
||||
<value>Print</value>
|
||||
</data>
|
||||
<data name="Configure_printer" xml:space="preserve">
|
||||
<value>Configure printer</value>
|
||||
</data>
|
||||
<data name="No_printer_defined" xml:space="preserve">
|
||||
<value>No printer defined</value>
|
||||
</data>
|
||||
<data name="Printing_failed" xml:space="preserve">
|
||||
<value>Printing failed</value>
|
||||
</data>
|
||||
<data name="Printing_completed" xml:space="preserve">
|
||||
<value>Printing completed</value>
|
||||
</data>
|
||||
<data name="Error_exporting_results" xml:space="preserve">
|
||||
<value>Error exporting results</value>
|
||||
</data>
|
||||
</root>
|
||||
+1
-46
@@ -555,15 +555,6 @@ namespace ResultsBrowser.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Configure printer.
|
||||
/// </summary>
|
||||
internal static string Configure_printer {
|
||||
get {
|
||||
return ResourceManager.GetString("Configure_printer", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Configure test benches (password required).
|
||||
/// </summary>
|
||||
@@ -1014,15 +1005,6 @@ namespace ResultsBrowser.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Error exporting results.
|
||||
/// </summary>
|
||||
internal static string Error_exporting_results {
|
||||
get {
|
||||
return ResourceManager.GetString("Error_exporting_results", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Error loading users from the database:.
|
||||
/// </summary>
|
||||
@@ -1204,7 +1186,7 @@ namespace ResultsBrowser.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Configure output.
|
||||
/// Looks up a localized string similar to Format of results.
|
||||
/// </summary>
|
||||
internal static string Format_of_results {
|
||||
get {
|
||||
@@ -1653,15 +1635,6 @@ namespace ResultsBrowser.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to No printer defined.
|
||||
/// </summary>
|
||||
internal static string No_printer_defined {
|
||||
get {
|
||||
return ResourceManager.GetString("No_printer_defined", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to No program settings found. .
|
||||
/// </summary>
|
||||
@@ -1788,24 +1761,6 @@ namespace ResultsBrowser.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Printing completed.
|
||||
/// </summary>
|
||||
internal static string Printing_completed {
|
||||
get {
|
||||
return ResourceManager.GetString("Printing_completed", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Printing failed.
|
||||
/// </summary>
|
||||
internal static string Printing_failed {
|
||||
get {
|
||||
return ResourceManager.GetString("Printing_failed", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Procedure.
|
||||
/// </summary>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;SENTEC</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;GENESIS;IPERL;LANG_DE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
@@ -31,7 +31,7 @@
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;SENTEC</DefineConstants>
|
||||
<DefineConstants>TRACE;GENESIS;IPERL;LANG_DE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
@@ -125,12 +125,6 @@
|
||||
<Compile Include="Forms\NoBenchOrDatabaseDlg.designer.cs">
|
||||
<DependentUpon>NoBenchOrDatabaseDlg.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\PrinterConfigDlg.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\PrinterConfigDlg.Designer.cs">
|
||||
<DependentUpon>PrinterConfigDlg.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\StatisticsDlg.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -144,6 +138,9 @@
|
||||
<DependentUpon>StatisticsOptionsDlg.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="LocalSettings.cs" />
|
||||
<Compile Include="Output\Printers\QueryResults\QueryResultsPrintDocument.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Output\Printers\Statistics\StatisticsPrintDocument.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
@@ -185,9 +182,6 @@
|
||||
<EmbeddedResource Include="Forms\NoBenchOrDatabaseDlg.resx">
|
||||
<DependentUpon>NoBenchOrDatabaseDlg.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\PrinterConfigDlg.resx">
|
||||
<DependentUpon>PrinterConfigDlg.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\StatisticsDlg.resx">
|
||||
<DependentUpon>StatisticsDlg.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
@@ -207,17 +201,12 @@
|
||||
<EmbeddedResource Include="Resources\Strings.cs.resx" />
|
||||
<EmbeddedResource Include="Resources\Strings.de.resx" />
|
||||
<EmbeddedResource Include="Resources\Strings.it.resx" />
|
||||
<EmbeddedResource Include="Resources\Strings.pl.resx">
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Resources\Strings.pl.resx" />
|
||||
<EmbeddedResource Include="Resources\Strings.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Strings1.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Resources\Strings.ru.resx">
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Resources\Strings.ru.resx" />
|
||||
<EmbeddedResource Include="ResultsBrowserWnd.resx">
|
||||
<DependentUpon>ResultsBrowserWnd.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
@@ -241,10 +230,6 @@
|
||||
<Project>{9D0DCC88-DC81-47EB-9FDD-4C3907871BFB}</Project>
|
||||
<Name>Results</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\TBF\TBF.csproj">
|
||||
<Project>{8648FD92-CDA1-4C3A-B5F9-FE547CE1FA48}</Project>
|
||||
<Name>TBF</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Users\Users.csproj">
|
||||
<Project>{6E5CB0E9-E1B6-4E5D-AC6E-B1049E180F2B}</Project>
|
||||
<Name>Users</Name>
|
||||
|
||||
+319
-332
@@ -28,337 +28,325 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.vSplitContainer = new System.Windows.Forms.SplitContainer();
|
||||
this.hSplitContainer = new System.Windows.Forms.SplitContainer();
|
||||
this.filtersGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.filtersFlowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.resultsGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.resultsListView = new System.Windows.Forms.ListView();
|
||||
this.printerConfigBtn = new System.Windows.Forms.Button();
|
||||
this.statisticsBtn = new System.Windows.Forms.Button();
|
||||
this.printQueryResultsBtn = new System.Windows.Forms.Button();
|
||||
this.exportQueryResultsBtn = new System.Windows.Forms.Button();
|
||||
this.formatOfResultsBtn = new System.Windows.Forms.Button();
|
||||
this.clearFiltersBtn = new System.Windows.Forms.Button();
|
||||
this.settingsBtn = new System.Windows.Forms.Button();
|
||||
this.saveConfigBtn = new System.Windows.Forms.Button();
|
||||
this.loadConfigBtn = new System.Windows.Forms.Button();
|
||||
this.executeQueryBtn = new System.Windows.Forms.Button();
|
||||
this.addFilterBtn = new System.Windows.Forms.Button();
|
||||
this.testBenchesGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.checkBox5 = new System.Windows.Forms.RadioButton();
|
||||
this.checkBox4 = new System.Windows.Forms.RadioButton();
|
||||
this.checkBox3 = new System.Windows.Forms.RadioButton();
|
||||
this.checkBox2 = new System.Windows.Forms.RadioButton();
|
||||
this.checkBox1 = new System.Windows.Forms.RadioButton();
|
||||
((System.ComponentModel.ISupportInitialize)(this.vSplitContainer)).BeginInit();
|
||||
this.vSplitContainer.Panel1.SuspendLayout();
|
||||
this.vSplitContainer.Panel2.SuspendLayout();
|
||||
this.vSplitContainer.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.hSplitContainer)).BeginInit();
|
||||
this.hSplitContainer.Panel1.SuspendLayout();
|
||||
this.hSplitContainer.Panel2.SuspendLayout();
|
||||
this.hSplitContainer.SuspendLayout();
|
||||
this.filtersGroupBox.SuspendLayout();
|
||||
this.resultsGroupBox.SuspendLayout();
|
||||
this.testBenchesGroupBox.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// vSplitContainer
|
||||
//
|
||||
this.vSplitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.vSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
|
||||
this.vSplitContainer.Location = new System.Drawing.Point(0, 0);
|
||||
this.vSplitContainer.Name = "vSplitContainer";
|
||||
//
|
||||
// vSplitContainer.Panel1
|
||||
//
|
||||
this.vSplitContainer.Panel1.Controls.Add(this.hSplitContainer);
|
||||
this.vSplitContainer.Panel1MinSize = 100;
|
||||
//
|
||||
// vSplitContainer.Panel2
|
||||
//
|
||||
this.vSplitContainer.Panel2.Controls.Add(this.printerConfigBtn);
|
||||
this.vSplitContainer.Panel2.Controls.Add(this.statisticsBtn);
|
||||
this.vSplitContainer.Panel2.Controls.Add(this.printQueryResultsBtn);
|
||||
this.vSplitContainer.Panel2.Controls.Add(this.exportQueryResultsBtn);
|
||||
this.vSplitContainer.Panel2.Controls.Add(this.formatOfResultsBtn);
|
||||
this.vSplitContainer.Panel2.Controls.Add(this.clearFiltersBtn);
|
||||
this.vSplitContainer.Panel2.Controls.Add(this.settingsBtn);
|
||||
this.vSplitContainer.Panel2.Controls.Add(this.saveConfigBtn);
|
||||
this.vSplitContainer.Panel2.Controls.Add(this.loadConfigBtn);
|
||||
this.vSplitContainer.Panel2.Controls.Add(this.executeQueryBtn);
|
||||
this.vSplitContainer.Panel2.Controls.Add(this.addFilterBtn);
|
||||
this.vSplitContainer.Panel2.Controls.Add(this.testBenchesGroupBox);
|
||||
this.vSplitContainer.Panel2MinSize = 100;
|
||||
this.vSplitContainer.Size = new System.Drawing.Size(984, 712);
|
||||
this.vSplitContainer.SplitterDistance = 840;
|
||||
this.vSplitContainer.TabIndex = 0;
|
||||
//
|
||||
// hSplitContainer
|
||||
//
|
||||
this.hSplitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.hSplitContainer.Location = new System.Drawing.Point(0, 0);
|
||||
this.hSplitContainer.Name = "hSplitContainer";
|
||||
this.hSplitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
//
|
||||
// hSplitContainer.Panel1
|
||||
//
|
||||
this.hSplitContainer.Panel1.Controls.Add(this.filtersGroupBox);
|
||||
//
|
||||
// hSplitContainer.Panel2
|
||||
//
|
||||
this.hSplitContainer.Panel2.Controls.Add(this.resultsGroupBox);
|
||||
this.hSplitContainer.Size = new System.Drawing.Size(840, 712);
|
||||
this.hSplitContainer.SplitterDistance = 280;
|
||||
this.hSplitContainer.TabIndex = 0;
|
||||
//
|
||||
// filtersGroupBox
|
||||
//
|
||||
this.filtersGroupBox.Controls.Add(this.filtersFlowLayoutPanel);
|
||||
this.filtersGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.filtersGroupBox.Location = new System.Drawing.Point(0, 0);
|
||||
this.filtersGroupBox.Name = "filtersGroupBox";
|
||||
this.filtersGroupBox.Size = new System.Drawing.Size(840, 280);
|
||||
this.filtersGroupBox.TabIndex = 1;
|
||||
this.filtersGroupBox.TabStop = false;
|
||||
this.filtersGroupBox.Text = "Filters";
|
||||
//
|
||||
// filtersFlowLayoutPanel
|
||||
//
|
||||
this.filtersFlowLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.filtersFlowLayoutPanel.Location = new System.Drawing.Point(3, 16);
|
||||
this.filtersFlowLayoutPanel.Name = "filtersFlowLayoutPanel";
|
||||
this.filtersFlowLayoutPanel.Size = new System.Drawing.Size(834, 261);
|
||||
this.filtersFlowLayoutPanel.TabIndex = 0;
|
||||
//
|
||||
// resultsGroupBox
|
||||
//
|
||||
this.resultsGroupBox.Controls.Add(this.resultsListView);
|
||||
this.resultsGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.resultsGroupBox.Location = new System.Drawing.Point(0, 0);
|
||||
this.resultsGroupBox.Name = "resultsGroupBox";
|
||||
this.resultsGroupBox.Size = new System.Drawing.Size(840, 428);
|
||||
this.resultsGroupBox.TabIndex = 1;
|
||||
this.resultsGroupBox.TabStop = false;
|
||||
this.resultsGroupBox.Text = "Query results";
|
||||
//
|
||||
// resultsListView
|
||||
//
|
||||
this.resultsListView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.resultsListView.Location = new System.Drawing.Point(3, 16);
|
||||
this.resultsListView.Name = "resultsListView";
|
||||
this.resultsListView.Size = new System.Drawing.Size(834, 409);
|
||||
this.resultsListView.TabIndex = 0;
|
||||
this.resultsListView.UseCompatibleStateImageBehavior = false;
|
||||
this.resultsListView.View = System.Windows.Forms.View.Details;
|
||||
//
|
||||
// printerConfigBtn
|
||||
//
|
||||
this.printerConfigBtn.Location = new System.Drawing.Point(8, 316);
|
||||
this.printerConfigBtn.Name = "printerConfigBtn";
|
||||
this.printerConfigBtn.Size = new System.Drawing.Size(125, 35);
|
||||
this.printerConfigBtn.TabIndex = 11;
|
||||
this.printerConfigBtn.Text = "Configure printer";
|
||||
this.printerConfigBtn.UseVisualStyleBackColor = true;
|
||||
this.printerConfigBtn.Click += new System.EventHandler(this.printerConfigBtn_Click);
|
||||
//
|
||||
// statisticsBtn
|
||||
//
|
||||
this.statisticsBtn.Location = new System.Drawing.Point(8, 621);
|
||||
this.statisticsBtn.Name = "statisticsBtn";
|
||||
this.statisticsBtn.Size = new System.Drawing.Size(125, 35);
|
||||
this.statisticsBtn.TabIndex = 10;
|
||||
this.statisticsBtn.Text = "Statistics";
|
||||
this.statisticsBtn.UseVisualStyleBackColor = true;
|
||||
this.statisticsBtn.Click += new System.EventHandler(this.statisticsBtn_Click);
|
||||
//
|
||||
// printQueryResultsBtn
|
||||
//
|
||||
this.printQueryResultsBtn.Location = new System.Drawing.Point(8, 548);
|
||||
this.printQueryResultsBtn.Name = "printQueryResultsBtn";
|
||||
this.printQueryResultsBtn.Size = new System.Drawing.Size(125, 35);
|
||||
this.printQueryResultsBtn.TabIndex = 9;
|
||||
this.printQueryResultsBtn.Text = "Print query results";
|
||||
this.printQueryResultsBtn.UseVisualStyleBackColor = true;
|
||||
this.printQueryResultsBtn.Click += new System.EventHandler(this.printQueryResultsBtn_Click);
|
||||
//
|
||||
// exportQueryResultsBtn
|
||||
//
|
||||
this.exportQueryResultsBtn.Location = new System.Drawing.Point(8, 508);
|
||||
this.exportQueryResultsBtn.Name = "exportQueryResultsBtn";
|
||||
this.exportQueryResultsBtn.Size = new System.Drawing.Size(125, 35);
|
||||
this.exportQueryResultsBtn.TabIndex = 8;
|
||||
this.exportQueryResultsBtn.Text = "Export query results";
|
||||
this.exportQueryResultsBtn.UseVisualStyleBackColor = true;
|
||||
this.exportQueryResultsBtn.Click += new System.EventHandler(this.exportQueryResultsBtn_Click);
|
||||
//
|
||||
// formatOfResultsBtn
|
||||
//
|
||||
this.formatOfResultsBtn.Location = new System.Drawing.Point(8, 276);
|
||||
this.formatOfResultsBtn.Name = "formatOfResultsBtn";
|
||||
this.formatOfResultsBtn.Size = new System.Drawing.Size(125, 35);
|
||||
this.formatOfResultsBtn.TabIndex = 7;
|
||||
this.formatOfResultsBtn.Text = "Configure output";
|
||||
this.formatOfResultsBtn.UseVisualStyleBackColor = true;
|
||||
this.formatOfResultsBtn.Click += new System.EventHandler(this.formatOfResultsBtn_Click);
|
||||
//
|
||||
// clearFiltersBtn
|
||||
//
|
||||
this.clearFiltersBtn.Location = new System.Drawing.Point(8, 196);
|
||||
this.clearFiltersBtn.Name = "clearFiltersBtn";
|
||||
this.clearFiltersBtn.Size = new System.Drawing.Size(125, 35);
|
||||
this.clearFiltersBtn.TabIndex = 2;
|
||||
this.clearFiltersBtn.Text = "Clear filters";
|
||||
this.clearFiltersBtn.UseVisualStyleBackColor = true;
|
||||
this.clearFiltersBtn.Click += new System.EventHandler(this.clearFiltersBtn_Click);
|
||||
//
|
||||
// settingsBtn
|
||||
//
|
||||
this.settingsBtn.Location = new System.Drawing.Point(8, 12);
|
||||
this.settingsBtn.Name = "settingsBtn";
|
||||
this.settingsBtn.Size = new System.Drawing.Size(125, 33);
|
||||
this.settingsBtn.TabIndex = 0;
|
||||
this.settingsBtn.Text = "Settings";
|
||||
this.settingsBtn.UseVisualStyleBackColor = true;
|
||||
this.settingsBtn.Click += new System.EventHandler(this.settingsBtn_Click);
|
||||
//
|
||||
// saveConfigBtn
|
||||
//
|
||||
this.saveConfigBtn.Location = new System.Drawing.Point(8, 356);
|
||||
this.saveConfigBtn.Name = "saveConfigBtn";
|
||||
this.saveConfigBtn.Size = new System.Drawing.Size(125, 35);
|
||||
this.saveConfigBtn.TabIndex = 5;
|
||||
this.saveConfigBtn.Text = "Save configuration";
|
||||
this.saveConfigBtn.UseVisualStyleBackColor = true;
|
||||
this.saveConfigBtn.Click += new System.EventHandler(this.saveConfigBtn_Click);
|
||||
//
|
||||
// loadConfigBtn
|
||||
//
|
||||
this.loadConfigBtn.Location = new System.Drawing.Point(8, 396);
|
||||
this.loadConfigBtn.Name = "loadConfigBtn";
|
||||
this.loadConfigBtn.Size = new System.Drawing.Size(125, 35);
|
||||
this.loadConfigBtn.TabIndex = 4;
|
||||
this.loadConfigBtn.Text = "Load configuration";
|
||||
this.loadConfigBtn.UseVisualStyleBackColor = true;
|
||||
this.loadConfigBtn.Click += new System.EventHandler(this.loadConfigBtn_Click);
|
||||
//
|
||||
// executeQueryBtn
|
||||
//
|
||||
this.executeQueryBtn.Location = new System.Drawing.Point(8, 468);
|
||||
this.executeQueryBtn.Name = "executeQueryBtn";
|
||||
this.executeQueryBtn.Size = new System.Drawing.Size(125, 35);
|
||||
this.executeQueryBtn.TabIndex = 6;
|
||||
this.executeQueryBtn.Text = "Execute query";
|
||||
this.executeQueryBtn.UseVisualStyleBackColor = true;
|
||||
this.executeQueryBtn.Click += new System.EventHandler(this.executeQueryBtn_Click);
|
||||
//
|
||||
// addFilterBtn
|
||||
//
|
||||
this.addFilterBtn.Location = new System.Drawing.Point(8, 236);
|
||||
this.addFilterBtn.Name = "addFilterBtn";
|
||||
this.addFilterBtn.Size = new System.Drawing.Size(125, 35);
|
||||
this.addFilterBtn.TabIndex = 3;
|
||||
this.addFilterBtn.Text = "Add filter";
|
||||
this.addFilterBtn.UseVisualStyleBackColor = true;
|
||||
this.addFilterBtn.Click += new System.EventHandler(this.addFilterBtn_Click);
|
||||
//
|
||||
// testBenchesGroupBox
|
||||
//
|
||||
this.testBenchesGroupBox.Controls.Add(this.checkBox5);
|
||||
this.testBenchesGroupBox.Controls.Add(this.checkBox4);
|
||||
this.testBenchesGroupBox.Controls.Add(this.checkBox3);
|
||||
this.testBenchesGroupBox.Controls.Add(this.checkBox2);
|
||||
this.testBenchesGroupBox.Controls.Add(this.checkBox1);
|
||||
this.testBenchesGroupBox.Location = new System.Drawing.Point(8, 54);
|
||||
this.testBenchesGroupBox.Name = "testBenchesGroupBox";
|
||||
this.testBenchesGroupBox.Size = new System.Drawing.Size(125, 135);
|
||||
this.testBenchesGroupBox.TabIndex = 1;
|
||||
this.testBenchesGroupBox.TabStop = false;
|
||||
this.testBenchesGroupBox.Text = "Test benches";
|
||||
//
|
||||
// checkBox5
|
||||
//
|
||||
this.checkBox5.AutoSize = true;
|
||||
this.checkBox5.Location = new System.Drawing.Point(23, 106);
|
||||
this.checkBox5.Name = "checkBox5";
|
||||
this.checkBox5.Size = new System.Drawing.Size(85, 17);
|
||||
this.checkBox5.TabIndex = 4;
|
||||
this.checkBox5.TabStop = true;
|
||||
this.checkBox5.Text = "radioButton5";
|
||||
this.checkBox5.UseVisualStyleBackColor = true;
|
||||
this.checkBox5.CheckedChanged += new System.EventHandler(this.checkBox5_CheckedChanged);
|
||||
//
|
||||
// checkBox4
|
||||
//
|
||||
this.checkBox4.AutoSize = true;
|
||||
this.checkBox4.Location = new System.Drawing.Point(23, 86);
|
||||
this.checkBox4.Name = "checkBox4";
|
||||
this.checkBox4.Size = new System.Drawing.Size(85, 17);
|
||||
this.checkBox4.TabIndex = 3;
|
||||
this.checkBox4.TabStop = true;
|
||||
this.checkBox4.Text = "radioButton4";
|
||||
this.checkBox4.UseVisualStyleBackColor = true;
|
||||
this.checkBox4.CheckedChanged += new System.EventHandler(this.checkBox4_CheckedChanged);
|
||||
//
|
||||
// checkBox3
|
||||
//
|
||||
this.checkBox3.AutoSize = true;
|
||||
this.checkBox3.Location = new System.Drawing.Point(23, 65);
|
||||
this.checkBox3.Name = "checkBox3";
|
||||
this.checkBox3.Size = new System.Drawing.Size(85, 17);
|
||||
this.checkBox3.TabIndex = 2;
|
||||
this.checkBox3.TabStop = true;
|
||||
this.checkBox3.Text = "radioButton3";
|
||||
this.checkBox3.UseVisualStyleBackColor = true;
|
||||
this.checkBox3.CheckedChanged += new System.EventHandler(this.checkBox3_CheckedChanged);
|
||||
//
|
||||
// checkBox2
|
||||
//
|
||||
this.checkBox2.AutoSize = true;
|
||||
this.checkBox2.Location = new System.Drawing.Point(23, 44);
|
||||
this.checkBox2.Name = "checkBox2";
|
||||
this.checkBox2.Size = new System.Drawing.Size(85, 17);
|
||||
this.checkBox2.TabIndex = 1;
|
||||
this.checkBox2.TabStop = true;
|
||||
this.checkBox2.Text = "radioButton2";
|
||||
this.checkBox2.UseVisualStyleBackColor = true;
|
||||
this.checkBox2.CheckedChanged += new System.EventHandler(this.checkBox2_CheckedChanged);
|
||||
//
|
||||
// checkBox1
|
||||
//
|
||||
this.checkBox1.AutoSize = true;
|
||||
this.checkBox1.Location = new System.Drawing.Point(23, 23);
|
||||
this.checkBox1.Name = "checkBox1";
|
||||
this.checkBox1.Size = new System.Drawing.Size(85, 17);
|
||||
this.checkBox1.TabIndex = 0;
|
||||
this.checkBox1.TabStop = true;
|
||||
this.checkBox1.Text = "radioButton1";
|
||||
this.checkBox1.UseVisualStyleBackColor = true;
|
||||
this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
|
||||
//
|
||||
// ResultsBrowserWnd
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(984, 712);
|
||||
this.Controls.Add(this.vSplitContainer);
|
||||
this.Name = "ResultsBrowserWnd";
|
||||
this.Text = "Results Browser";
|
||||
this.Load += new System.EventHandler(this.ResultsBrowserWnd_Load);
|
||||
this.vSplitContainer.Panel1.ResumeLayout(false);
|
||||
this.vSplitContainer.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.vSplitContainer)).EndInit();
|
||||
this.vSplitContainer.ResumeLayout(false);
|
||||
this.hSplitContainer.Panel1.ResumeLayout(false);
|
||||
this.hSplitContainer.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.hSplitContainer)).EndInit();
|
||||
this.hSplitContainer.ResumeLayout(false);
|
||||
this.filtersGroupBox.ResumeLayout(false);
|
||||
this.resultsGroupBox.ResumeLayout(false);
|
||||
this.testBenchesGroupBox.ResumeLayout(false);
|
||||
this.testBenchesGroupBox.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.vSplitContainer = new System.Windows.Forms.SplitContainer();
|
||||
this.hSplitContainer = new System.Windows.Forms.SplitContainer();
|
||||
this.filtersGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.filtersFlowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.resultsGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.resultsListView = new System.Windows.Forms.ListView();
|
||||
this.statisticsBtn = new System.Windows.Forms.Button();
|
||||
this.printQueryResultsBtn = new System.Windows.Forms.Button();
|
||||
this.exportQueryResultsBtn = new System.Windows.Forms.Button();
|
||||
this.formatOfResultsBtn = new System.Windows.Forms.Button();
|
||||
this.clearFiltersBtn = new System.Windows.Forms.Button();
|
||||
this.settingsBtn = new System.Windows.Forms.Button();
|
||||
this.saveConfigBtn = new System.Windows.Forms.Button();
|
||||
this.loadConfigBtn = new System.Windows.Forms.Button();
|
||||
this.executeQueryBtn = new System.Windows.Forms.Button();
|
||||
this.addFilterBtn = new System.Windows.Forms.Button();
|
||||
this.testBenchesGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.checkBox5 = new System.Windows.Forms.RadioButton();
|
||||
this.checkBox4 = new System.Windows.Forms.RadioButton();
|
||||
this.checkBox3 = new System.Windows.Forms.RadioButton();
|
||||
this.checkBox2 = new System.Windows.Forms.RadioButton();
|
||||
this.checkBox1 = new System.Windows.Forms.RadioButton();
|
||||
((System.ComponentModel.ISupportInitialize)(this.vSplitContainer)).BeginInit();
|
||||
this.vSplitContainer.Panel1.SuspendLayout();
|
||||
this.vSplitContainer.Panel2.SuspendLayout();
|
||||
this.vSplitContainer.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.hSplitContainer)).BeginInit();
|
||||
this.hSplitContainer.Panel1.SuspendLayout();
|
||||
this.hSplitContainer.Panel2.SuspendLayout();
|
||||
this.hSplitContainer.SuspendLayout();
|
||||
this.filtersGroupBox.SuspendLayout();
|
||||
this.resultsGroupBox.SuspendLayout();
|
||||
this.testBenchesGroupBox.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// vSplitContainer
|
||||
//
|
||||
this.vSplitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.vSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
|
||||
this.vSplitContainer.Location = new System.Drawing.Point(0, 0);
|
||||
this.vSplitContainer.Name = "vSplitContainer";
|
||||
//
|
||||
// vSplitContainer.Panel1
|
||||
//
|
||||
this.vSplitContainer.Panel1.Controls.Add(this.hSplitContainer);
|
||||
this.vSplitContainer.Panel1MinSize = 100;
|
||||
//
|
||||
// vSplitContainer.Panel2
|
||||
//
|
||||
this.vSplitContainer.Panel2.Controls.Add(this.statisticsBtn);
|
||||
this.vSplitContainer.Panel2.Controls.Add(this.printQueryResultsBtn);
|
||||
this.vSplitContainer.Panel2.Controls.Add(this.exportQueryResultsBtn);
|
||||
this.vSplitContainer.Panel2.Controls.Add(this.formatOfResultsBtn);
|
||||
this.vSplitContainer.Panel2.Controls.Add(this.clearFiltersBtn);
|
||||
this.vSplitContainer.Panel2.Controls.Add(this.settingsBtn);
|
||||
this.vSplitContainer.Panel2.Controls.Add(this.saveConfigBtn);
|
||||
this.vSplitContainer.Panel2.Controls.Add(this.loadConfigBtn);
|
||||
this.vSplitContainer.Panel2.Controls.Add(this.executeQueryBtn);
|
||||
this.vSplitContainer.Panel2.Controls.Add(this.addFilterBtn);
|
||||
this.vSplitContainer.Panel2.Controls.Add(this.testBenchesGroupBox);
|
||||
this.vSplitContainer.Panel2MinSize = 100;
|
||||
this.vSplitContainer.Size = new System.Drawing.Size(984, 712);
|
||||
this.vSplitContainer.SplitterDistance = 840;
|
||||
this.vSplitContainer.TabIndex = 0;
|
||||
//
|
||||
// hSplitContainer
|
||||
//
|
||||
this.hSplitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.hSplitContainer.Location = new System.Drawing.Point(0, 0);
|
||||
this.hSplitContainer.Name = "hSplitContainer";
|
||||
this.hSplitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
//
|
||||
// hSplitContainer.Panel1
|
||||
//
|
||||
this.hSplitContainer.Panel1.Controls.Add(this.filtersGroupBox);
|
||||
//
|
||||
// hSplitContainer.Panel2
|
||||
//
|
||||
this.hSplitContainer.Panel2.Controls.Add(this.resultsGroupBox);
|
||||
this.hSplitContainer.Size = new System.Drawing.Size(840, 712);
|
||||
this.hSplitContainer.SplitterDistance = 280;
|
||||
this.hSplitContainer.TabIndex = 0;
|
||||
//
|
||||
// filtersGroupBox
|
||||
//
|
||||
this.filtersGroupBox.Controls.Add(this.filtersFlowLayoutPanel);
|
||||
this.filtersGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.filtersGroupBox.Location = new System.Drawing.Point(0, 0);
|
||||
this.filtersGroupBox.Name = "filtersGroupBox";
|
||||
this.filtersGroupBox.Size = new System.Drawing.Size(840, 280);
|
||||
this.filtersGroupBox.TabIndex = 1;
|
||||
this.filtersGroupBox.TabStop = false;
|
||||
this.filtersGroupBox.Text = "Filters";
|
||||
//
|
||||
// filtersFlowLayoutPanel
|
||||
//
|
||||
this.filtersFlowLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.filtersFlowLayoutPanel.Location = new System.Drawing.Point(3, 16);
|
||||
this.filtersFlowLayoutPanel.Name = "filtersFlowLayoutPanel";
|
||||
this.filtersFlowLayoutPanel.Size = new System.Drawing.Size(834, 261);
|
||||
this.filtersFlowLayoutPanel.TabIndex = 0;
|
||||
//
|
||||
// resultsGroupBox
|
||||
//
|
||||
this.resultsGroupBox.Controls.Add(this.resultsListView);
|
||||
this.resultsGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.resultsGroupBox.Location = new System.Drawing.Point(0, 0);
|
||||
this.resultsGroupBox.Name = "resultsGroupBox";
|
||||
this.resultsGroupBox.Size = new System.Drawing.Size(840, 428);
|
||||
this.resultsGroupBox.TabIndex = 1;
|
||||
this.resultsGroupBox.TabStop = false;
|
||||
this.resultsGroupBox.Text = "Query results";
|
||||
//
|
||||
// resultsListView
|
||||
//
|
||||
this.resultsListView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.resultsListView.Location = new System.Drawing.Point(3, 16);
|
||||
this.resultsListView.Name = "resultsListView";
|
||||
this.resultsListView.Size = new System.Drawing.Size(834, 409);
|
||||
this.resultsListView.TabIndex = 0;
|
||||
this.resultsListView.UseCompatibleStateImageBehavior = false;
|
||||
this.resultsListView.View = System.Windows.Forms.View.Details;
|
||||
//
|
||||
// statisticsBtn
|
||||
//
|
||||
this.statisticsBtn.Location = new System.Drawing.Point(8, 581);
|
||||
this.statisticsBtn.Name = "statisticsBtn";
|
||||
this.statisticsBtn.Size = new System.Drawing.Size(125, 33);
|
||||
this.statisticsBtn.TabIndex = 10;
|
||||
this.statisticsBtn.Text = "Statistics";
|
||||
this.statisticsBtn.UseVisualStyleBackColor = true;
|
||||
this.statisticsBtn.Click += new System.EventHandler(this.statisticsBtn_Click);
|
||||
//
|
||||
// printQueryResultsBtn
|
||||
//
|
||||
this.printQueryResultsBtn.Location = new System.Drawing.Point(8, 506);
|
||||
this.printQueryResultsBtn.Name = "printQueryResultsBtn";
|
||||
this.printQueryResultsBtn.Size = new System.Drawing.Size(125, 33);
|
||||
this.printQueryResultsBtn.TabIndex = 9;
|
||||
this.printQueryResultsBtn.Text = "Print query results";
|
||||
this.printQueryResultsBtn.UseVisualStyleBackColor = true;
|
||||
this.printQueryResultsBtn.Click += new System.EventHandler(this.printQueryResultsBtn_Click);
|
||||
//
|
||||
// exportQueryResultsBtn
|
||||
//
|
||||
this.exportQueryResultsBtn.Location = new System.Drawing.Point(8, 467);
|
||||
this.exportQueryResultsBtn.Name = "exportQueryResultsBtn";
|
||||
this.exportQueryResultsBtn.Size = new System.Drawing.Size(125, 33);
|
||||
this.exportQueryResultsBtn.TabIndex = 8;
|
||||
this.exportQueryResultsBtn.Text = "Export query results";
|
||||
this.exportQueryResultsBtn.UseVisualStyleBackColor = true;
|
||||
this.exportQueryResultsBtn.Click += new System.EventHandler(this.exportQueryResultsBtn_Click);
|
||||
//
|
||||
// formatOfResultsBtn
|
||||
//
|
||||
this.formatOfResultsBtn.Location = new System.Drawing.Point(8, 274);
|
||||
this.formatOfResultsBtn.Name = "formatOfResultsBtn";
|
||||
this.formatOfResultsBtn.Size = new System.Drawing.Size(125, 33);
|
||||
this.formatOfResultsBtn.TabIndex = 7;
|
||||
this.formatOfResultsBtn.Text = "Format of results";
|
||||
this.formatOfResultsBtn.UseVisualStyleBackColor = true;
|
||||
this.formatOfResultsBtn.Click += new System.EventHandler(this.formatOfResultsBtn_Click);
|
||||
//
|
||||
// clearFiltersBtn
|
||||
//
|
||||
this.clearFiltersBtn.Location = new System.Drawing.Point(8, 196);
|
||||
this.clearFiltersBtn.Name = "clearFiltersBtn";
|
||||
this.clearFiltersBtn.Size = new System.Drawing.Size(125, 33);
|
||||
this.clearFiltersBtn.TabIndex = 2;
|
||||
this.clearFiltersBtn.Text = "Clear filters";
|
||||
this.clearFiltersBtn.UseVisualStyleBackColor = true;
|
||||
this.clearFiltersBtn.Click += new System.EventHandler(this.clearFiltersBtn_Click);
|
||||
//
|
||||
// settingsBtn
|
||||
//
|
||||
this.settingsBtn.Location = new System.Drawing.Point(8, 12);
|
||||
this.settingsBtn.Name = "settingsBtn";
|
||||
this.settingsBtn.Size = new System.Drawing.Size(125, 33);
|
||||
this.settingsBtn.TabIndex = 0;
|
||||
this.settingsBtn.Text = "Settings";
|
||||
this.settingsBtn.UseVisualStyleBackColor = true;
|
||||
this.settingsBtn.Click += new System.EventHandler(this.settingsBtn_Click);
|
||||
//
|
||||
// saveConfigBtn
|
||||
//
|
||||
this.saveConfigBtn.Location = new System.Drawing.Point(8, 313);
|
||||
this.saveConfigBtn.Name = "saveConfigBtn";
|
||||
this.saveConfigBtn.Size = new System.Drawing.Size(125, 33);
|
||||
this.saveConfigBtn.TabIndex = 5;
|
||||
this.saveConfigBtn.Text = "Save configuration";
|
||||
this.saveConfigBtn.UseVisualStyleBackColor = true;
|
||||
this.saveConfigBtn.Click += new System.EventHandler(this.saveConfigBtn_Click);
|
||||
//
|
||||
// loadConfigBtn
|
||||
//
|
||||
this.loadConfigBtn.Location = new System.Drawing.Point(8, 352);
|
||||
this.loadConfigBtn.Name = "loadConfigBtn";
|
||||
this.loadConfigBtn.Size = new System.Drawing.Size(125, 33);
|
||||
this.loadConfigBtn.TabIndex = 4;
|
||||
this.loadConfigBtn.Text = "Load configuration";
|
||||
this.loadConfigBtn.UseVisualStyleBackColor = true;
|
||||
this.loadConfigBtn.Click += new System.EventHandler(this.loadConfigBtn_Click);
|
||||
//
|
||||
// executeQueryBtn
|
||||
//
|
||||
this.executeQueryBtn.Location = new System.Drawing.Point(8, 428);
|
||||
this.executeQueryBtn.Name = "executeQueryBtn";
|
||||
this.executeQueryBtn.Size = new System.Drawing.Size(125, 33);
|
||||
this.executeQueryBtn.TabIndex = 6;
|
||||
this.executeQueryBtn.Text = "Execute query";
|
||||
this.executeQueryBtn.UseVisualStyleBackColor = true;
|
||||
this.executeQueryBtn.Click += new System.EventHandler(this.executeQueryBtn_Click);
|
||||
//
|
||||
// addFilterBtn
|
||||
//
|
||||
this.addFilterBtn.Location = new System.Drawing.Point(8, 235);
|
||||
this.addFilterBtn.Name = "addFilterBtn";
|
||||
this.addFilterBtn.Size = new System.Drawing.Size(125, 33);
|
||||
this.addFilterBtn.TabIndex = 3;
|
||||
this.addFilterBtn.Text = "Add filter";
|
||||
this.addFilterBtn.UseVisualStyleBackColor = true;
|
||||
this.addFilterBtn.Click += new System.EventHandler(this.addFilterBtn_Click);
|
||||
//
|
||||
// testBenchesGroupBox
|
||||
//
|
||||
this.testBenchesGroupBox.Controls.Add(this.checkBox5);
|
||||
this.testBenchesGroupBox.Controls.Add(this.checkBox4);
|
||||
this.testBenchesGroupBox.Controls.Add(this.checkBox3);
|
||||
this.testBenchesGroupBox.Controls.Add(this.checkBox2);
|
||||
this.testBenchesGroupBox.Controls.Add(this.checkBox1);
|
||||
this.testBenchesGroupBox.Location = new System.Drawing.Point(8, 54);
|
||||
this.testBenchesGroupBox.Name = "testBenchesGroupBox";
|
||||
this.testBenchesGroupBox.Size = new System.Drawing.Size(125, 135);
|
||||
this.testBenchesGroupBox.TabIndex = 1;
|
||||
this.testBenchesGroupBox.TabStop = false;
|
||||
this.testBenchesGroupBox.Text = "Test benches";
|
||||
//
|
||||
// checkBox5
|
||||
//
|
||||
this.checkBox5.AutoSize = true;
|
||||
this.checkBox5.Location = new System.Drawing.Point(23, 106);
|
||||
this.checkBox5.Name = "checkBox5";
|
||||
this.checkBox5.Size = new System.Drawing.Size(85, 17);
|
||||
this.checkBox5.TabIndex = 4;
|
||||
this.checkBox5.TabStop = true;
|
||||
this.checkBox5.Text = "radioButton5";
|
||||
this.checkBox5.UseVisualStyleBackColor = true;
|
||||
this.checkBox5.CheckedChanged += new System.EventHandler(this.checkBox5_CheckedChanged);
|
||||
//
|
||||
// checkBox4
|
||||
//
|
||||
this.checkBox4.AutoSize = true;
|
||||
this.checkBox4.Location = new System.Drawing.Point(23, 86);
|
||||
this.checkBox4.Name = "checkBox4";
|
||||
this.checkBox4.Size = new System.Drawing.Size(85, 17);
|
||||
this.checkBox4.TabIndex = 3;
|
||||
this.checkBox4.TabStop = true;
|
||||
this.checkBox4.Text = "radioButton4";
|
||||
this.checkBox4.UseVisualStyleBackColor = true;
|
||||
this.checkBox4.CheckedChanged += new System.EventHandler(this.checkBox4_CheckedChanged);
|
||||
//
|
||||
// checkBox3
|
||||
//
|
||||
this.checkBox3.AutoSize = true;
|
||||
this.checkBox3.Location = new System.Drawing.Point(23, 65);
|
||||
this.checkBox3.Name = "checkBox3";
|
||||
this.checkBox3.Size = new System.Drawing.Size(85, 17);
|
||||
this.checkBox3.TabIndex = 2;
|
||||
this.checkBox3.TabStop = true;
|
||||
this.checkBox3.Text = "radioButton3";
|
||||
this.checkBox3.UseVisualStyleBackColor = true;
|
||||
this.checkBox3.CheckedChanged += new System.EventHandler(this.checkBox3_CheckedChanged);
|
||||
//
|
||||
// checkBox2
|
||||
//
|
||||
this.checkBox2.AutoSize = true;
|
||||
this.checkBox2.Location = new System.Drawing.Point(23, 44);
|
||||
this.checkBox2.Name = "checkBox2";
|
||||
this.checkBox2.Size = new System.Drawing.Size(85, 17);
|
||||
this.checkBox2.TabIndex = 1;
|
||||
this.checkBox2.TabStop = true;
|
||||
this.checkBox2.Text = "radioButton2";
|
||||
this.checkBox2.UseVisualStyleBackColor = true;
|
||||
this.checkBox2.CheckedChanged += new System.EventHandler(this.checkBox2_CheckedChanged);
|
||||
//
|
||||
// checkBox1
|
||||
//
|
||||
this.checkBox1.AutoSize = true;
|
||||
this.checkBox1.Location = new System.Drawing.Point(23, 23);
|
||||
this.checkBox1.Name = "checkBox1";
|
||||
this.checkBox1.Size = new System.Drawing.Size(85, 17);
|
||||
this.checkBox1.TabIndex = 0;
|
||||
this.checkBox1.TabStop = true;
|
||||
this.checkBox1.Text = "radioButton1";
|
||||
this.checkBox1.UseVisualStyleBackColor = true;
|
||||
this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
|
||||
//
|
||||
// ResultsBrowserWnd
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(984, 712);
|
||||
this.Controls.Add(this.vSplitContainer);
|
||||
this.Name = "ResultsBrowserWnd";
|
||||
this.Text = "Results Browser";
|
||||
this.Load += new System.EventHandler(this.ResultsBrowserWnd_Load);
|
||||
this.vSplitContainer.Panel1.ResumeLayout(false);
|
||||
this.vSplitContainer.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.vSplitContainer)).EndInit();
|
||||
this.vSplitContainer.ResumeLayout(false);
|
||||
this.hSplitContainer.Panel1.ResumeLayout(false);
|
||||
this.hSplitContainer.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.hSplitContainer)).EndInit();
|
||||
this.hSplitContainer.ResumeLayout(false);
|
||||
this.filtersGroupBox.ResumeLayout(false);
|
||||
this.resultsGroupBox.ResumeLayout(false);
|
||||
this.testBenchesGroupBox.ResumeLayout(false);
|
||||
this.testBenchesGroupBox.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
@@ -386,6 +374,5 @@
|
||||
private System.Windows.Forms.ListView resultsListView;
|
||||
private System.Windows.Forms.RadioButton checkBox5;
|
||||
private System.Windows.Forms.RadioButton checkBox4;
|
||||
private System.Windows.Forms.Button printerConfigBtn;
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using NHibernate;
|
||||
using Results.Entities;
|
||||
using TBF.BenchControl;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
using ResultsBrowser.Filters;
|
||||
using ResultsBrowser.Resources;
|
||||
using System.IO;
|
||||
|
||||
namespace ResultsBrowser
|
||||
{
|
||||
@@ -16,7 +13,7 @@ namespace ResultsBrowser
|
||||
{
|
||||
const string OpenFileDlg_SaveFileDlg_Filter = "{0} (*.qry)|*.qry|{1} (*.*)|*.*";
|
||||
|
||||
string[] args; /// Comand line argument
|
||||
string[] args;
|
||||
|
||||
IList<Filters.IFilter> filters; /// Filters and the UI of filters
|
||||
FiltersConfig filtersConfig; /// Serializable configuration of filters and displayed results
|
||||
@@ -26,20 +23,13 @@ namespace ResultsBrowser
|
||||
DateTime timePeriodStart;
|
||||
DateTime timePeriodEnd;
|
||||
|
||||
static IList<IComponent> tbfComponents;
|
||||
static IList<IDevice> tbfDevices;
|
||||
|
||||
public ResultsBrowserWnd(string[] args)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
filters = new List<Filters.IFilter>();
|
||||
filtersConfig = new FiltersConfig();
|
||||
this.args = args;
|
||||
|
||||
tbfComponents = new List<TBF.BenchControl.Generic.IComponent>();
|
||||
tbfDevices = new List<IDevice>();
|
||||
|
||||
timePeriodStart = new DateTime(0);
|
||||
timePeriodEnd = new DateTime(0);
|
||||
}
|
||||
@@ -105,19 +95,15 @@ namespace ResultsBrowser
|
||||
resultsGroupBox.Text = Strings.Query_results;
|
||||
settingsBtn.Text = Strings.Settings;
|
||||
testBenchesGroupBox.Text = Strings.Test_benches;
|
||||
|
||||
clearFiltersBtn.Text = Strings.Clear_filters;
|
||||
clearFiltersBtn.Text = Strings.Clear_filters;
|
||||
addFilterBtn.Text = Strings.Add_filter;
|
||||
formatOfResultsBtn.Text = Strings.Format_of_results;
|
||||
printerConfigBtn.Text = Strings.Configure_printer;
|
||||
loadConfigBtn.Text = Strings.Load_filters;
|
||||
loadConfigBtn.Text = Strings.Load_filters;
|
||||
saveConfigBtn.Text = Strings.Save_filters;
|
||||
|
||||
executeQueryBtn.Text = Strings.Execute_query;
|
||||
executeQueryBtn.Text = Strings.Execute_query;
|
||||
formatOfResultsBtn.Text = Strings.Format_of_results;
|
||||
exportQueryResultsBtn.Text = Strings.Export_query_results;
|
||||
printQueryResultsBtn.Text = Strings.Print_query_results;
|
||||
|
||||
statisticsBtn.Text = Strings.Statistics;
|
||||
statisticsBtn.Text = Strings.Statistics;
|
||||
}
|
||||
|
||||
private void settingsBtn_Click(object sender, EventArgs e)
|
||||
@@ -161,34 +147,6 @@ namespace ResultsBrowser
|
||||
}
|
||||
}
|
||||
|
||||
private void formatOfResultsBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
Results.Forms.ResultsConfigDlg dlg = new Results.Forms.ResultsConfigDlg();
|
||||
dlg.MetersKind = Config.Entities.MetersKind.Single;
|
||||
dlg.SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(filtersConfig.ResultItems);
|
||||
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
filtersConfig.ResultItems = Results.WMeterRsltItemSpec.ToStrArray(dlg.SelectedItems);
|
||||
RedrawResults();
|
||||
}
|
||||
}
|
||||
|
||||
private void printerConfigBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
Forms.PrinterConfigDlg dlg = new Forms.PrinterConfigDlg
|
||||
{
|
||||
PrinterClass = filtersConfig.PrinterClass,
|
||||
PrinterCfg = filtersConfig.PrinterCfg
|
||||
};
|
||||
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
filtersConfig.PrinterClass = dlg.PrinterClass;
|
||||
filtersConfig.PrinterCfg = dlg.PrinterCfg;
|
||||
}
|
||||
}
|
||||
|
||||
private void loadConfigBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
OpenFileDialog dlg = new OpenFileDialog();
|
||||
@@ -286,11 +244,7 @@ namespace ResultsBrowser
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string message = exc.Message;
|
||||
if (exc.InnerException != null)
|
||||
message += string.Format("{0}Inner exception:{0}{1}", Environment.NewLine, exc.InnerException.Message);
|
||||
|
||||
MessageBox.Show(message, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
MessageBox.Show(exc.Message, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -337,6 +291,19 @@ namespace ResultsBrowser
|
||||
}
|
||||
}
|
||||
|
||||
private void formatOfResultsBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
Results.Forms.ResultsConfigDlg dlg = new Results.Forms.ResultsConfigDlg();
|
||||
dlg.MetersKind = Config.Entities.MetersKind.Single;
|
||||
dlg.SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(filtersConfig.ResultItems);
|
||||
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
filtersConfig.ResultItems = Results.WMeterRsltItemSpec.ToStrArray(dlg.SelectedItems);
|
||||
RedrawResults();
|
||||
}
|
||||
}
|
||||
|
||||
private void exportQueryResultsBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
IList<Results.WMeterRsltItemSpec> items = Results.WMeterRsltItemSpec.FromStrArray(filtersConfig.ResultItems);
|
||||
@@ -344,14 +311,13 @@ namespace ResultsBrowser
|
||||
if (waterMeters == null || waterMeters.Count == 0 || items.Count == 0) return;
|
||||
|
||||
SaveFileDialog dlg = new SaveFileDialog();
|
||||
dlg.Filter = "CSV files (*.csv)|*.csv|All files (*.*)|*.*";
|
||||
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (TextWriter writer = new StreamWriter(dlg.FileName, false, System.Text.Encoding.UTF8))
|
||||
{
|
||||
using (TextWriter writer = new StreamWriter(dlg.FileName))
|
||||
{
|
||||
try
|
||||
{
|
||||
for (int i = 0; i < items.Count; i++)
|
||||
{
|
||||
writer.Write(items[i].Caption);
|
||||
@@ -380,15 +346,14 @@ namespace ResultsBrowser
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
MessageBox.Show(exc.Message, Strings.Error_displaying_results, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
MessageBox.Show(exc.Message, Strings.Error_exporting_results, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void printQueryResultsBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (waterMeters == null || waterMeters.Count == 0) return;
|
||||
@@ -413,65 +378,8 @@ namespace ResultsBrowser
|
||||
"PT40 Z/E-35-A",
|
||||
"0111-OOP-C035-13").Print();
|
||||
}
|
||||
#else
|
||||
if (string.IsNullOrEmpty(filtersConfig.PrinterClass))
|
||||
{
|
||||
MessageBox.Show(Strings.No_printer_defined);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Config.Entities.Component cmpnt = new Config.Entities.Component();
|
||||
cmpnt.Name = "printer";
|
||||
cmpnt.ClassName = filtersConfig.PrinterClass;
|
||||
cmpnt.Parameters = filtersConfig.PrinterCfg;
|
||||
|
||||
IComponentFactory printerFactory = GetFactory(filtersConfig.PrinterClass);
|
||||
IComponentCfg printerCfg = printerFactory.CmpntCfgFromCmpntEntity(cmpnt);
|
||||
IComponent component = printerFactory.GetComponent(printerCfg, tbfComponents);
|
||||
IResultsPrinter printer = component as IResultsPrinter;
|
||||
|
||||
if (printer== null)
|
||||
{
|
||||
MessageBox.Show(Strings.No_printer_defined);
|
||||
return;
|
||||
}
|
||||
|
||||
tbfComponents.Clear();
|
||||
tbfDevices.Clear();
|
||||
tbfComponents.Add(component);
|
||||
IDevice dev = component as IDevice;
|
||||
if (dev != null)
|
||||
{
|
||||
dev.Initialize();
|
||||
tbfDevices.Add(dev);
|
||||
}
|
||||
|
||||
/// Find batches
|
||||
IList<Results.Entities.Batch> batches = new List<Results.Entities.Batch>();
|
||||
foreach (var wm in waterMeters)
|
||||
{
|
||||
if (!batches.Contains(wm.Batch)) batches.Add(wm.Batch);
|
||||
}
|
||||
|
||||
foreach (var batch in batches)
|
||||
{
|
||||
IOperation printOp = printer.PrintResultsOp(batch);
|
||||
printOp.Start();
|
||||
while (printOp.Run() != Event.ResultsPrinted) { }
|
||||
printOp.Stop();
|
||||
}
|
||||
|
||||
MessageBox.Show(Strings.Printing_completed);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
MessageBox.Show(Strings.Printing_failed);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void statisticsBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
@@ -496,25 +404,5 @@ namespace ResultsBrowser
|
||||
timePeriodStart, timePeriodEnd);
|
||||
statisticsDlg.ShowDialog();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Updates component factory
|
||||
/// </summary>
|
||||
/// <param name="className">Component class name</param>
|
||||
/// <param name="factory">Reference to a factory</param>
|
||||
/// <returns>true when factory changed</returns>
|
||||
IComponentFactory GetFactory(string className)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(className))
|
||||
{
|
||||
foreach (var fac in TbfComponents.Factories)
|
||||
{
|
||||
if (fac.ClassName == className) return fac;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,9 +28,6 @@ EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dirichlet.Numerics", "Dirichlet.Numerics\Dirichlet.Numerics.csproj", "{439D0878-C76E-452B-B17D-209A89E91D36}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Users", "Users\Users.csproj", "{6E5CB0E9-E1B6-4E5D-AC6E-B1049E180F2B}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{8B10D15A-39DE-4B56-8DD1-710C1EB3A697} = {8B10D15A-39DE-4B56-8DD1-710C1EB3A697}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UserManagement", "UserManagement\UserManagement.csproj", "{B2CD81B3-AF09-4978-996C-02EDB5F819B7}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
@@ -38,14 +35,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UserManagement", "UserManag
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GraphLib", "GraphLib\GraphLib.csproj", "{0C0A1F4D-1363-4544-A7C5-196C76D26CCA}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{743DF7DB-C7B6-42EB-986D-0F485E5588E4} = {743DF7DB-C7B6-42EB-986D-0F485E5588E4}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonitoringDB", "MonitoringDB\MonitoringDB.csproj", "{EFEC8A31-3022-4DA7-A8F6-16D30A94C3FF}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GemCard", "GemCard\GemCard.csproj", "{8B10D15A-39DE-4B56-8DD1-710C1EB3A697}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -162,18 +154,6 @@ Global
|
||||
{EFEC8A31-3022-4DA7-A8F6-16D30A94C3FF}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{EFEC8A31-3022-4DA7-A8F6-16D30A94C3FF}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{EFEC8A31-3022-4DA7-A8F6-16D30A94C3FF}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{8B10D15A-39DE-4B56-8DD1-710C1EB3A697}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8B10D15A-39DE-4B56-8DD1-710C1EB3A697}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8B10D15A-39DE-4B56-8DD1-710C1EB3A697}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||
{8B10D15A-39DE-4B56-8DD1-710C1EB3A697}.Debug|Mixed Platforms.Build.0 = Debug|x86
|
||||
{8B10D15A-39DE-4B56-8DD1-710C1EB3A697}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{8B10D15A-39DE-4B56-8DD1-710C1EB3A697}.Debug|x86.Build.0 = Debug|x86
|
||||
{8B10D15A-39DE-4B56-8DD1-710C1EB3A697}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8B10D15A-39DE-4B56-8DD1-710C1EB3A697}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8B10D15A-39DE-4B56-8DD1-710C1EB3A697}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||
{8B10D15A-39DE-4B56-8DD1-710C1EB3A697}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||
{8B10D15A-39DE-4B56-8DD1-710C1EB3A697}.Release|x86.ActiveCfg = Release|x86
|
||||
{8B10D15A-39DE-4B56-8DD1-710C1EB3A697}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO.Ports;
|
||||
using System.Text;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
@@ -31,9 +33,9 @@ namespace TBF.BenchControl.Ambient.Comet
|
||||
///
|
||||
/// Measured values when MsrmntState == MsrmntState.Valid
|
||||
///
|
||||
float temperature; /// [°C]
|
||||
float temperature; /// [deg C]
|
||||
float pressure; /// [bar]
|
||||
float humidity; /// [R%]
|
||||
float humidity; /// [%]
|
||||
|
||||
/// <summary>Measurement time stamp when MsrmntState == MsrmntState.Valid</summary>
|
||||
int msrmntTimeStamp;
|
||||
@@ -117,8 +119,8 @@ namespace TBF.BenchControl.Ambient.Comet
|
||||
|
||||
msrmntTimeStamp = StateMachine.Time;
|
||||
msrmntState = MsrmntState.Valid;
|
||||
log.InfoFormat("Ambient: temperature = {0:F1} C, humidity = {1:F1} %, pressure = {2:F0} mbar", temperature, humidity, 1000 * pressure);
|
||||
}
|
||||
log.InfoFormat("Ambient: temperature = {0} C, humidity = {1} %, pressure = {2} mbar", temperature.ToString("F1"), humidity.ToString("F1"), (1000 * pressure).ToString("F0"));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
@@ -34,9 +34,9 @@ namespace TBF.BenchControl.Ambient.Greco
|
||||
///
|
||||
/// Measured values when MsrmntState == MsrmntState.Valid
|
||||
///
|
||||
float temperature; /// [°C]
|
||||
float temperature; /// [deg C]
|
||||
float pressure; /// [bar]
|
||||
float humidity; /// [R%]
|
||||
float humidity; /// [%]
|
||||
|
||||
/// <summary>Measurement time stamp when MsrmntState == MsrmntState.Valid</summary>
|
||||
int msrmntTimeStamp;
|
||||
@@ -136,8 +136,8 @@ namespace TBF.BenchControl.Ambient.Greco
|
||||
msrmntTimeStamp = StateMachine.Time;
|
||||
msrmntState = MsrmntState.Valid;
|
||||
|
||||
log.InfoFormat("Ambient: temperature = {0:F1} C, humidity = {1:F1} %, pressure = {2:F0} mbar", temperature, humidity, 1000 * pressure);
|
||||
}
|
||||
log.InfoFormat("Ambient: temperature = {0} C, humidity = {1} %, pressure = {2} mbar", temperature.ToString("F1"), humidity.ToString("F1"), (1000 * pressure).ToString("F0"));
|
||||
}
|
||||
else
|
||||
{
|
||||
log.Warn("Invalid string received: " + measurement);
|
||||
|
||||
@@ -124,146 +124,56 @@ namespace TBF.BenchControl
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void LoadTestParamsFromDB(Test test)
|
||||
/// <summary>
|
||||
/// Default implementation returning null - no test aprameters.
|
||||
/// In case there are any test parameters, this function override should return
|
||||
/// a reference to a class that implements IParamsProvider and ITestParams.
|
||||
/// </summary>
|
||||
/// <returns>Test parameters obtained by the last UpdateTestParams(test)</returns>
|
||||
public virtual IParamsProvider GetTestParams()
|
||||
{
|
||||
ITestParams tstPrms = (GetRuntimeTestParamsProvider() as ITestParams);
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Default implementation returning null - no procedure parameters.
|
||||
/// In case there are any procedure parameters, this function override should return
|
||||
/// a reference to a class that implements IParamsProvider and IProcedureParams.
|
||||
/// </summary>
|
||||
/// <returns>Procedure parameters obtained by the last UpdateProcedureParams(procedure)</returns>
|
||||
public virtual IParamsProvider GetProcedureParams()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public void UpdateTestParams(Test test)
|
||||
{
|
||||
ITestParams tstPrms = (GetTestParams() as ITestParams);
|
||||
if (tstPrms != null)
|
||||
{
|
||||
tstPrms.FromDbEntity(Name, test);
|
||||
tstPrms.UpdateTestParams(Name, test);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void LoadProcedureParamsFromDB(Procedure procedure)
|
||||
public void UpdateProcedureParams(Procedure procedure)
|
||||
{
|
||||
IProcedureParams procPrms = (GetRuntimeProcParamsProvider() as IProcedureParams);
|
||||
IProcedureParams procPrms = (GetProcedureParams() as IProcedureParams);
|
||||
if (procPrms != null)
|
||||
{
|
||||
procPrms.FromDbEntity(Name, procedure);
|
||||
procPrms.UpdateProcedureParams(Name, procedure);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// If there are any procedure parameters, this function should be overriden
|
||||
/// by one returning a reference to a newly created object
|
||||
/// implementing IParamsProvider and IProcedureParams.
|
||||
///
|
||||
/// This default implementation returns null = no procedure parameters.
|
||||
/// </summary>
|
||||
/// <returns>Procedure parameters provider for this component or null</returns>
|
||||
public virtual IParamsProvider CreateProcParamsProvider()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public virtual IParamsProvider CreateTestParams(Test test)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If there are any procedure parameters, this function should be overriden
|
||||
/// by one returning a reference to an object
|
||||
/// implementing IParamsProvider and IProcedureParams used in runtime.
|
||||
///
|
||||
/// This default implementation returns null = no procedure parameters.
|
||||
/// </summary>
|
||||
/// <returns>Procedure parameters provider for this component or null</returns>
|
||||
public virtual IParamsProvider GetRuntimeProcParamsProvider()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual IParamsProvider GetUIProcParamsProvider(Procedure procedure)
|
||||
{
|
||||
if (GetRuntimeProcParamsProvider() == null)
|
||||
{
|
||||
/// Component has no test parametes
|
||||
return null;
|
||||
}
|
||||
|
||||
ComponentProcedure procParamsEntity = procedure.GetProcedureParamsEntity(Name);
|
||||
|
||||
if (procParamsEntity != null)
|
||||
{
|
||||
if (procParamsEntity.GetParamsProvider() != null)
|
||||
{
|
||||
/// Parameters provider for this entity already fetched - return it
|
||||
return procParamsEntity.GetParamsProvider();
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Parameters provider for this entity will be created and updated from the entity later on
|
||||
IParamsProvider paramsProvider = CreateProcParamsProvider();
|
||||
(paramsProvider as IProcedureParams).UpdateFromDbEntity(procParamsEntity);
|
||||
procParamsEntity.SetParamsProvider(paramsProvider);
|
||||
return paramsProvider;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
IParamsProvider paramsProvider = CreateProcParamsProvider();
|
||||
(paramsProvider as IProcedureParams).FromDbEntity(Name, procedure);
|
||||
return paramsProvider;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// If there are any procedure parameters, this function should be overriden
|
||||
/// by one returning a reference to a newly created object
|
||||
/// implementing IParamsProvider and ITestParams.
|
||||
///
|
||||
/// This default implementation returns null = no test parameters.
|
||||
/// </summary>
|
||||
/// <returns>Procedure parameters provider for this component or null</returns>
|
||||
public virtual IParamsProvider CreateTestParamsProvider()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If there are any test parameters, this function should be overriden
|
||||
/// by one returning a reference to an object
|
||||
/// implementing IParamsProvider and ITestParams used in runtime.
|
||||
///
|
||||
/// This default implementation returns null = no test parameters.
|
||||
/// </summary>
|
||||
/// <returns>Test parameters provider for this component or null</returns>
|
||||
public virtual IParamsProvider GetRuntimeTestParamsProvider()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual IParamsProvider GetUITestParamsProvider(Test test)
|
||||
{
|
||||
if (GetRuntimeTestParamsProvider() == null)
|
||||
{
|
||||
/// Component has no test parametes
|
||||
return null;
|
||||
}
|
||||
|
||||
ComponentTest testParamsEntity = test.GetTestParamsEntity(Name);
|
||||
|
||||
if (testParamsEntity != null)
|
||||
{
|
||||
if (testParamsEntity.GetParamsProvider() != null)
|
||||
{
|
||||
/// Parameters provider for this entity already fetched - return it
|
||||
return testParamsEntity.GetParamsProvider();
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Parameters provider for this entity will be created and updated from the entity later on
|
||||
IParamsProvider paramsProvider = CreateTestParamsProvider();
|
||||
(paramsProvider as ITestParams).UpdateFromDbEntity(testParamsEntity);
|
||||
testParamsEntity.SetParamsProvider(paramsProvider);
|
||||
return paramsProvider;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
IParamsProvider paramsProvider = CreateTestParamsProvider();
|
||||
(paramsProvider as ITestParams).FromDbEntity(Name, test);
|
||||
return paramsProvider;
|
||||
}
|
||||
}
|
||||
public virtual IParamsProvider CreateProcedureParams(Procedure procedure)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,12 @@ namespace TBF.BenchControl.DB.SensusOracle
|
||||
///
|
||||
GenericDevices.IRegisterReader[] iperlHeads;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Result items to print
|
||||
/// </summary>
|
||||
IList<Results.ItemSpec> rsltItems;
|
||||
|
||||
/// <summary>
|
||||
/// Results to print
|
||||
/// </summary>
|
||||
|
||||
@@ -216,8 +216,6 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
|
||||
private void okButton_Click(object sender, EventArgs eArgs)
|
||||
{
|
||||
log.Debug("okButton_Click(..)");
|
||||
|
||||
try
|
||||
{
|
||||
if (endStates)
|
||||
@@ -242,7 +240,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
catch(Exception e)
|
||||
{
|
||||
log.ErrorFormat("Exception: {0}", e.Message);
|
||||
return;
|
||||
|
||||
@@ -70,10 +70,10 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
|
||||
this.WaterMetersCount = waterMetersCount;
|
||||
this.regReaders = regReaders;
|
||||
if (wmStartStateStr == null || wmStartStateStr.Length < waterMetersCount)
|
||||
this.WMStartStateStr = wmStartStateStr;
|
||||
if (wmStartStateStr == null || wmStartStateStr.Length != waterMetersCount)
|
||||
throw (new Exception("Invalid 'wmStartStateStr' argument"));
|
||||
this.WMStartStateStr = wmStartStateStr;
|
||||
this.disabled = disabled;
|
||||
this.disabled = disabled;
|
||||
this.refVolume = refVolume;
|
||||
this.warningLimLo = 2 * errLimLo;
|
||||
this.warningLimHi = 2 * errLimHi;
|
||||
@@ -153,34 +153,55 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
okButton.Text = Strings.OkBtnText;
|
||||
}
|
||||
|
||||
private void okButton_Click(object sender, EventArgs eArgs)
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
log.Debug("okButton_Click(..)");
|
||||
|
||||
try
|
||||
{
|
||||
if (endStates)
|
||||
{
|
||||
if (wmEndStateTextBox1.Enabled && WaterMetersCount >= 1) WMEndState[0] = Utils.ParseUDouble(wmEndStateTextBox1.Text);
|
||||
if (wmEndStateTextBox2.Enabled && WaterMetersCount >= 2) WMEndState[1] = Utils.ParseUDouble(wmEndStateTextBox2.Text);
|
||||
if (wmEndStateTextBox3.Enabled && WaterMetersCount >= 3) WMEndState[2] = Utils.ParseUDouble(wmEndStateTextBox3.Text);
|
||||
if (wmEndStateTextBox4.Enabled && WaterMetersCount >= 4) WMEndState[3] = Utils.ParseUDouble(wmEndStateTextBox4.Text);
|
||||
if (wmEndStateTextBox5.Enabled && WaterMetersCount >= 5) WMEndState[4] = Utils.ParseUDouble(wmEndStateTextBox5.Text);
|
||||
if (wmEndStateTextBox6.Enabled && WaterMetersCount >= 6) WMEndState[5] = Utils.ParseUDouble(wmEndStateTextBox6.Text);
|
||||
if (wmEndStateTextBox1.Enabled) WMEndState[0] = Utils.ParseUDouble(wmEndStateTextBox1.Text);
|
||||
if (wmEndStateTextBox2.Enabled) WMEndState[1] = Utils.ParseUDouble(wmEndStateTextBox2.Text);
|
||||
if (wmEndStateTextBox3.Enabled) WMEndState[2] = Utils.ParseUDouble(wmEndStateTextBox3.Text);
|
||||
if (wmEndStateTextBox4.Enabled) WMEndState[3] = Utils.ParseUDouble(wmEndStateTextBox4.Text);
|
||||
if (wmEndStateTextBox5.Enabled) WMEndState[4] = Utils.ParseUDouble(wmEndStateTextBox5.Text);
|
||||
if (wmEndStateTextBox6.Enabled) WMEndState[5] = Utils.ParseUDouble(wmEndStateTextBox6.Text);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (wmStartStateTextBox1.Enabled && WaterMetersCount >= 1) { WMStartStateStr[0] = wmStartStateTextBox1.Text; WMStartState[0] = Utils.ParseUDouble(wmStartStateTextBox1.Text); }
|
||||
if (wmStartStateTextBox2.Enabled && WaterMetersCount >= 2) { WMStartStateStr[1] = wmStartStateTextBox2.Text; WMStartState[1] = Utils.ParseUDouble(wmStartStateTextBox2.Text); }
|
||||
if (wmStartStateTextBox3.Enabled && WaterMetersCount >= 3) { WMStartStateStr[2] = wmStartStateTextBox3.Text; WMStartState[2] = Utils.ParseUDouble(wmStartStateTextBox3.Text); }
|
||||
if (wmStartStateTextBox4.Enabled && WaterMetersCount >= 4) { WMStartStateStr[3] = wmStartStateTextBox4.Text; WMStartState[3] = Utils.ParseUDouble(wmStartStateTextBox4.Text); }
|
||||
if (wmStartStateTextBox5.Enabled && WaterMetersCount >= 5) { WMStartStateStr[4] = wmStartStateTextBox5.Text; WMStartState[4] = Utils.ParseUDouble(wmStartStateTextBox5.Text); }
|
||||
if (wmStartStateTextBox6.Enabled && WaterMetersCount >= 6) { WMStartStateStr[5] = wmStartStateTextBox6.Text; WMStartState[5] = Utils.ParseUDouble(wmStartStateTextBox6.Text); }
|
||||
if (wmStartStateTextBox1.Enabled)
|
||||
{
|
||||
WMStartStateStr[0] = wmStartStateTextBox1.Text;
|
||||
WMStartState[0] = Utils.ParseUDouble(wmStartStateTextBox1.Text);
|
||||
}
|
||||
if (wmStartStateTextBox2.Enabled)
|
||||
{
|
||||
WMStartStateStr[1] = wmStartStateTextBox2.Text;
|
||||
WMStartState[1] = Utils.ParseUDouble(wmStartStateTextBox2.Text);
|
||||
}
|
||||
if (wmStartStateTextBox3.Enabled)
|
||||
{
|
||||
WMStartStateStr[2] = wmStartStateTextBox3.Text;
|
||||
WMStartState[2] = Utils.ParseUDouble(wmStartStateTextBox3.Text);
|
||||
}
|
||||
if (wmStartStateTextBox4.Enabled)
|
||||
{
|
||||
WMStartStateStr[3] = wmStartStateTextBox4.Text;
|
||||
WMStartState[3] = Utils.ParseUDouble(wmStartStateTextBox4.Text);
|
||||
}
|
||||
if (wmStartStateTextBox5.Enabled)
|
||||
{
|
||||
WMStartStateStr[4] = wmStartStateTextBox5.Text;
|
||||
WMStartState[4] = Utils.ParseUDouble(wmStartStateTextBox5.Text);
|
||||
}
|
||||
if (wmStartStateTextBox6.Enabled)
|
||||
{
|
||||
WMStartStateStr[5] = wmStartStateTextBox6.Text;
|
||||
WMStartState[5] = Utils.ParseUDouble(wmStartStateTextBox6.Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
catch
|
||||
{
|
||||
log.ErrorFormat("Exception: {0}", e.Message);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace TBF.BenchControl.Elde
|
||||
EnduranceCycleStop = 13,
|
||||
}
|
||||
|
||||
#if FUZHOU300 || PT200IL || TORINO50 || BADGER_MALA_TRAT || BADGER_STREDNA_TRAT || TURA_IPERL || TURA_SPECIAL || BADGER_VELKA_TRAT || PUCHONG_PT200 || SLM_50 || GENESIS || MALTA_WSD25 || SLM_END || WARSAW_END || BERLIN || SLM_150 || PETERSBURG_50 || PETERSBURG_200 || KEMPNO_50 || BAHRAIN_50 || RUM_MOB || KRAKOW_50 || JUZNA_AFRIKA_50 || ZAMBIA || SENTEC
|
||||
#if FUZHOU300 || PT200IL || TORINO50 || BADGER_MALA_TRAT || BADGER_STREDNA_TRAT || TURA_IPERL || TURA_SPECIAL || BADGER_VELKA_TRAT || PUCHONG_PT200 || SLM_50 || GENESIS || MALTA_WSD25 || SLM_END || WARSAW_END || BERLIN || SLM_150 || PETERSBURG_50 || PETERSBURG_200 || KEMPNO_50 || BAHRAIN_50 || RUM_MOB || KRAKOW_50
|
||||
public enum StatusP : ulong
|
||||
{
|
||||
RefFlowMeterMask = 0x7, /// bits 0,1,2
|
||||
|
||||
@@ -53,7 +53,6 @@ namespace TBF.BenchControl.Elde
|
||||
public UInt128 RRoute { get { return controlCom.RRoute; } }
|
||||
public uint DivTime(int id) { return controlCom.DivTime(id); }
|
||||
public float TTime { get { return controlCom.TTime; } }
|
||||
public float ImpulseTime(int wmNr1) { return controlCom.ImpulseTime(wmNr1); }
|
||||
public uint FmState { get { return controlCom.FmState; } }
|
||||
public uint BeginState(int wmNr0) { return controlCom.BeginState(wmNr0); }
|
||||
public double ReferenceFlow { get { return controlCom.ReferenceFlow; } }
|
||||
@@ -126,7 +125,7 @@ namespace TBF.BenchControl.Elde
|
||||
public uint[] DiverterEdge; /// Created and initialized in this.Initialize()
|
||||
|
||||
// Array length is the reference flowmeters count plus one
|
||||
#if DN100 || FUZHOU150 || FUZHOU300 || PT200IL || PUCHONG_PT200 || SLM_150 || SENTEC
|
||||
#if DN100 || FUZHOU150 || FUZHOU300 || PT200IL || PUCHONG_PT200 || SLM_150
|
||||
public uint[,] RegValveCalib = new uint[8,2] {{100,500},{100,500},{100,500},{100,500},{100,500},{100,500},{100,500},{100,500}};
|
||||
public byte[] MeretRS485Address = new byte[4];
|
||||
public float[] EtCalib = new float[6] { 1, 1, 1, 1, 1, 1 };
|
||||
@@ -137,7 +136,7 @@ namespace TBF.BenchControl.Elde
|
||||
{100,500}, {100,500}, {100,500}, {100,500} };
|
||||
public byte[] MeretRS485Address = new byte[4];
|
||||
public float[] EtCalib = new float[7] { 1, 1, 1, 1, 1, 1, 1 };
|
||||
#elif MUNICH || TORINO50 || BADGER_MALA_TRAT || BADGER_STREDNA_TRAT || TORUN_PT50_2015 || CEVAK_PT40_272 || TURA_IPERL || TURA_SPECIAL || MURES_PT40 || FUZHOU_40 || SLM_50 || PETERSBURG_50 || KEMPNO_50 || BAHRAIN_50 || KRAKOW_50 || JUZNA_AFRIKA_50 || ZAMBIA
|
||||
#elif MUNICH || TORINO50 || BADGER_MALA_TRAT || BADGER_STREDNA_TRAT || TORUN_PT50_2015 || CEVAK_PT40_272 || TURA_IPERL || TURA_SPECIAL || MURES_PT40 || FUZHOU_40 || SLM_50 || PETERSBURG_50 || KEMPNO_50 || BAHRAIN_50 || KRAKOW_50
|
||||
public uint[,] RegValveCalib = new uint[8,2] {{100,500},{100,500},{100,500},{100,500},{100,500},{100,500},{100,500},{100,500}};
|
||||
public byte[] MeretRS485Address = new byte[4];
|
||||
public float[] EtCalib = new float[5] { 1, 1, 1, 1, 1 };
|
||||
@@ -226,7 +225,7 @@ namespace TBF.BenchControl.Elde
|
||||
|
||||
for (int i = 0; i < MettlerToledo.Multi.BalanceDev.BalancesCount; i++)
|
||||
{
|
||||
controlCom.SetWeight(i, MettlerToledo.Multi.BalanceDev.Masses[i]);
|
||||
controlCom.SetWeight(i, MettlerToledo.Multi.BalanceDev.Masses[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -430,14 +429,11 @@ namespace TBF.BenchControl.Elde
|
||||
{
|
||||
if (DebugLevel == DebugMode.Simulate) return;
|
||||
|
||||
uint filter = Convert.ToUInt32(filterConstant);
|
||||
///
|
||||
if (sendCommandFlag)
|
||||
{
|
||||
controlCom.SendCommand(cmd, refNr, (benchModelRoute & routeMask),
|
||||
totalRefPulses, massRefPulses, testMethods,
|
||||
new uint[] { filter, filter, filter, filter, filter, filter, filter, filter },
|
||||
FMFreq, regConst, shortImp, stopDevs);
|
||||
filterConstant, FMFreq, regConst, shortImp, stopDevs);
|
||||
}
|
||||
|
||||
controlCom.RunDeviceAfter();
|
||||
|
||||
@@ -21,9 +21,9 @@ namespace TBF.BenchControl.Elde
|
||||
public float ReferenceFreq { get { return referenceFreq; } }
|
||||
|
||||
int[] etPulses = new int[Config.Data.WMsCount + 1];
|
||||
public int EtPulses(int wmNr1)
|
||||
public int EtPulses(int wmNr1and0)
|
||||
{
|
||||
return etPulses[wmNr1];
|
||||
return etPulses[wmNr1and0];
|
||||
}
|
||||
|
||||
public int EtPulsesK { get { return 1; } }
|
||||
@@ -54,9 +54,8 @@ namespace TBF.BenchControl.Elde
|
||||
public uint DivTime(int id) { return 0; }
|
||||
public void SetDivLimit(int divNo, uint limLoPct, uint limHiPct) { }
|
||||
|
||||
float tTime = 1;
|
||||
float tTime = 0;
|
||||
public float TTime { get { return tTime; } }
|
||||
public float ImpulseTime(int wmNr1) { return tTime; }
|
||||
|
||||
public uint FmState { get { return 0; } }
|
||||
public uint BeginState(int wmNr0) { return 0; }
|
||||
@@ -113,7 +112,7 @@ namespace TBF.BenchControl.Elde
|
||||
int totalRefPulses;
|
||||
int massRefPulses;
|
||||
TestMethods testMethods;
|
||||
uint[] filterConstants;
|
||||
float filterConstant;
|
||||
float[] FMFreq;
|
||||
int regConst;
|
||||
int shortImp;
|
||||
@@ -174,7 +173,7 @@ namespace TBF.BenchControl.Elde
|
||||
/// <param name="stopDevs">What to stop</param>
|
||||
public void SendCommand(Command cmd, int refFlowmtrNr, UInt128 route,
|
||||
int totalRefPulses, int massRefPulses, TestMethods testMethods,
|
||||
uint[] filterConstants, float[] fmFreq, int regConst, int shortImp, StopDevs stopDevs)
|
||||
float filterConstant, float[] fmFreq, int regConst, int shortImp, StopDevs stopDevs)
|
||||
{
|
||||
log.InfoFormat("SendCommand(Cmd={0},Ref#={1},Route={2} {3} {4} {5},TotalPls={6},MassPls={7},TstM={8},filt={9},FM=[{10}{11}{12}{13}{14}{15}],Reg={16},ShrtImp={17},Stop={18})",
|
||||
cmd, refFlowmtrNr, /// 0, 1
|
||||
@@ -182,7 +181,7 @@ namespace TBF.BenchControl.Elde
|
||||
((route >> 32) & 0xFFFF).ToString("X4"), /// 3
|
||||
((route >> 16) & 0xFFFF).ToString("X4"), /// 4
|
||||
(route & 0xFFFF).ToString("X4"), /// 5
|
||||
totalRefPulses, massRefPulses, testMethods, filterConstants, /// 6, 7, 8, 9
|
||||
totalRefPulses, massRefPulses, testMethods, filterConstant, /// 6, 7, 8, 9
|
||||
fmFreq[0].ToString(), /// 10
|
||||
(fmFreq.Length > 1) ? ("," + fmFreq[1].ToString()) : "", /// 11
|
||||
(fmFreq.Length > 2) ? ("," + fmFreq[2].ToString()) : "", /// 12
|
||||
@@ -206,13 +205,13 @@ namespace TBF.BenchControl.Elde
|
||||
bool bit39 = (route & 0x00FC000000000000) != 0; /// true if any of bits 50 through 55 is set
|
||||
route = route & 0xFF03FFFFFFFFFFFF;
|
||||
if (bit39) route = route | 0x0000008000000000;
|
||||
log.DebugFormat("SendCommand route = {0}", Utils.RouteToStr(route));
|
||||
log.DebugFormat("SendCommand route = {0}", Utils.ShowRoute(route));
|
||||
#endif
|
||||
TestBenchSim.SimRoute = this.simRoute = route;
|
||||
this.totalRefPulses = totalRefPulses;
|
||||
this.massRefPulses = massRefPulses;
|
||||
this.testMethods = testMethods;
|
||||
this.filterConstants = filterConstants;
|
||||
this.filterConstant = filterConstant;
|
||||
this.FMFreq = fmFreq;
|
||||
this.regConst = regConst;
|
||||
this.shortImp = shortImp;
|
||||
|
||||
@@ -18,7 +18,6 @@ namespace TBF.BenchControl.Elde
|
||||
/// Properties
|
||||
///
|
||||
public StatusP StatusP { get { return (StatusP)ctrlBrdComponent.StatusP; } }
|
||||
|
||||
#if DN100 || MUNICH || FUZHOU150
|
||||
public float ReferenceFreq { get { return 1000.0f * ctrlBrdComponent.referenceFreq; } } /// In [Hz] 0..2500, nom.=2000
|
||||
#else /// all newer benches
|
||||
@@ -32,16 +31,13 @@ namespace TBF.BenchControl.Elde
|
||||
/// </summary>
|
||||
public float ReferenceFreq { get { return 1000.0f * ctrlBrdComponent.referenceFreq[0]; } } /// In [Hz] 0..2500, nom.=2000
|
||||
#endif
|
||||
|
||||
public int EtPulses(int wmNr1) { return (int)ctrlBrdComponent.etPulses[wmNr1]; }
|
||||
|
||||
#if GENESIS || BERLIN || SLM_150 || PETERSBURG_50 || PETERSBURG_200 || KEMPNO_50 || BAHRAIN_50 || RUM_MOB || KRAKOW_50 || JUZNA_AFRIKA_50 || ZAMBIA || SENTEC
|
||||
public int EtPulses(int wmNr0) { return (int)ctrlBrdComponent.etPulses[wmNr0]; }
|
||||
#if FUZHOU300 || PT200IL || PUCHONG_PT200 || GENESIS || BERLIN || SLM_150 || PETERSBURG_50 || PETERSBURG_200 || KEMPNO_50 || BAHRAIN_50 || RUM_MOB || KRAKOW_50
|
||||
public int EtPulsesK { get { return (int)ctrlBrdComponent.etPulsesK; } }
|
||||
#else
|
||||
public int EtPulsesK { get { return 1; } }
|
||||
public int EtPulsesK { get { return 1; } }
|
||||
#endif
|
||||
|
||||
public UInt16 WMeterPulses(int wmNr1) { return (UInt16)ctrlBrdComponent.wMeterPuls[wmNr1]; }
|
||||
public UInt16 WMeterPulses(int wmNr0) { return (UInt16)ctrlBrdComponent.wMeterPuls[wmNr0]; }
|
||||
public int WMeterReference(int wmNr0) { return (int)ctrlBrdComponent.wMeterReference[wmNr0]; }
|
||||
public uint RegulValveDAC { get { return ctrlBrdComponent.StavDA; } }
|
||||
public float Pressure(int prsNr0) { return ctrlBrdComponent.pressure[prsNr0]; }
|
||||
@@ -53,7 +49,7 @@ namespace TBF.BenchControl.Elde
|
||||
public UInt128 RRoute { get { return ctrlBrdComponent.rRoute; } }
|
||||
#endif
|
||||
|
||||
#if GENESIS || KEMPNO_50 || KRAKOW_50 || BAHRAIN_50 || BADGER_STREDNA_TRAT || JUZNA_AFRIKA_50 || ZAMBIA || SENTEC
|
||||
#if GENESIS || KEMPNO_50 || KRAKOW_50 || BAHRAIN_50 || BADGER_STREDNA_TRAT
|
||||
public uint DivTime(int id) { return ctrlBrdComponent.divTime[id]; }
|
||||
public void SetDivLimit(int divNo, uint limLoPct, uint limHiPct)
|
||||
{
|
||||
@@ -61,17 +57,11 @@ namespace TBF.BenchControl.Elde
|
||||
ctrlBrdComponent.DIVLimit[divNo, 1] = limHiPct;
|
||||
}
|
||||
#else
|
||||
public uint DivTime(int id) { return ctrlBrdComponent.divTime; }
|
||||
public uint DivTime(int id) { return ctrlBrdComponent.divTime; }
|
||||
public void SetDivLimit(int divNo, uint limLoPct, uint limHiPct) { }
|
||||
#endif
|
||||
|
||||
public float TTime { get { return ctrlBrdComponent.Ttime; } }
|
||||
#if DN100 || MUNICH
|
||||
public float ImpulseTime(int wmNr1) { return ctrlBrdComponent.Ttime; }
|
||||
#else
|
||||
public float ImpulseTime(int wmNr1) { return ctrlBrdComponent.ImpulseTime[wmNr1]; }
|
||||
#endif
|
||||
|
||||
#if DN100 || MUNICH || FUZHOU150
|
||||
public uint FmState { get { return ctrlBrdComponent.fMState; } }
|
||||
#else //if everything newer
|
||||
@@ -90,7 +80,7 @@ namespace TBF.BenchControl.Elde
|
||||
public float AnalogInput(int adcNr0) { return ctrlBrdComponent.Analogy[adcNr0]; }
|
||||
public uint AnalogInputRaw(int adcNr0, int bank) { return ctrlBrdComponent.AnalogyRaw[adcNr0, bank]; } /// bank0=RV, bank1=Temp
|
||||
|
||||
#if DN100 || MUNICH || BADGER_MALA_TRAT || BADGER_VELKA_TRAT || FUZHOU_40 || FUZHOU150 || FUZHOU300 || PT200IL || PUCHONG_PT200 || TORINO50 || TORUN_PT50_2015 || CEVAK_PT40_272 || MURES_PT40
|
||||
#if DN100 || MUNICH || BADGER_MALA_TRAT || BADGER_VELKA_TRAT || FUZHOU40 || FUZHOU150 || FUZHOU300 || PT200IL || PUCHONG_PT200 || TORINO50 || TORUN_PT50_2015 || CEVAK_PT40_272 || MURES_PT40
|
||||
public float TotalRefVolume { get { return ctrlBrdComponent.ReferenceVolume; } }
|
||||
public float MassRefVolume { get { return ctrlBrdComponent.ReferenceVolume; } }
|
||||
#else /// all new test benches
|
||||
@@ -106,7 +96,7 @@ namespace TBF.BenchControl.Elde
|
||||
public uint[] WMeterCont { get { return new uint[3]; } } /// Dummy
|
||||
#endif
|
||||
|
||||
#if KEMPNO_50 || KRAKOW_50 || JUZNA_AFRIKA_50 || ZAMBIA
|
||||
#if KEMPNO_50 || KRAKOW_50
|
||||
public float ValveOpenCloseTime { get { return ctrlBrdComponent.ValveMoveTime[0]; } }
|
||||
#else
|
||||
public float ValveOpenCloseTime { get { return 0.001f; } }
|
||||
@@ -227,15 +217,13 @@ namespace TBF.BenchControl.Elde
|
||||
for (int i = 0; i < divEdge.Length; i++) log.FatalFormat(" divEdge[{0}] = {1}", i, divEdge[i]);
|
||||
for (int i = 0; i < balanceRange.Length; i++) log.FatalFormat(" balanceRange[{0}] = {1}", i, balanceRange[i]);
|
||||
|
||||
//#if (DN100)
|
||||
ctrlBrdComponent.ExternalCom = true;
|
||||
|
||||
#if SENTEC
|
||||
ctrlBrdComponent.SendCalibData(rvCalib, meretA, (byte)usedCom, tempCalib, etCalib, divEdge, balanceRange, (byte)123);
|
||||
#else
|
||||
//#endif
|
||||
ctrlBrdComponent.SendCalibData(rvCalib, meretA, (byte)usedCom, tempCalib, etCalib, divEdge, balanceRange);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Control of regulating valves.
|
||||
///
|
||||
@@ -263,12 +251,17 @@ namespace TBF.BenchControl.Elde
|
||||
///
|
||||
private void DoValveMove(int valveNo, RegulValveMode valveMode, float[] valveValue, int stableTime)
|
||||
{
|
||||
#if DN100 || MUNICH || FUZHOU150
|
||||
//TBF.UiBridge.Bridge.OnLog(this, string.Format("{0} ValveMove({1}, {2}, [{3}, {4}])\r\n",
|
||||
// DateTime.Now.ToLongTimeString(),
|
||||
// valveNo,
|
||||
// valveMode,
|
||||
// valveValue[0],
|
||||
// valveValue[1]));
|
||||
log.InfoFormat("ValveMove(#={0}, md={1}, [{2}, {3}])", valveNo, valveMode, valveValue[0], valveValue[1]);
|
||||
#if DN100 || MUNICH || FUZHOU150
|
||||
ctrlBrdComponent.ValveMove((byte)valveNo, (byte)valveMode, valveValue);
|
||||
#else /// all newer benches
|
||||
log.InfoFormat("ValveMove(#={0}, md={1}, [{2}, {3}], {4})", valveNo, valveMode, valveValue[0], valveValue[1], stableTime);
|
||||
ctrlBrdComponent.ValveMove((byte)valveNo, (byte)valveMode, valveValue, stableTime);
|
||||
ctrlBrdComponent.ValveMove((byte)valveNo, (byte)valveMode, valveValue, stableTime);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -281,37 +274,37 @@ namespace TBF.BenchControl.Elde
|
||||
/// <param name="route">Route: 64-bit installation specific number</param>
|
||||
/// <param name="refPulses">Test duration as a number of reference flow meter pulses</param>
|
||||
/// <param name="testMethods">See ControlBoard.TestMethods enum</param>
|
||||
/// <param name="filterConstants">0 = No filtering (0..255)</param>
|
||||
/// <param name="filterConstant">0 = No filtering (0..255)</param>
|
||||
/// <param name="FMFreq">Freq.inverter control (not applicable in DT100, Munich)</param>
|
||||
/// <param name="regConst">Coefficient used to control the regulation valve (1..100)</param>
|
||||
/// <param name="shortImp">0 = default value, 1 = spec. processing of very short pulses</param>
|
||||
/// <param name="stopDevs">What to stop</param>
|
||||
public void SendCommand(Command cmd, int refFlowMeterNr, UInt128 route,
|
||||
int totalRefPulses, int massRefPulses, TestMethods testMethods,
|
||||
uint[] filterConstants, float[] fmFreq, int regConst, int shortImp, StopDevs stopDevs)
|
||||
float filterConstant, float[] fmFreq, int regConst, int shortImp, StopDevs stopDevs)
|
||||
{
|
||||
if (Program.MainWnd.InvokeRequired)
|
||||
{
|
||||
/// When SendCommand(...) called from the worker thread
|
||||
object[] args = new object[] { cmd, refFlowMeterNr, route, totalRefPulses, massRefPulses,
|
||||
testMethods, filterConstants, fmFreq, regConst, shortImp, stopDevs };
|
||||
testMethods, filterConstant, fmFreq, regConst, shortImp, stopDevs };
|
||||
Program.MainWnd.Invoke((SendCommandDlgt)DoSendCommand, args); /// Component was created in UI thread - use Invoke()
|
||||
}
|
||||
else
|
||||
{
|
||||
/// When SendCommand(...) called from the UI thread
|
||||
DoSendCommand(cmd, refFlowMeterNr, route, totalRefPulses, massRefPulses, testMethods,
|
||||
filterConstants, fmFreq, regConst, shortImp, stopDevs);
|
||||
filterConstant, fmFreq, regConst, shortImp, stopDevs);
|
||||
}
|
||||
}
|
||||
///
|
||||
delegate void SendCommandDlgt(Command cmd, int refFlowmtrNr, UInt128 route,
|
||||
int totalRefPulses, int massRefPulses, TestMethods testMethods,
|
||||
uint[] filterConstants, float[] fmFreq, int regConst, int shortImp, StopDevs stopDevs);
|
||||
float filterConstant, float[] fmFreq, int regConst, int shortImp, StopDevs stopDevs);
|
||||
///
|
||||
private void DoSendCommand(Command cmd, int refFlowMeterNr, UInt128 route,
|
||||
int totalRefPulses, int massRefPulses, TestMethods testMethods,
|
||||
uint[] filterConstants, float[] fmFreq, int regConst, int shortImp, StopDevs stopDevs)
|
||||
float filterConstant, float[] fmFreq, int regConst, int shortImp, StopDevs stopDevs)
|
||||
{
|
||||
//TBF.UiBridge.Bridge.OnLog(this, string.Format("{0} SendCommand({1}, {2}, {3}, {4}, {5}, {6}, [{7},{8}], {9}, {10}, {11})\r\n",
|
||||
// DateTime.Now.ToLongTimeString(),
|
||||
@@ -353,7 +346,7 @@ namespace TBF.BenchControl.Elde
|
||||
cmd, /// 0
|
||||
refFlowMeterNr, /// 1
|
||||
Utils.RouteToStr(route), /// 2
|
||||
totalRefPulses, massRefPulses, testMethods, filterConstants, /// 3, 4, 5, 6
|
||||
totalRefPulses, massRefPulses, testMethods, filterConstant, /// 3, 4, 5, 6
|
||||
fmFreq[0].ToString(), /// 7
|
||||
(fmFreq.Length > 1) ? ("," + fmFreq[1].ToString()) : "", /// 8
|
||||
(fmFreq.Length > 2) ? ("," + fmFreq[2].ToString()) : "", /// 9
|
||||
@@ -364,22 +357,18 @@ namespace TBF.BenchControl.Elde
|
||||
|
||||
#if DN100 || MUNICH
|
||||
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)route, (uint)totalRefPulses, (uint)testMethods,
|
||||
Convert.ToSingle(filterConstants[0]), fmFreq[0], (uint)regConst, (uint)shortImp, (uint)stopDevs);
|
||||
#elif BADGER_MALA_TRAT || BADGER_VELKA_TRAT || FUZHOU_40 || FUZHOU150 || FUZHOU300 || PT200IL || PUCHONG_PT200 || TORINO50 || TORUN_PT50_2015 || CEVAK_PT40_272 || MURES_PT40
|
||||
filterConstant, fmFreq[0], (uint)regConst, (uint)shortImp, (uint)stopDevs);
|
||||
#elif BADGER_MALA_TRAT || BADGER_VELKA_TRAT || FUZHOU40 || FUZHOU150 || FUZHOU300 || PT200IL || PUCHONG_PT200 || TORINO50 || TORUN_PT50_2015 || CEVAK_PT40_272 || MURES_PT40
|
||||
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)route, (uint)totalRefPulses, (uint)testMethods,
|
||||
Convert.ToSingle(filterConstants[0]), fmFreq, (uint)regConst, (uint)shortImp, (uint)stopDevs);
|
||||
filterConstant, fmFreq, (uint)regConst, (uint)shortImp, (uint)stopDevs);
|
||||
#elif GENESIS || BERLIN || SLM_150 || PETERSBURG_200
|
||||
uint[] pulsesArr = new uint[] { (uint)totalRefPulses, (uint)massRefPulses };
|
||||
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)(route & (UInt128)0xFFFFFFFFFFFFFFFF), (ulong)(route >> 64), pulsesArr, (uint)testMethods,
|
||||
Convert.ToSingle(filterConstants[0]), fmFreq, (uint)regConst, (uint)shortImp, (uint)stopDevs);
|
||||
#elif JUZNA_AFRIKA_50 || ZAMBIA || SENTEC
|
||||
uint[] pulsesArr = new uint[] { (uint)totalRefPulses, (uint)massRefPulses };
|
||||
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)route, pulsesArr, (uint)testMethods,
|
||||
filterConstants, fmFreq, (uint)regConst, (uint)shortImp, (uint)stopDevs);
|
||||
filterConstant, fmFreq, (uint)regConst, (uint)shortImp, (uint)stopDevs);
|
||||
#else /// if TURA_IPERL || TURA_SPECIAL || MALTA_WSD25 || SLM_50 || SLM_END || WARSAW_END || PETERSBURG_50 || KEMPNO_50 || BAHRAIN_50 || RUM_MOB || KRAKOW_50 || BADGER_STREDNA_TRAT
|
||||
uint[] pulsesArr = new uint[] { (uint)totalRefPulses, (uint)massRefPulses };
|
||||
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)route, pulsesArr, (uint)testMethods,
|
||||
Convert.ToSingle(filterConstants[0]), fmFreq, (uint)regConst, (uint)shortImp, (uint)stopDevs);
|
||||
filterConstant, fmFreq, (uint)regConst, (uint)shortImp, (uint)stopDevs);
|
||||
#endif
|
||||
log.InfoFormat("DoSendCommand() Route = {0}", Utils.RouteToStr(route));
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
public static int[] DivStartingLevelPct;
|
||||
public static int[] DivStoppingLevelPct;
|
||||
|
||||
readonly int diverterNr0; /// 0-based diverter number
|
||||
public int DiverterNr { get { return diverterNr0 + 1; } } /// 1-based public diverter number
|
||||
protected int diverterNr; /// 0-based diverter number
|
||||
|
||||
|
||||
|
||||
readonly DiverterCfg diverterCfg;
|
||||
@@ -64,7 +64,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
|
||||
|
||||
|
||||
diverterNr0 = nextIdx++;
|
||||
diverterNr = nextIdx++;
|
||||
///
|
||||
if (Diverters == null || Diverters.Length < nextIdx)
|
||||
{
|
||||
@@ -161,13 +161,10 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
DiverterCfg tmpcfg = args.Cfg as DiverterCfg;
|
||||
if (tmpcfg != null && tmpcfg.Name.Equals(Name))
|
||||
{
|
||||
int diverterNr = int.Parse(Name.Substring(3));
|
||||
#if GENESIS || PETERSBURG_50 || PETERSBURG_200 || FUZHOU_40 || FUZHOU150 || FUZHOU300
|
||||
int flowMtrNr = diverterNr + 1;
|
||||
#elif BADGER_STREDNA_TRAT
|
||||
int flowMtrNr = (diverterNr == 1) ? 1 : ((diverterNr == 2) ? 9 : 20);
|
||||
#else
|
||||
int flowMtrNr = (diverterNr == 1) ? 1 : 3;
|
||||
#if GENESIS || PETERSBURG_200
|
||||
int flowMtrNr = int.Parse(Name.Substring(3)) + 1;
|
||||
#else /// PETERSBURG_50
|
||||
int flowMtrNr = Name.Contains("1") ? 1 : 3;
|
||||
#endif
|
||||
|
||||
if (args.Command == CfgChangeCmd.CfgChange)
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace TBF.BenchControl.Elde.FixedStartRegisterReader
|
||||
public class RRProcedureParams : ProcedureParamsBase, IParamsProvider, IProcedureParams
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(RRProcedureParams) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
protected override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public double PulsesPerLtr; /// Target low limit of the flow increase or decrease
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace TBF.BenchControl.Elde.FixedStartRegisterReader
|
||||
return pars;
|
||||
}
|
||||
|
||||
public override void UpdateFromDbEntity(ComponentProcedure dbEntity)
|
||||
public override void UpdateProcedureParams(ComponentProcedure dbEntity)
|
||||
{
|
||||
if (dbEntity == null) return;
|
||||
try
|
||||
|
||||
@@ -17,8 +17,7 @@ namespace TBF.BenchControl.Elde.FixedStartRegisterReader
|
||||
readonly ControlBoardDev controlBoard;
|
||||
|
||||
|
||||
public Config.Entities.RegisterReaderType RegisterReaderType { get { return Config.Entities.RegisterReaderType.Manual; } }
|
||||
public double PulsesPerLtr { get { return registerReaderCfg.ProcParams.PulsesPerLtr; } }
|
||||
public double PulsesPerLtr { get { return registerReaderCfg.ProcParams.PulsesPerLtr; } }
|
||||
public double LtrsPerPulse { get { return (PulsesPerLtr <= float.Epsilon) ? 1.0 : (1 / PulsesPerLtr); } }
|
||||
|
||||
|
||||
|
||||
@@ -20,15 +20,20 @@ namespace TBF.BenchControl.Elde.FixedStartRegisterReader
|
||||
/// <summary> Procedure parameters </summary>
|
||||
[XmlIgnore]
|
||||
public RRProcedureParams ProcParams;
|
||||
public override IParamsProvider GetRuntimeProcParamsProvider() { return ProcParams; }
|
||||
public override IParamsProvider CreateProcParamsProvider() { return new RRProcedureParams(true); }
|
||||
public override IParamsProvider GetProcedureParams() { return ProcParams; }
|
||||
public override IParamsProvider CreateProcedureParams(Procedure procedure)
|
||||
{
|
||||
RRProcedureParams procParams = new RRProcedureParams(true);
|
||||
procParams.UpdateProcedureParams(Name, procedure);
|
||||
return procParams;
|
||||
}
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
RegisterReaderCfg()
|
||||
{
|
||||
Name = "Dummy";
|
||||
ParentName = "CB";
|
||||
ProcParams = new RRProcedureParams(true);
|
||||
ProcParams = new RRProcedureParams(true);
|
||||
}
|
||||
|
||||
public RegisterReaderCfg(IComponentFactory factory)
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace TBF.BenchControl.Elde.FlowMeter
|
||||
{
|
||||
if (corr.RangeIx == rangeIx) rangeCorrections.Add(corr);
|
||||
}
|
||||
double correctedFlow = Config.Formulas.CorrectedValue(flow, rangeCorrections);
|
||||
double correctedFlow = BenchControl.Formulas.CorrectedValue(flow, rangeCorrections);
|
||||
return (float)(LtrPerPulse * correctedFlow / flow);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,26 +47,6 @@ namespace TBF.BenchControl.Elde.FlowMeter
|
||||
public double Press5Lo;
|
||||
public double Press5Hi;
|
||||
|
||||
/// Calibration info serialized parameters displayed in Metrology tab page
|
||||
public string CalibCertificateNr;
|
||||
public string CalibCertificate1;
|
||||
public string CalibCertificate2;
|
||||
public string CalibCertificate3;
|
||||
public string CalibCertificate4;
|
||||
public string CalibCertificate5;
|
||||
public DateTime CalibDate;
|
||||
public DateTime CalibDate1;
|
||||
public DateTime CalibDate2;
|
||||
public DateTime CalibDate3;
|
||||
public DateTime CalibDate4;
|
||||
public DateTime CalibDate5;
|
||||
public DateTime CalibValidDate;
|
||||
public DateTime CalibValidDate1;
|
||||
public DateTime CalibValidDate2;
|
||||
public DateTime CalibValidDate3;
|
||||
public DateTime CalibValidDate4;
|
||||
public DateTime CalibValidDate5;
|
||||
|
||||
|
||||
public bool RangeEnabled(int rangeIx1)
|
||||
{
|
||||
@@ -138,6 +118,26 @@ namespace TBF.BenchControl.Elde.FlowMeter
|
||||
}
|
||||
}
|
||||
|
||||
/// Calibration info serialized parameters displayed in Metrology tab page
|
||||
public string CalibCertificateNr;
|
||||
public string CalibCertificate1;
|
||||
public string CalibCertificate2;
|
||||
public string CalibCertificate3;
|
||||
public string CalibCertificate4;
|
||||
public string CalibCertificate5;
|
||||
public DateTime CalibDate;
|
||||
public DateTime CalibDate1;
|
||||
public DateTime CalibDate2;
|
||||
public DateTime CalibDate3;
|
||||
public DateTime CalibDate4;
|
||||
public DateTime CalibDate5;
|
||||
public DateTime CalibValidDate;
|
||||
public DateTime CalibValidDate1;
|
||||
public DateTime CalibValidDate2;
|
||||
public DateTime CalibValidDate3;
|
||||
public DateTime CalibValidDate4;
|
||||
public DateTime CalibValidDate5;
|
||||
|
||||
public string GetCalibCertificate(int rangeIx1)
|
||||
{
|
||||
switch (rangeIx1)
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace TBF.BenchControl.Elde.FlowMeterTriplet
|
||||
if (flow < 0.1 * NominalFlow) return LtrPerPulse; /// No correction for small flow
|
||||
|
||||
/// Apply correction
|
||||
double correctedFlow = Config.Formulas.CorrectedValue(flow, Corrections);
|
||||
double correctedFlow = BenchControl.Formulas.CorrectedValue(flow, Corrections);
|
||||
return (float)(LtrPerPulse * correctedFlow / flow);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@ namespace TBF.BenchControl.Elde
|
||||
{
|
||||
StatusP StatusP { get; }
|
||||
float ReferenceFreq { get; }
|
||||
int EtPulses(int wmNr1);
|
||||
int EtPulses(int wmNr0);
|
||||
int EtPulsesK { get; }
|
||||
UInt16 WMeterPulses(int wmNr1);
|
||||
UInt16 WMeterPulses(int wmNr0);
|
||||
int WMeterReference(int wmNr0);
|
||||
uint RegulValveDAC { get; }
|
||||
float Pressure(int prsNr0);
|
||||
@@ -21,7 +21,6 @@ namespace TBF.BenchControl.Elde
|
||||
UInt128 RRoute { get; }
|
||||
uint DivTime(int id); /// 50% id=0, 10% id=1, 90% id=2
|
||||
float TTime { get; }
|
||||
float ImpulseTime(int WMNr1);
|
||||
uint FmState { get; }
|
||||
uint BeginState(int wmNr0);
|
||||
float ReferenceFlow { get; }
|
||||
@@ -68,7 +67,7 @@ namespace TBF.BenchControl.Elde
|
||||
/// <param name="shortImp">0 = default value, 1 = spec. processing of very short pulses</param>
|
||||
/// <param name="stopDevs">What to stop</param>
|
||||
void SendCommand(Command cmd, int refNr, UInt128 route, int totalRefPulses, int massRefPulses, TestMethods testMethods,
|
||||
uint[] filterConstants, float[] fmFreq, int regConst, int shortImp, StopDevs stopDevs);
|
||||
float filterConstant, float[] fmFreq, int regConst, int shortImp, StopDevs stopDevs);
|
||||
|
||||
/// <summary>
|
||||
/// Control of regulating valves.
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace TBF.BenchControl.Elde.RegisterReader
|
||||
public class RRProcedureParams : ProcedureParamsBase, IParamsProvider, IProcedureParams
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(RRProcedureParams) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
protected override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public double PulsesPerLtr; /// [l^-1]
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace TBF.BenchControl.Elde.RegisterReader
|
||||
return pars;
|
||||
}
|
||||
|
||||
public override void UpdateFromDbEntity(ComponentProcedure dbEntity)
|
||||
public override void UpdateProcedureParams(ComponentProcedure dbEntity)
|
||||
{
|
||||
if (dbEntity == null) return;
|
||||
try
|
||||
|
||||
@@ -17,8 +17,7 @@ namespace TBF.BenchControl.Elde.RegisterReader
|
||||
|
||||
public int Position { get { return registerReaderCfg.Position; } } /// 1 .. inf
|
||||
///
|
||||
public Config.Entities.RegisterReaderType RegisterReaderType { get { return Config.Entities.RegisterReaderType.Pulses; } }
|
||||
public double PulsesPerLtr { get { return registerReaderCfg.ProcParams.PulsesPerLtr; } }
|
||||
public double PulsesPerLtr { get { return registerReaderCfg.ProcParams.PulsesPerLtr; } }
|
||||
public double LtrsPerPulse { get { return (PulsesPerLtr <= float.Epsilon) ? 1.0 : (1 / PulsesPerLtr); ; } }
|
||||
|
||||
public int WMPulses { get { return wmPulses; } }
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace TBF.BenchControl.Elde.RegisterReader
|
||||
public class RegisterReaderCfg : ComponentCfgBase, Generic.IChildComponentCfg
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(RegisterReaderCfg) })[0];
|
||||
protected override XmlSerializer GetSerializer() { return Serializer; }
|
||||
protected override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl() { return new RegisterReaderCfgCtrl(); }
|
||||
|
||||
@@ -22,13 +22,18 @@ namespace TBF.BenchControl.Elde.RegisterReader
|
||||
/// <summary> Procedure parameters </summary>
|
||||
[XmlIgnore]
|
||||
public RRProcedureParams ProcParams;
|
||||
public override IParamsProvider GetRuntimeProcParamsProvider() { return ProcParams; }
|
||||
public override IParamsProvider CreateProcParamsProvider() { return new RRProcedureParams(true); }
|
||||
public override IParamsProvider GetProcedureParams() { return ProcParams; }
|
||||
public override IParamsProvider CreateProcedureParams(Procedure procedure)
|
||||
{
|
||||
RRProcedureParams procParams = new RRProcedureParams(true);
|
||||
procParams.UpdateProcedureParams(Name, procedure);
|
||||
return procParams;
|
||||
}
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
RegisterReaderCfg()
|
||||
{
|
||||
ProcParams = new RRProcedureParams(true);
|
||||
ProcParams = new RRProcedureParams(true);
|
||||
}
|
||||
|
||||
public RegisterReaderCfg(string name, IComponentFactory factory)
|
||||
|
||||
@@ -29,11 +29,9 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
public int StableTime { get { return RegulValveCfg.StableTime; } } /// 0=200ms, step=50ms, max. 1500ms (max.26)
|
||||
public int FlowStableSec { get { return RegulValveCfg.FlowStableSec; } } /// 0..60 sec
|
||||
///
|
||||
public bool IsCoax { get { return false; } }
|
||||
public bool IsCoax { get { return false; } }
|
||||
///
|
||||
public float Position { get { return ControlBoard.RValvePosition(Idx1); } }
|
||||
///
|
||||
int adcChannel;
|
||||
|
||||
|
||||
#region Configuration Change Handling
|
||||
@@ -73,8 +71,13 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
}
|
||||
else if (args.Command == CfgChangeCmd.GetAdc1 || args.Command == CfgChangeCmd.GetAdc2)
|
||||
{
|
||||
int adcValue = (int)ControlBoard.AnalogInputRaw(adcChannel, 0);
|
||||
RegulValveCfgCtrl.OnCmdResponse(this, new CmdResponseArgs(args.Command, Idx1, adcValue));
|
||||
int adc;
|
||||
#if GENESIS
|
||||
adc = (int)ControlBoard.AnalogInputRaw((Idx1 < 6) ? (Idx1 - 1) : (Idx1 - 2), 0);
|
||||
#else
|
||||
adc = (int)ControlBoard.AnalogInputRaw(Idx1 - 1, 0);
|
||||
#endif
|
||||
RegulValveCfgCtrl.OnCmdResponse(this, new CmdResponseArgs(args.Command, Idx1, adc));
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -108,17 +111,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
Name, ControlBoard.RegValveCalib.GetLength(0), Idx1, Idx1 - 1);
|
||||
}
|
||||
|
||||
#if GENESIS
|
||||
adcChannel = (Idx1 < 6) ? (Idx1 - 1) : (Idx1 - 2);
|
||||
#elif SENTEC
|
||||
adcChannel = (Idx1 < 3) ? (Idx1 - 1) : (Idx1 - 2);
|
||||
#else
|
||||
adcChannel = Idx1 - 1;
|
||||
#endif
|
||||
|
||||
StartChangeHandler();
|
||||
|
||||
log.Debug(this.ToString());
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
|
||||
@@ -128,8 +121,8 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
public void Initialize() { }
|
||||
public void RunDeviceBefore()
|
||||
{
|
||||
int adcValue = (int)ControlBoard.AnalogInputRaw(adcChannel, 0);
|
||||
Handlers.OnAdcChanged(this, new CmdResponseArgs(CfgChangeCmd.GetAdc, Idx1, adcValue));
|
||||
int adc = (int)ControlBoard.AnalogInputRaw(Idx1 - 1, 0);
|
||||
Handlers.OnAdcChanged(this, new CmdResponseArgs(CfgChangeCmd.GetAdc, Idx1, adc));
|
||||
}
|
||||
public void RunDeviceAfter() { }
|
||||
public void StopDevice() { }
|
||||
|
||||
@@ -14,17 +14,20 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(SetFlowOp));
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("SetFlowOp({0}, Qfrom={1}, Qto={2}, PID={3})", regulValve.Name, requiredFlowLo, requiredFlowHi, pidCoef);
|
||||
return string.Format("SetFlowOp({0}, Qfrom={1}, Qto={2}, PID={3})", regulValve.Name, finalReqFlowLo, finalReqFlowHi, pidCoef);
|
||||
}
|
||||
|
||||
const int CoaxValveNr = 7; /// Coax. valve has number 7
|
||||
|
||||
|
||||
/// Set by the constructor
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly Elde.RegulValve.RegulValve regulValve;
|
||||
readonly int regulValveNr;
|
||||
readonly IFlowMeter flowMeter;
|
||||
readonly float requiredFlowLo;
|
||||
readonly float requiredFlowHi;
|
||||
readonly float requiredFlowAve;
|
||||
readonly float finalReqFlowLo;
|
||||
readonly float finalReqFlowHi;
|
||||
readonly float reqFlowAve;
|
||||
readonly float pidCoef;
|
||||
readonly int timeout;
|
||||
readonly bool leaveMeasurementRunning;
|
||||
@@ -92,9 +95,9 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
|
||||
nominalFlow = flowMeter.NominalFlow;
|
||||
|
||||
this.requiredFlowLo = requiredFlowLo;
|
||||
this.requiredFlowHi = requiredFlowHi;
|
||||
this.requiredFlowAve = (requiredFlowLo + requiredFlowHi) / 2.0f;
|
||||
this.finalReqFlowLo = requiredFlowLo;
|
||||
this.finalReqFlowHi = requiredFlowHi;
|
||||
this.reqFlowAve = (requiredFlowLo + requiredFlowHi) / 2.0f;
|
||||
this.pidCoef = pidCoef;
|
||||
|
||||
if (flowBox == null) throw new ArgumentNullException("flowBox");
|
||||
@@ -155,7 +158,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
|
||||
void StoreTargetPosition(float avgReqFlow, float actPosition)
|
||||
{
|
||||
if (!regulValve.Dict.ContainsKey(requiredFlowAve))
|
||||
if (!regulValve.Dict.ContainsKey(reqFlowAve))
|
||||
{
|
||||
regulValve.Dict.Add(new KeyValuePair<float, float>(avgReqFlow, actPosition));
|
||||
}
|
||||
@@ -166,20 +169,25 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
public void Start()
|
||||
{
|
||||
double flowMtrFreq = flowMeter.ReadFrequency();
|
||||
currentReqFlowLo = reqFlowAve;
|
||||
currentReqFlowHi = reqFlowAve;
|
||||
double flow = flowMeter.ReadFlow();
|
||||
|
||||
currentReqFlowLo = requiredFlowLo; /// Default lower limit
|
||||
currentReqFlowHi = requiredFlowHi; /// Default upper limit
|
||||
///
|
||||
if (flow != 0)
|
||||
{
|
||||
flowBox.Val = flow;
|
||||
if (flow >= requiredFlowAve) currentReqFlowHi = requiredFlowAve; /// Decrease upper limit
|
||||
if (flow <= requiredFlowAve) currentReqFlowLo = requiredFlowAve; /// Increase lower limit
|
||||
if (flow >= reqFlowAve) currentReqFlowLo = finalReqFlowLo;
|
||||
if (flow <= reqFlowAve) currentReqFlowHi = finalReqFlowHi;
|
||||
}
|
||||
else
|
||||
{
|
||||
currentReqFlowLo = finalReqFlowLo; /// Unexpected case when flowMtrFreq==0
|
||||
currentReqFlowHi = finalReqFlowHi;
|
||||
}
|
||||
|
||||
flowWithinBoundsTime = 0;
|
||||
|
||||
if (regulValve.RegulValveCfg.StoredPositionReuse && FetchTargetPosition(requiredFlowAve, out targetPositionLo, out targetPositionHi))
|
||||
if (regulValve.RegulValveCfg.StoredPositionReuse && FetchTargetPosition(reqFlowAve, out targetPositionLo, out targetPositionHi))
|
||||
{
|
||||
log.InfoFormat("SetFlowOp:Start() rv#={0} flowMtr#={1} TARGET: flowLo={2} flowHi={3} FETCHED: posLo={4} posHi={5}",
|
||||
regulValveNr, flowMeter.Idx1, currentReqFlowLo, currentReqFlowHi, targetPositionLo, targetPositionHi);
|
||||
@@ -218,20 +226,19 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
if (flow != 0)
|
||||
{
|
||||
flowBox.Val = flow;
|
||||
if (flow >= reqFlowAve) currentReqFlowLo = finalReqFlowLo;
|
||||
if (flow <= reqFlowAve) currentReqFlowHi = finalReqFlowHi;
|
||||
}
|
||||
|
||||
log.InfoFormat("SetFlowOp:Run(T={0}) rv#={1} pos={2}% freq={3} flow={4} opState={5}",
|
||||
StateMachine.Time - expireTime + timeout, regulValveNr, rvPosition.ToString("F1"), flowMtrFreq, flow, opState);
|
||||
log.InfoFormat("SetFlowOp:Run() rv#={0} pos={1}% freq={2} flow={3} opState={4}",
|
||||
regulValveNr, rvPosition.ToString("F1"), flowMtrFreq, flow, opState);
|
||||
|
||||
if (StateMachine.Time > expireTime)
|
||||
{
|
||||
return Event.RegulValveTimeOut;
|
||||
}
|
||||
else if (opState == OpState.SendCommandAgain)
|
||||
|
||||
if (opState == OpState.SendCommandAgain)
|
||||
{
|
||||
flowWithinBoundsTime = 0;
|
||||
|
||||
if (regulValve.RegulValveCfg.StoredPositionReuse && FetchTargetPosition(requiredFlowAve, out targetPositionLo, out targetPositionHi))
|
||||
if (regulValve.RegulValveCfg.StoredPositionReuse && FetchTargetPosition(reqFlowAve, out targetPositionLo, out targetPositionHi))
|
||||
{
|
||||
log.InfoFormat("Run(): rv#={0} flowMtr#={1} TARGET: flowLo={2} flowHi={3} FETCHED: posLo={4} posHi={5}",
|
||||
regulValveNr, flowMeter.Idx1, currentReqFlowLo, currentReqFlowHi, targetPositionLo, targetPositionHi);
|
||||
@@ -246,6 +253,9 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
opState = OpState.ValveMoveToFlow1;
|
||||
}
|
||||
|
||||
expireTime = StateMachine.Time + timeout;
|
||||
if (expireTime < 0) expireTime = int.MaxValue;
|
||||
|
||||
TestMethods tm = 0;
|
||||
StopDevs sd = 0;
|
||||
// '_regulValve.RegulValveCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
|
||||
@@ -288,7 +298,20 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
opState = OpState.SendCommandAgain;
|
||||
return Event.None;
|
||||
}
|
||||
else if (controlBoard.RegulValveState(regulValveNr) != RegulValveState.DacValueRegul)
|
||||
else if (regulValveNr == CoaxValveNr && ((ulong)controlBoard.StatusP & (ulong)StatusP.CoaxRegValveBusy) == 0)
|
||||
{
|
||||
/// Repeat appropriate ValveMove(...) command
|
||||
controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetPosition,
|
||||
new float[2] { (targetPositionLo + targetPositionHi) / 2, (targetPositionLo + targetPositionHi) / 2 },
|
||||
regulValve.StableTime);
|
||||
|
||||
log.InfoFormat("SetFlowOp: ValveMove({0}, Position, {1}, {2}, {3})",
|
||||
regulValveNr, (targetPositionLo + targetPositionHi) / 2, (targetPositionLo + targetPositionHi) / 2, regulValve.StableTime);
|
||||
|
||||
opState = OpState.ValveMoveToPosition3;
|
||||
return Event.None;
|
||||
}
|
||||
else if (regulValveNr < 6 && controlBoard.RegulValveState(regulValveNr) != RegulValveState.DacValueRegul)
|
||||
{
|
||||
/// Repeat appropriate ValveMove(...) command
|
||||
controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetPosition,
|
||||
@@ -357,13 +380,28 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
}
|
||||
else if (opState == OpState.CheckStateFlow) /// Verify the flow setting
|
||||
{
|
||||
if ( ((ulong)controlBoard.StatusP & (ulong)StatusP.RefPulsesMsrmnt) == 0 ||
|
||||
(controlBoard.RegulValveState(regulValveNr) & RegulValveState.PwOrFreqRegul) != RegulValveState.PwOrFreqRegul)
|
||||
if (regulValveNr != CoaxValveNr && (((ulong)controlBoard.StatusP & (ulong)StatusP.RefPulsesMsrmnt) == 0 ||
|
||||
(controlBoard.RegulValveState(regulValveNr) & RegulValveState.PwOrFreqRegul) != RegulValveState.PwOrFreqRegul))
|
||||
{
|
||||
opState = OpState.SendCommandAgain;
|
||||
return Event.None;
|
||||
}
|
||||
else if (controlBoard.RegulValveState(regulValveNr) != RegulValveState.PwOrFreqRegul)
|
||||
else if (regulValveNr == CoaxValveNr && ((ulong)controlBoard.StatusP & (ulong)StatusP.CoaxRegValveBusy) == 0)
|
||||
{
|
||||
/// Done once, issues an appropriate ValveMove(...) command
|
||||
float freqLo = 2000.0f * currentReqFlowLo / nominalFlow;
|
||||
float freqHi = 2000.0f * currentReqFlowHi / nominalFlow;
|
||||
controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetFrequency,
|
||||
new float[2] { (freqLo + freqHi) / 2.0f, (freqLo + freqHi) / 2.0f },
|
||||
regulValve.StableTime);
|
||||
|
||||
log.InfoFormat("SetFlowOp: ValveMove({0}, Frequency, {1}, {2}, {3})",
|
||||
regulValveNr, (freqLo + freqHi) / 2.0f, (freqLo + freqHi) / 2.0f, regulValve.StableTime);
|
||||
|
||||
opState = OpState.ValveMoveToFlow3;
|
||||
return Event.None;
|
||||
}
|
||||
else if (regulValveNr < 6 && controlBoard.RegulValveState(regulValveNr) != RegulValveState.PwOrFreqRegul)
|
||||
{
|
||||
/// Done once, issues an appropriate ValveMove(...) command
|
||||
float freqLo = 2000.0f * currentReqFlowLo / nominalFlow;
|
||||
@@ -396,19 +434,19 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
if (regulValve.RegulValveCfg.StoredPositionReuse)
|
||||
{
|
||||
float storedPosition;
|
||||
if (regulValve.Dict.TryGetValue(requiredFlowAve, out storedPosition))
|
||||
if (regulValve.Dict.TryGetValue(reqFlowAve, out storedPosition))
|
||||
{
|
||||
/// update the stored valve position
|
||||
StoreTargetPosition(requiredFlowAve, (rvPosition + storedPosition) / 2.0f);
|
||||
StoreTargetPosition(reqFlowAve, (rvPosition + storedPosition) / 2.0f);
|
||||
log.InfoFormat("Run(): rv#={0} reqFlow={1} pos={2}% stored={3} <--- Updating a stored position",
|
||||
regulValveNr, requiredFlowAve, rvPosition.ToString("F1"), storedPosition);
|
||||
regulValveNr, reqFlowAve, rvPosition.ToString("F1"), storedPosition);
|
||||
}
|
||||
else
|
||||
{
|
||||
/// store the valve position
|
||||
StoreTargetPosition(requiredFlowAve, rvPosition);
|
||||
StoreTargetPosition(reqFlowAve, rvPosition);
|
||||
log.InfoFormat("Run(): rv#={0} reqFlow={1} pos={2}% <--- Storing a new position",
|
||||
regulValveNr, requiredFlowAve, rvPosition.ToString("F1"));
|
||||
regulValveNr, reqFlowAve, rvPosition.ToString("F1"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -76,44 +76,44 @@ namespace TBF.BenchControl.Elde
|
||||
/// <param name="valvesOpen">A list of opening master valves</param>
|
||||
/// <param name="valvesClose">A list of closing master valves</param>
|
||||
/// <returns></returns>
|
||||
IList<SwitchPoint> AddSwitchPoints(IList<SwitchPoint> swPoints, IList<IValve> valvesOpen, IList<IValve> valvesClose, int time)
|
||||
IList<SwitchPoint> CollectSwitchPoints(IList<IValve> valvesOpen, IList<IValve> valvesClose)
|
||||
{
|
||||
int ix0 = swPoints.Count;
|
||||
swPoints.Add(new SwitchPoint(time, valvesOpen, valvesClose));
|
||||
IList<SwitchPoint> result = new List<SwitchPoint>();
|
||||
result.Add(new SwitchPoint(0, valvesOpen, valvesClose));
|
||||
|
||||
foreach (var valve in StateMachine.CoupledValves)
|
||||
{
|
||||
if ((!valve.InvertCouple && valvesOpen.Contains(valve.CoupledTo)) ||
|
||||
(valve.InvertCouple && valvesClose.Contains(valve.CoupledTo)))
|
||||
{
|
||||
/// The coupled valve 'valve' is opening
|
||||
int lag = time + valve.LagOpening;
|
||||
if (lag == time)
|
||||
{
|
||||
swPoints[ix0].VOpen.Add(valve);
|
||||
}
|
||||
else
|
||||
{
|
||||
swPoints.Add(new SwitchPoint(lag, ValveBase.MakeList(valve), null));
|
||||
}
|
||||
}
|
||||
else if ((!valve.InvertCouple && valvesClose.Contains(valve.CoupledTo)) ||
|
||||
(valve.InvertCouple && valvesOpen.Contains(valve.CoupledTo)))
|
||||
{
|
||||
/// The coupled valve 'valve' is closing
|
||||
int lag = time + valve.LagClosing;
|
||||
if (lag == time)
|
||||
{
|
||||
swPoints[ix0].VClose.Add(valve);
|
||||
}
|
||||
else
|
||||
{
|
||||
swPoints.Add(new SwitchPoint(lag, null, ValveBase.MakeList(valve)));
|
||||
}
|
||||
}
|
||||
}
|
||||
return swPoints;
|
||||
}
|
||||
foreach (var valve in StateMachine.CoupledValves)
|
||||
{
|
||||
if ((!valve.InvertCouple && valvesOpen.Contains(valve.CoupledTo)) ||
|
||||
(valve.InvertCouple && valvesClose.Contains(valve.CoupledTo)))
|
||||
{
|
||||
/// The coupled valve 'valve' is opening
|
||||
int time = valve.LagOpening;
|
||||
if (time == 0)
|
||||
{
|
||||
result[0].VOpen.Add(valve);
|
||||
}
|
||||
else
|
||||
{
|
||||
result.Add(new SwitchPoint(time, ValveBase.MakeList(valve), null));
|
||||
}
|
||||
}
|
||||
else if ((!valve.InvertCouple && valvesClose.Contains(valve.CoupledTo)) ||
|
||||
(valve.InvertCouple && valvesOpen.Contains(valve.CoupledTo)))
|
||||
{
|
||||
/// The coupled valve 'valve' is closing
|
||||
int time = valve.LagClosing;
|
||||
if (time == 0)
|
||||
{
|
||||
result[0].VClose.Add(valve);
|
||||
}
|
||||
else
|
||||
{
|
||||
result.Add(new SwitchPoint(time, null, ValveBase.MakeList(valve)));
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
IList<SwitchPoint> SortAndMergeSwitchPoints(IList<SwitchPoint> unsorted)
|
||||
@@ -188,8 +188,7 @@ namespace TBF.BenchControl.Elde
|
||||
if (valvesOpen == null) valvesOpen = new List<IValve>();
|
||||
if (valvesClose == null) valvesClose = new List<IValve>();
|
||||
|
||||
switchPointsRaw = new List<SwitchPoint>();
|
||||
AddSwitchPoints(switchPointsRaw, valvesOpen, valvesClose, 0);
|
||||
switchPointsRaw = CollectSwitchPoints(valvesOpen, valvesClose);
|
||||
switchPoints = SortAndMergeSwitchPoints(switchPointsRaw);
|
||||
int timeShift = -switchPoints[0].TimeSec;
|
||||
MakeMasks(switchPoints, timeShift);
|
||||
@@ -208,62 +207,6 @@ namespace TBF.BenchControl.Elde
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// OPEN or CLOSE start/stop valve and associated valves and/or pumps.
|
||||
/// Events: ValvesSet
|
||||
/// </summary>
|
||||
/// <param name="controlBoard">Control board device</param>
|
||||
/// <param name="close">true: close start valve, false: open start valve</param>
|
||||
/// <param name="outPath">OutputPath specifying the start valve and associated valves/pumps</param>
|
||||
/// <remarks>Only Elde.Valve valves are used, other valves on the lists are ignored</remarks>
|
||||
public SetValvesOp(ControlBoardDev controlBoard, bool close, OutputPath outPath)
|
||||
{
|
||||
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
|
||||
this.controlBoard = controlBoard;
|
||||
|
||||
IList<IValve> none = new List<IValve>(); /// An empty list of valves
|
||||
switchPointsRaw = new List<SwitchPoint>();
|
||||
|
||||
if (close)
|
||||
{
|
||||
if (outPath.InvertSV1) AddSwitchPoints(switchPointsRaw, ValveBase.MakeList(outPath.StartValve1), none, 0);
|
||||
else AddSwitchPoints(switchPointsRaw, none, ValveBase.MakeList(outPath.StartValve1), 0);
|
||||
|
||||
if (outPath.StartValve2 != null)
|
||||
{
|
||||
if (outPath.InvertSV2) AddSwitchPoints(switchPointsRaw, ValveBase.MakeList(outPath.StartValve2), none, outPath.LagSV2);
|
||||
else AddSwitchPoints(switchPointsRaw, none, ValveBase.MakeList(outPath.StartValve2), outPath.LagSV2);
|
||||
}
|
||||
|
||||
if (outPath.StartValve3 != null)
|
||||
{
|
||||
if (outPath.InvertSV3) AddSwitchPoints(switchPointsRaw, ValveBase.MakeList(outPath.StartValve3), none, outPath.LagSV3);
|
||||
else AddSwitchPoints(switchPointsRaw, none, ValveBase.MakeList(outPath.StartValve3), outPath.LagSV3);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (outPath.InvertSV1) AddSwitchPoints(switchPointsRaw, none, ValveBase.MakeList(outPath.StartValve1), 0);
|
||||
else AddSwitchPoints(switchPointsRaw, ValveBase.MakeList(outPath.StartValve1), none, 0);
|
||||
|
||||
if (outPath.StartValve2 != null)
|
||||
{
|
||||
if (outPath.InvertSV2) AddSwitchPoints(switchPointsRaw, none, ValveBase.MakeList(outPath.StartValve2), -outPath.LagSV2);
|
||||
else AddSwitchPoints(switchPointsRaw, ValveBase.MakeList(outPath.StartValve2), none, -outPath.LagSV2);
|
||||
}
|
||||
|
||||
if (outPath.StartValve3 != null)
|
||||
{
|
||||
if (outPath.InvertSV3) AddSwitchPoints(switchPointsRaw, none, ValveBase.MakeList(outPath.StartValve3), -outPath.LagSV3);
|
||||
else AddSwitchPoints(switchPointsRaw, ValveBase.MakeList(outPath.StartValve3), none, -outPath.LagSV3);
|
||||
}
|
||||
}
|
||||
|
||||
switchPoints = SortAndMergeSwitchPoints(switchPointsRaw);
|
||||
int timeShift = -switchPoints[0].TimeSec;
|
||||
MakeMasks(switchPoints, timeShift);
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
|
||||
@@ -15,7 +15,6 @@ namespace TBF.BenchControl.Elde
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly Elde.RegulValve.RegulValve regulValve;
|
||||
readonly int regulValveNr;
|
||||
readonly int regulValveStableTime;
|
||||
readonly int flowMeterNr;
|
||||
readonly float nominalFlow;
|
||||
readonly float reqFlowLo;
|
||||
@@ -81,24 +80,17 @@ namespace TBF.BenchControl.Elde
|
||||
|
||||
if (outputPath.RegulValve is Elde.RegulValve.RegulValve)
|
||||
{
|
||||
Elde.RegulValve.RegulValve rv = outputPath.RegulValve as Elde.RegulValve.RegulValve;
|
||||
regulValveNr = rv.Idx1;
|
||||
regulValveStableTime = rv.StableTime;
|
||||
}
|
||||
else if (outputPath.RegulValve is Elde.RegulValveCoax.RegulValve)
|
||||
{
|
||||
Elde.RegulValveCoax.RegulValve rv = outputPath.RegulValve as Elde.RegulValveCoax.RegulValve;
|
||||
regulValveNr = rv.Idx1;
|
||||
regulValveStableTime = rv.StableTime;
|
||||
}
|
||||
else if (!(outputPath.RegulValve is Dummy.RegulValve.RegulValve))
|
||||
regulValve = outputPath.RegulValve as Elde.RegulValve.RegulValve;
|
||||
regulValveNr = this.regulValve.Idx1;
|
||||
}
|
||||
else if (!(outputPath.RegulValve is Dummy.RegulValve.RegulValve))
|
||||
{
|
||||
throw new ArgumentNullException("Regulation valve is not compatible with Elde Control Board");
|
||||
}
|
||||
|
||||
if (outputPath.Diverter is Elde.Diverter.Diverter)
|
||||
{
|
||||
diverterNr = (outputPath.Diverter as Elde.Diverter.Diverter).DiverterNr;
|
||||
diverterNr = (outputPath.Diverter as Elde.Diverter.Diverter).AdcNr - 4;
|
||||
}
|
||||
|
||||
nominalFlow = outputPath.FlowMeter.NominalFlow;
|
||||
@@ -122,7 +114,7 @@ namespace TBF.BenchControl.Elde
|
||||
#if TURA_IPERL || TURA_SPECIAL || BADGER_VELKA_TRAT || SLM_50
|
||||
int flowMeterIdxAndDiv = flowMeterNr + 16 * diverterNr;
|
||||
#elif BADGER_STREDNA_TRAT
|
||||
int flowMeterIdxAndDiv = flowMeterNr + 8 * (diverterNr - 1);
|
||||
int flowMeterIdxAndDiv = flowMeterNr + 8 * diverterNr;
|
||||
#else
|
||||
int flowMeterIdxAndDiv = flowMeterNr;
|
||||
#endif
|
||||
@@ -191,7 +183,7 @@ namespace TBF.BenchControl.Elde
|
||||
float freqHi = 2000.0f * reqFlowHi / nominalFlow;
|
||||
controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetFrequency,
|
||||
new float[2] { freqLo, freqHi },
|
||||
regulValveStableTime);
|
||||
regulValve.StableTime);
|
||||
|
||||
opState = OpState.OpCompleted;
|
||||
return Event.None;
|
||||
|
||||
@@ -78,23 +78,15 @@ namespace TBF.BenchControl.Elde
|
||||
}
|
||||
else
|
||||
{
|
||||
opState = OpState.ResendCommand;
|
||||
//opState = OpState.ResendCommand;
|
||||
return Event.None;
|
||||
}
|
||||
}
|
||||
else if (opState == OpState.ResendCommand)
|
||||
{
|
||||
if ((controlBoard.StatusP & (StatusP.TestCompleted | StatusP.TestInProgress)) == 0)
|
||||
{
|
||||
opState = OpState.Stopped;
|
||||
return Event.PreviousStopped;
|
||||
}
|
||||
else
|
||||
{
|
||||
SendStopCommand();
|
||||
opState = OpState.CheckIfStopped;
|
||||
return Event.None;
|
||||
}
|
||||
SendStopCommand();
|
||||
opState = OpState.CheckIfStopped;
|
||||
return Event.None;
|
||||
}
|
||||
else if (opState == OpState.Stopped)
|
||||
{
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace TBF.BenchControl.Elde.TempMeter
|
||||
{
|
||||
if (Cfg.DebugLevel == Config.Entities.DebugMode.Normal)
|
||||
{
|
||||
return Config.Formulas.CorrectedValue((double)ControlBoard.Temperature(Idx0), Corrections);
|
||||
return BenchControl.Formulas.CorrectedValue((double)ControlBoard.Temperature(Idx0), Corrections);
|
||||
}
|
||||
else if (Cfg.DebugLevel == Config.Entities.DebugMode.Simulate)
|
||||
{
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace TBF.BenchControl.Elde.TempMeterInternal
|
||||
|
||||
public double ReadTemperature()
|
||||
{
|
||||
return Config.Formulas.CorrectedValue((double)ControlBoard.Temperature(Idx0), Corrections);
|
||||
return BenchControl.Formulas.CorrectedValue((double)ControlBoard.Temperature(Idx0), Corrections);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
|
||||
namespace Config
|
||||
namespace TBF.BenchControl
|
||||
{
|
||||
public static class Formulas
|
||||
{
|
||||
@@ -83,50 +83,19 @@ namespace Config
|
||||
0.191203,
|
||||
0.049025,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculate density of distilled water from temperature
|
||||
/// </summary>
|
||||
/// <param name="t">ITS-90 temperature in [°C]</param>
|
||||
/// <returns>Density in [kg/m3]</returns>
|
||||
public static double DistilledWaterDensityFromTemp(double t)
|
||||
{
|
||||
if (t <= 40)
|
||||
{
|
||||
const double c0 = 999.839564;
|
||||
const double c1 = 0.067998613;
|
||||
const double c2 = -0.0091101468;
|
||||
const double c3 = 0.00010058299;
|
||||
const double c4 = -0.0000011275659;
|
||||
const double c5 = 6.5985371e-09;
|
||||
|
||||
return ((((c5 * t + c4) * t + c3) * t + c2) * t + c1) * t + c0;
|
||||
}
|
||||
else
|
||||
{
|
||||
const double a0 = 9.9983952E2;
|
||||
const double a1 = 1.6952577E1;
|
||||
const double a2 = -7.9905127E-3;
|
||||
const double a3 = -4.6241757E-5;
|
||||
const double a4 = 1.0584601E-7;
|
||||
const double a5 = -2.8103006E-10;
|
||||
const double b = 1.6887236E-2;
|
||||
|
||||
return (((((a5 * t + a4) * t + a3) * t + a2) * t + a1) * t + a0) / (1.0 + b * t);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculate density of distilled water from temperature (obsolete)
|
||||
/// Calculate density of distilled water from temperature
|
||||
/// </summary>
|
||||
/// <param name="t">IPTS-68 temperature in [°C]</param>
|
||||
/// <param name="t">Temperature in [°C]</param>
|
||||
/// <returns>Density in [kg/m3]</returns>
|
||||
public static double DistilledWaterDensityFromTempIPTS68(double t)
|
||||
public static double DistilledWaterDensityFromTemp(double t)
|
||||
{
|
||||
const double a0 = 999.842594;
|
||||
const double a1 = 0.06793952;
|
||||
const double a2 = -0.009095290;
|
||||
const double a2 = -0.00909529;
|
||||
const double a3 = 0.0001001685;
|
||||
const double a4 = -0.000001120083;
|
||||
const double a5 = 6.536332e-09;
|
||||
@@ -153,29 +122,12 @@ namespace Config
|
||||
/// </summary>
|
||||
/// <param name="t">Temperature in [°C]</param>
|
||||
/// <returns>Density in [kg/m3]</returns>
|
||||
public static double WaterDensityFromTemp(double t, double realDensity, double atTemperature)
|
||||
public static double WaterDensityFromTemp(double t)
|
||||
{
|
||||
return DistilledWaterDensityFromTemp(t) + DensityCorrection(realDensity, atTemperature);
|
||||
return DistilledWaterDensityFromTemp(t) +
|
||||
DensityCorrection(Program.LocalSettings.RealDensity, Program.LocalSettings.AtTemperature);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculate corrected (real) water density from temperature
|
||||
/// </summary>
|
||||
/// <param name="t">Temperature in [°C]</param>
|
||||
/// <returns>Density in [kg/m3]</returns>
|
||||
public static double WaterDensityFromTempPress(double temp, double pressure, double realDensity, double atTemperature)
|
||||
{
|
||||
double x0 = 5.08821E-10;
|
||||
double x1 = 1.2639418;
|
||||
double x2 = 0.2660269;
|
||||
double x3 = 0.3734838;
|
||||
double x4 = 2.0205242;
|
||||
double theta = temp / 100.0;
|
||||
double B = x0 * (((x3 * theta + x2) * theta + x1) * theta + 1) / (1 + x4 * theta);
|
||||
|
||||
return WaterDensityFromTemp(temp, realDensity, atTemperature) * (1 + B * Config.Units.ConvertTo(Config.Unit.Pa, pressure));
|
||||
}
|
||||
|
||||
|
||||
public static float AirDensityFromAmbientVales(float tempC, float pressureBar, float humiPct)
|
||||
{
|
||||
@@ -2,7 +2,6 @@
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using Config.Entities;
|
||||
|
||||
namespace TBF.BenchControl.Generic
|
||||
{
|
||||
@@ -53,51 +52,19 @@ namespace TBF.BenchControl.Generic
|
||||
///
|
||||
IComponentCfgCtrl GetControl();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Creates a procedure parameters provider (specific for each component).
|
||||
/// </summary>
|
||||
/// <returns>Prodedure parameters provider or null</returns>
|
||||
IParamsProvider CreateProcParamsProvider();
|
||||
|
||||
/// <summary>
|
||||
/// Returns runtime procedure parameters provider - one per component updated by LoadProcedureParamsFromDB(...).
|
||||
/// </summary>
|
||||
/// <returns>Prodedure parameters provider or null</returns>
|
||||
IParamsProvider GetRuntimeProcParamsProvider();
|
||||
|
||||
/// <summary>
|
||||
/// Returns UI procedure parameters provider - one per ComponentProcedure DB entity.
|
||||
/// </summary>
|
||||
/// <returns>Prodedure parameters provider or null</returns>
|
||||
IParamsProvider GetUIProcParamsProvider(Config.Entities.Procedure procedure);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Creates a test parameters provider (specific for each component).
|
||||
/// </summary>
|
||||
/// <returns>Test parameters provider or null</returns>
|
||||
IParamsProvider CreateTestParamsProvider();
|
||||
|
||||
/// <summary>
|
||||
/// Returns runtime test parameters provider - one per component updated by LoadtestParamsFromDB(...).
|
||||
/// </summary>
|
||||
/// <returns>Test parameters provider or null</returns>
|
||||
IParamsProvider GetRuntimeTestParamsProvider();
|
||||
|
||||
/// <summary>
|
||||
/// Returns UI test parameters provider - one per ComponentTest DB entity.
|
||||
/// </summary>
|
||||
/// <returns>Test parameters provider or null</returns>
|
||||
IParamsProvider GetUITestParamsProvider(Config.Entities.Test test);
|
||||
|
||||
|
||||
///
|
||||
/// Used in run time when a procedure is loaded or a test is started
|
||||
///
|
||||
void LoadProcedureParamsFromDB(Config.Entities.Procedure procedure);
|
||||
void LoadTestParamsFromDB(Config.Entities.Test test);
|
||||
///
|
||||
/// Procedure parameters provider support
|
||||
///
|
||||
IParamsProvider GetProcedureParams();
|
||||
void UpdateProcedureParams(Config.Entities.Procedure procedure);
|
||||
IParamsProvider CreateProcedureParams(Config.Entities.Procedure procedure);
|
||||
|
||||
///
|
||||
/// Test parameters provider support
|
||||
///
|
||||
IParamsProvider GetTestParams();
|
||||
void UpdateTestParams(Config.Entities.Test test);
|
||||
IParamsProvider CreateTestParams(Config.Entities.Test test);
|
||||
|
||||
string ToString(int i);
|
||||
}
|
||||
|
||||
@@ -1,17 +1,10 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Config.Entities
|
||||
namespace TBF.BenchControl.Generic
|
||||
{
|
||||
public interface IParamsProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// Get XML Serializer
|
||||
/// </summary>
|
||||
XmlSerializer GetSerializer();
|
||||
|
||||
string ComponentName { get; }
|
||||
|
||||
/// <summary>
|
||||
@@ -52,7 +45,7 @@ namespace Config.Entities
|
||||
/// <param name="strValue">String representation of the parameter</param>
|
||||
void UpdateParam(int ix, string strValue);
|
||||
|
||||
void UpdateEmbeddedDbEntity();
|
||||
void UpdateDbEntity();
|
||||
|
||||
/// <summary>
|
||||
/// Creates an object copy
|
||||
@@ -1,14 +1,11 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using Config.Entities;
|
||||
|
||||
namespace TBF.BenchControl.Generic
|
||||
{
|
||||
public interface IProcedureParams
|
||||
{
|
||||
void UpdateFromDbEntity(ComponentProcedure dbEntity);
|
||||
void FromDbEntity(string componentName, Procedure procedure);
|
||||
ComponentProcedure ToDbEntity(string componentName, Procedure procedure);
|
||||
void UpdateProcedureParams(string componentName, Config.Entities.Procedure procedure);
|
||||
Config.Entities.ComponentProcedure ToDbEntity(string componentName, Config.Entities.Procedure procedure);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using Config.Entities;
|
||||
|
||||
namespace TBF.BenchControl.Generic
|
||||
{
|
||||
public interface ITestParams
|
||||
{
|
||||
void UpdateFromDbEntity(ComponentTest dbEntity);
|
||||
void FromDbEntity(string componentName, Test test);
|
||||
ComponentTest ToDbEntity(string componentName, Test test);
|
||||
void UpdateTestParams(string componentName, Config.Entities.Test test);
|
||||
Config.Entities.ComponentTest ToDbEntity(string componentName, Config.Entities.Test test);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
|
||||
namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
interface IDatastreamReader : IRegisterReader
|
||||
{
|
||||
bool NoSamples { get; }
|
||||
double VolumeLtrStart { get; }
|
||||
double VolumeLtrEnd { get; }
|
||||
double TimestampSecStart { get; }
|
||||
double TimestampSecEnd { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
|
||||
namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
interface IHasTestName
|
||||
{
|
||||
string TestName { set; }
|
||||
int TestRepeats { set; }
|
||||
int RepetitionNr { set; }
|
||||
}
|
||||
}
|
||||
@@ -8,10 +8,8 @@ namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
public interface IRegisterReader : IComponent
|
||||
{
|
||||
Config.Entities.RegisterReaderType RegisterReaderType { get; }
|
||||
|
||||
double PulsesPerLtr { get; } /// [imp/l] ... water meter or volume measurement part of a heat meter
|
||||
double LtrsPerPulse { get; } /// [l/imp]
|
||||
double PulsesPerLtr { get; } /// [l^-1] ... water meter or volume measurement part of a heat meter
|
||||
double LtrsPerPulse { get; } /// [l]
|
||||
|
||||
int WMPulses { get; } /// Counted pulses of the water meter
|
||||
int WMRefPulses { get; } /// 'Gated' reference pulses of the water meters
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user