Chinese translations, part 2

This commit is contained in:
Milan Hanajik 2016-03-16 21:06:51 +08:00
parent aee1990243
commit a9c7e1fa25
8 changed files with 372 additions and 1261 deletions

View File

@ -115,12 +115,14 @@
<Compile Include="Mappings\WMTypeMap.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Resources\Strings.Designer.cs" />
<Compile Include="ResultItemSpec.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\Strings.cs.resx" />
<EmbeddedResource Include="Resources\Strings.de.resx" />
<EmbeddedResource Include="Resources\Strings.resx">
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Resources\Strings.zh-CN.resx" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 1.3
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,128 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 1.3
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Administrator" xml:space="preserve">
<value>Administrator</value>
</data>
<data name="Calibration_Specialist" xml:space="preserve">
<value>Kalibriertechniker</value>
</data>
<data name="Head_of_Lab" xml:space="preserve">
<value>Laborleiter</value>
</data>
<data name="Maintenance_Specialist" xml:space="preserve">
<value>Wartungstechniker</value>
</data>
<data name="Metrologist" xml:space="preserve">
<value>Messtechniker</value>
</data>
<data name="Tester" xml:space="preserve">
<value>Prüfer</value>
</data>
<data name="Testing_Specialist" xml:space="preserve">
<value>Prüftechniker</value>
</data>
<data name="Failed" xml:space="preserve">
<value>NiO</value>
</data>
<data name="Passed" xml:space="preserve">
<value>iO</value>
</data>
</root>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,128 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 1.3
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Administrator" xml:space="preserve">
<value>管理员</value>
</data>
<data name="Calibration_Specialist" xml:space="preserve">
<value>校准专员</value>
</data>
<data name="Failed" xml:space="preserve">
<value>NOK</value>
</data>
<data name="Head_of_Lab" xml:space="preserve">
<value>实验室负责人</value>
</data>
<data name="Maintenance_Specialist" xml:space="preserve">
<value>维护专员</value>
</data>
<data name="Metrologist" xml:space="preserve">
<value>计量者</value>
</data>
<data name="Passed" xml:space="preserve">
<value>好</value>
</data>
<data name="Tester" xml:space="preserve">
<value>测试仪</value>
</data>
<data name="Testing_Specialist" xml:space="preserve">
<value>测试专员</value>
</data>
</root>

View File

@ -1,241 +0,0 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using Config.Entities;
using Config.Resources;
namespace Config
{
public class ResultItemSpec
{
///
/// 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(MeterTestResult meterTestResult);
private readonly PrintDlgt printDlgt;
public bool CanPrintSingle { get { return (printDlgt != null); } }
/// <summary> Safe wrapper which replaces null-s by empty strings </summary>
public string Print(MeterTestResult meterTestResult)
{
string str = printDlgt(meterTestResult);
return (str == null) ? string.Empty : str;
}
///
/// Function to pick a MeterTestResult field and convert it into a string
///
public delegate string PrintCombinedDlgt(MeterTestResult largeMeterTestResult,
MeterTestResult smallMeterTestResult,
MeterTestResult combinedMeterTestResult);
private readonly PrintCombinedDlgt printCombinedDlgt;
public bool CanPrintCombined { get { return (printCombinedDlgt != null); } }
/// <summary> Safe wrapper which replaces null-s by empty strings </summary>
public string PrintCombined(MeterTestResult largeMeterTestResult,
MeterTestResult smallMeterTestResult,
MeterTestResult combinedMeterTestResult)
{
string str = printCombinedDlgt(largeMeterTestResult, smallMeterTestResult, combinedMeterTestResult);
return (str == null) ? string.Empty : str;
}
///
/// Public constructor
///
public ResultItemSpec(string name, string clmnHeaderText, PrintDlgt printDlgt, PrintCombinedDlgt printCombinedDlgt)
{
Name = name;
ClmnHeaderText = clmnHeaderText;
this.printDlgt = printDlgt;
this.printCombinedDlgt = printCombinedDlgt;
}
/// Static list of all available items
public static readonly IList<ResultItemSpec> AllItems;
/// Static constructor that initializes the list of all items
static ResultItemSpec()
{
AllItems = new List<ResultItemSpec>();
/// Common
//AllItems.Add(new ResultItemSpec("Bench ID", "Bench ID", x => x.TestResult.BenchID,
// (x, y, z) => x.TestResult.BenchID));
AllItems.Add(new ResultItemSpec("Test name", "Test", x => x.TestResult.TestName,
(x, y, z) => x.TestResult.TestName));
AllItems.Add(new ResultItemSpec("Procedure name", "Procedure", x => x.TestResult.ProcedureName,
(x, y, z) => x.TestResult.ProcedureName));
AllItems.Add(new ResultItemSpec("Batch number", "Batch nr.", x => x.TestResult.BatchNr.ToString(),
(x, y, z) => x.TestResult.BatchNr.ToString()));
AllItems.Add(new ResultItemSpec("Test method", "Test method", x => x.TestResult.Method,
(x, y, z) => x.TestResult.Method));
AllItems.Add(new ResultItemSpec("Density", "Density", x => x.TestResult.DensityOut.ToString("F1"),
(x, y, z) => x.TestResult.DensityOut.ToString("F1"))); /// [kg/m3]
/// Target values
AllItems.Add(new ResultItemSpec("Q from", "Q from [l/h]", x => x.TestResult.Qfrom.ToString("F3"),
(x, y, z) => x.TestResult.Qfrom.ToString("F3")));
AllItems.Add(new ResultItemSpec("Q to", "Q to [l/h]", x => x.TestResult.Qto.ToString("F3"),
(x, y, z) => x.TestResult.Qto.ToString("F3")));
AllItems.Add(new ResultItemSpec("Test volume", "Test vol. [l]", x => x.TestResult.Volume.ToString("F1"),
(x, y, z) => x.TestResult.Volume.ToString("F1")));
AllItems.Add(new ResultItemSpec("Error limit Lo", "Err.Lim.Lo [%]", x => x.TestResult.ErrLimLo.ToString("F1"),
(x, y, z) => x.TestResult.ErrLimLo.ToString("F1")));
AllItems.Add(new ResultItemSpec("Error limit Hi", "Err.Lim.Hi [%]", x => x.TestResult.ErrLimHi.ToString("F1"),
(x, y, z) => x.TestResult.ErrLimHi.ToString("F1")));
AllItems.Add(new ResultItemSpec("Error limit sum", "Err.Lim.Sum [%]", x => (x.TestResult.ErrLimHi - x.TestResult.ErrLimLo).ToString("F1"),
(x, y, z) => (x.TestResult.ErrLimHi - x.TestResult.ErrLimLo).ToString("F1")));
AllItems.Add(new ResultItemSpec("Uncertainty", "Uncertainty [%]", x => x.TestResult.Uncertainty.ToString("F2"),
(x, y, z) => x.TestResult.Uncertainty.ToString("F2")));
/// Test results
AllItems.Add(new ResultItemSpec("Start time", "T start", x => x.TestResult.TimeStart.ToShortTimeString(),
(x, y, z) => z.TestResult.TimeStart.ToShortTimeString()));
AllItems.Add(new ResultItemSpec("End time", "T end", x => x.TestResult.TimeEnd.ToShortTimeString(),
(x, y, z) => z.TestResult.TimeEnd.ToShortTimeString()));
AllItems.Add(new ResultItemSpec("Test time", "T [s]", x => x.TestResult.Time.ToString("F2"),
(x, y, z) => z.TestResult.Time.ToString("F2")));
AllItems.Add(new ResultItemSpec("Flow", "Flow [m3/h]", x => FloatToStr(x.TestResult.FlowVolume / 1000.0f, 4),
(x, y, z) => FloatToStr(z.TestResult.FlowVolume / 1000.0f, 4)));
AllItems.Add(new ResultItemSpec("T in", "T in", x => x.TestResult.TempInAvrg.ToString("F2"),
(x, y, z) => z.TestResult.TempInAvrg.ToString("F2")));
AllItems.Add(new ResultItemSpec("T out", "T out", x => x.TestResult.TempOutAvrg.ToString("F2"),
(x, y, z) => z.TestResult.TempOutAvrg.ToString("F2")));
AllItems.Add(new ResultItemSpec("T div", "T div", x => x.TestResult.TempDivAvrg.ToString("F2"),
(x, y, z) => z.TestResult.TempDivAvrg.ToString("F2")));
AllItems.Add(new ResultItemSpec("P up", "P up", x => x.TestResult.PressInAvrg.ToString("F3"),
(x, y, z) => z.TestResult.PressInAvrg.ToString("F3")));
AllItems.Add(new ResultItemSpec("P up start", "P up start", x => x.TestResult.PressInStart.ToString("F3"),
(x, y, z) => z.TestResult.PressInStart.ToString("F3")));
AllItems.Add(new ResultItemSpec("P up end", "P up end", x => x.TestResult.PressInEnd.ToString("F3"),
(x, y, z) => z.TestResult.PressInEnd.ToString("F3")));
AllItems.Add(new ResultItemSpec("P down", "P down", x => x.TestResult.PressOutAvrg.ToString("F3"),
(x, y, z) => z.TestResult.PressOutAvrg.ToString("F3")));
AllItems.Add(new ResultItemSpec("P down start", "P down start", x => x.TestResult.PressOutStart.ToString("F3"),
(x, y, z) => z.TestResult.PressOutStart.ToString("F3")));
AllItems.Add(new ResultItemSpec("P down end", "P down end", x => x.TestResult.PressOutEnd.ToString("F3"),
(x, y, z) => z.TestResult.PressOutEnd.ToString("F3")));
AllItems.Add(new ResultItemSpec("Reference error", "Err.ref. [%]", x => x.TestResult.ErrorMaster.ToString("F3"),
(x, y, z) => z.TestResult.ErrorMaster.ToString("F3")));
AllItems.Add(new ResultItemSpec("Ambient temperature", "T amb", x => x.TestResult.AmbientTempAve.ToString("F1"),
(x, y, z) => z.TestResult.AmbientTempAve.ToString("F1")));
AllItems.Add(new ResultItemSpec("Ambient pressure", "P amb", x => x.TestResult.AmbientPressAve.ToString("F0"),
(x, y, z) => z.TestResult.AmbientPressAve.ToString("F0")));
AllItems.Add(new ResultItemSpec("Ambient humidity", "H amb [%]", x => x.TestResult.AmbientHumiAve.ToString("F1"),
(x, y, z) => z.TestResult.AmbientHumiAve.ToString("F1")));
/// Single and combined meter results
AllItems.Add(new ResultItemSpec("Volume", "Volume [l]", x => x.VolumeMeter.ToString("F3"),
(x, y, z) => z.VolumeMeter.ToString("F3")));
AllItems.Add(new ResultItemSpec("Reference volume", "Vol.ref. [l]", x => x.VolumeRef.ToString("F3"),
(x, y, z) => z.VolumeRef.ToString("F3")));
AllItems.Add(new ResultItemSpec("Error", "Error [%]", x => x.VolumeErrorPct.ToString("F2"),
(x, y, z) => z.VolumeErrorPct.ToString("F2")));
AllItems.Add(new ResultItemSpec("Passed", "Result", x => (x.Passed ? Strings.Passed + "|Green" : Strings.Failed + "|Red"),
(x, y, z) => (z.Passed ? Strings.Passed + "|Green" : Strings.Failed + "|Red")));
/// Single water meters only results
AllItems.Add(new ResultItemSpec("Serial Nr", "s/n", x => x.SerialNr, null));
AllItems.Add(new ResultItemSpec("End state", "End state", x => x.EndState, null));
AllItems.Add(new ResultItemSpec("Pulses", "Pulses", x => x.PulsesMeter.ToString(), null));
AllItems.Add(new ResultItemSpec("Pulses/liter", "Pulses/liter", x => x.PulsesPerLiter.ToString(), null));
AllItems.Add(new ResultItemSpec("Reference pulses", "Ref.pulses", x => x.PulsesMaster.ToString(), null));
/// Combined water meters only results
AllItems.Add(new ResultItemSpec("Q rise", "Q rise [m3/h]", null, (x, y, z) => (x.TestResult.QRise == 0) ? "-" : FloatToStr(x.TestResult.QRise, 4)));
AllItems.Add(new ResultItemSpec("Q fall", "Q fall [m3/h]", null, (x, y, z) => (x.TestResult.QFall == 0) ? "-" : FloatToStr(x.TestResult.QFall, 4)));
AllItems.Add(new ResultItemSpec("Error large WM", "Error-L [%]", null, (x, y, z) => x.VolumeErrorPct.ToString("F2")));
AllItems.Add(new ResultItemSpec("Error small WM", "Error-S [%]", null, (x, y, z) => y.VolumeErrorPct.ToString("F2")));
AllItems.Add(new ResultItemSpec("Serial Nr large WM", "s/n", null, (x, y, z) => x.SerialNr));
AllItems.Add(new ResultItemSpec("Serial Nr small WM", "s/n", null, (x, y, z) => y.SerialNr));
AllItems.Add(new ResultItemSpec("End state large WM", "End state", null, (x, y, z) => x.EndState));
AllItems.Add(new ResultItemSpec("End state small WM", "End state", null, (x, y, z) => y.EndState));
}
public static ResultItemSpec GetItem(string name)
{
foreach (var item in AllItems) if (item.Name.Equals(name)) return item;
return null;
}
public static string[] ToStrArray(IList<ResultItemSpec> 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<ResultItemSpec> FromStrArray(string[] strArray)
{
IList<ResultItemSpec> result = new List<ResultItemSpec>();
if (strArray != null)
{
for (int i = 0; i < strArray.Length; i++)
{
ResultItemSpec item = GetItem(strArray[i]);
if (item != null) result.Add(item);
}
}
return result;
}
/// <summary>
/// Converts float number to a string with the specified number of valid digits
/// </summary>
/// <param name="value">Float value to be converted to a string</param>
/// <param name="validDigits">Number of valid digits: 4, 3, or 2 (otherwise a full precision number is printed)</param>
/// <returns>String representation of the float number</returns>
public static string FloatToStr(float value, int validDigits)
{
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();
}
}
}

View File

@ -47,7 +47,7 @@ namespace TBF.BenchControl.ResultsPrinters.Zapiska
///
readonly IList<string> testNames;
readonly int testsPerMeter;
readonly IList<Config.ResultItemSpec> resultItems;
readonly IList<Results.ItemSpec> resultItems;
///
/// Data to print
@ -90,7 +90,7 @@ namespace TBF.BenchControl.ResultsPrinters.Zapiska
if (tr.BatchNr > batchMax) batchMax = tr.BatchNr;
}
resultItems = Config.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_SingleWM);
resultItems = Results.ItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_SingleWM);
testNames = Utils.GetDecoratedTestNames(procedure, 1);
testsPerMeter = testNames.Count;
@ -128,9 +128,10 @@ namespace TBF.BenchControl.ResultsPrinters.Zapiska
int k = 2 + j * resultItems.Count;
foreach (var item in resultItems)
{
string str = item.Print(results[j].Meters[wmNr]);
int pos = str.IndexOf('|');
dataToPrint[nrRows, k++] = (pos < 0) ? str : str.Substring(0, pos);
///TODO
//string str = item.Print(results[j].Meters[wmNr]);
//int pos = str.IndexOf('|');
//dataToPrint[nrRows, k++] = (pos < 0) ? str : str.Substring(0, pos);
}
}
}

View File

@ -47,7 +47,7 @@ namespace TBF
///
readonly IList<string> testNames;
readonly int testsPerMeter;
readonly IList<Config.ResultItemSpec> resultItems;
readonly IList<Results.ItemSpec> resultItems;
///
/// Data to print
@ -90,7 +90,7 @@ namespace TBF
if (tr.BatchNr > batchMax) batchMax = tr.BatchNr;
}
resultItems = Config.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_SingleWM);
resultItems = Results.ItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_SingleWM);
testNames = Utils.GetDecoratedTestNames(procedure, 1);
testsPerMeter = testNames.Count;
@ -128,9 +128,10 @@ namespace TBF
int k = 2 + j * resultItems.Count;
foreach (var item in resultItems)
{
string str = item.Print(results[j].Meters[wmNr]);
int pos = str.IndexOf('|');
dataToPrint[nrRows, k++] = (pos < 0) ? str : str.Substring(0, pos);
///TODO
//string str = item.Print(results[j].Meters[wmNr]);
//int pos = str.IndexOf('|');
//dataToPrint[nrRows, k++] = (pos < 0) ? str : str.Substring(0, pos);
}
}
}