From 9ac3dd07b93b81003fb39ddfc9d6bdff1d22aea5 Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Wed, 27 Sep 2017 21:29:10 +0200 Subject: [PATCH] WMeterRsltItemSpec cleanup, DblFormat(...) does units conversion. --- Results/WMeterRsltItemSpec.cs | 267 +++++++++++++++++----------------- 1 file changed, 131 insertions(+), 136 deletions(-) diff --git a/Results/WMeterRsltItemSpec.cs b/Results/WMeterRsltItemSpec.cs index a20b678fc..c74600c8d 100644 --- a/Results/WMeterRsltItemSpec.cs +++ b/Results/WMeterRsltItemSpec.cs @@ -60,11 +60,6 @@ namespace Results string str = printDlgt(waterMeterResult, testId, Units, Format, Precision); if (str == null) str = string.Empty; - if (!string.IsNullOrEmpty(Format)) - { - str = string.Format(Format, str); - } - int len = str.Length; if (Width == 0 || len >= Width) { @@ -125,119 +120,119 @@ namespace Results 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) => (w.GetTestRslt(t) == null) ? "" : w.GetTestRslt(t).Name())); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Procedure_name, Strings.Procedure, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => w.ProcedureName())); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Batch_number, Strings.Batch_nr, Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => w.BatchNr().ToString())); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_method, Strings.Test_method + " *", Quantity.String, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : w.GetTestRslt(t).Method())); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_name, Strings.Test + "()", Quantity.String, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : w.GetTestRslt(t).Name())); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Procedure_name, Strings.Procedure, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => w.ProcedureName())); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Batch_number, Strings.Batch_nr, Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => w.BatchNr().ToString())); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_method, Strings.Test_method + "()", Quantity.String, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : w.GetTestRslt(t).Method())); /// /// Volume /// - AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_volume, Strings.Test_vol + "()", Quantity.Volume, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(f, p, "V2", Config.Units.ConvertTo(u, w.GetTestRslt(t).TargetVolume())))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Volume, string.Format("{0} Mt. ()", Strings.VName_Vol), Strings.Tooltip_Vol_Mt, Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : DblFormat(f, p, "V4", Config.Units.ConvertTo(u, w.GetMeterTestRslt(t).VolumeMeter)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_volume, string.Format("{0} rm ()", Strings.VName_Vol), Strings.Tooltip_Vol_rm, Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : DblFormat(f, p, "V4", Config.Units.ConvertTo(u, w.GetMeterTestRslt(t).VolumeRef)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Volume_main, string.Format("{0} {1} ()", Strings.VName_Vol, Strings.main), Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain) == null) ? "" : DblFormat(f, p, "V4", Config.Units.ConvertTo(u, w.GetMeterTestRslt(t).VolumeMeter)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Volume_aux, string.Format("{0} {1} ()", Strings.VName_Vol, Strings.aux), Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux) == null) ? "" : DblFormat(f, p, "V4", Config.Units.ConvertTo(u, w.GetMeterTestRslt(t).VolumeMeter)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Start_volume, Strings.Start_volume + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : DblFormat(f, p, "V4", Config.Units.ConvertTo(u, w.GetMeterTestRslt(t).VolumeStart)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Start_volume_main, Strings.Start_volume_main + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain) == null) ? "" : DblFormat(f, p, "V4", Config.Units.ConvertTo(u, w.GetMeterTestRslt(t).VolumeStart)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Start_volume_aux, Strings.Start_volume_aux + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux) == null) ? "" : DblFormat(f, p, "V4", Config.Units.ConvertTo(u, w.GetMeterTestRslt(t).VolumeStart)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.End_volume, Strings.End_volume + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : DblFormat(f, p, "V4", Config.Units.ConvertTo(u, w.GetMeterTestRslt(t).VolumeEnd)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.End_volume_main, Strings.End_volume_main + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain) == null) ? "" : DblFormat(f, p, "V4", Config.Units.ConvertTo(u, w.GetMeterTestRslt(t).VolumeEnd)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.End_volume_aux, Strings.End_volume_aux + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux) == null) ? "" : DblFormat(f, p, "V4", Config.Units.ConvertTo(u, w.GetMeterTestRslt(t).VolumeEnd)))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_volume, Strings.Test_vol + "()", Quantity.Volume, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(u, f, p, "V2", w.GetTestRslt(t).TargetVolume()))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Volume, string.Format("{0} Mt. ()", Strings.VName_Vol), Strings.Tooltip_Vol_Mt, Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : DblFormat(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeMeter))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_volume, string.Format("{0} rm ()", Strings.VName_Vol), Strings.Tooltip_Vol_rm, Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : DblFormat(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeRef))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Volume_main, string.Format("{0} {1} ()", Strings.VName_Vol, Strings.main), Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain) == null) ? "" : DblFormat(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeMeter))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Volume_aux, string.Format("{0} {1} ()", Strings.VName_Vol, Strings.aux), Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux) == null) ? "" : DblFormat(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeMeter))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Start_volume, Strings.Start_volume + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : DblFormat(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeStart))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Start_volume_main, Strings.Start_volume_main + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain) == null) ? "" : DblFormat(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeStart))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Start_volume_aux, Strings.Start_volume_aux + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux) == null) ? "" : DblFormat(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeStart))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.End_volume, Strings.End_volume + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : DblFormat(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeEnd))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.End_volume_main, Strings.End_volume_main + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain) == null) ? "" : DblFormat(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeEnd))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.End_volume_aux, Strings.End_volume_aux + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux) == null) ? "" : DblFormat(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeEnd))); /// /// Mass /// - AllItems.Add(new WMeterRsltItemSpec(ItemID.Mass_start_raw, string.Format("{0} ST raw ()", Strings.VName_Mass), Quantity.Mass, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(f, p, "V4", Config.Units.ConvertTo(u, w.GetTestRslt(t).MassStartRaw)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Mass_start, string.Format("{0} ST ()", Strings.VName_Mass), Quantity.Mass, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(f, p, "V4", Config.Units.ConvertTo(u, w.GetTestRslt(t).MassStart)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Mass_end_raw, string.Format("{0} EN raw ()", Strings.VName_Mass), Quantity.Mass, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(f, p, "V4", Config.Units.ConvertTo(u, w.GetTestRslt(t).MassEndRaw)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Mass_end, string.Format("{0} EN ()", Strings.VName_Mass), Quantity.Mass, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(f, p, "V4", Config.Units.ConvertTo(u, w.GetTestRslt(t).MassEnd)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Mass, string.Format("{0} ()", Strings.VName_Mass), Quantity.Mass, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(f, p, "V4", Config.Units.ConvertTo(u, w.GetTestRslt(t).MassEnd - w.GetTestRslt(t).MassStart)))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Mass_start_raw, string.Format("{0} ST raw ()", Strings.VName_Mass), Quantity.Mass, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(u, f, p, "V4", w.GetTestRslt(t).MassStartRaw))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Mass_start, string.Format("{0} ST ()", Strings.VName_Mass), Quantity.Mass, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(u, f, p, "V4", w.GetTestRslt(t).MassStart))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Mass_end_raw, string.Format("{0} EN raw ()", Strings.VName_Mass), Quantity.Mass, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(u, f, p, "V4", w.GetTestRslt(t).MassEndRaw))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Mass_end, string.Format("{0} EN ()", Strings.VName_Mass), Quantity.Mass, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(u, f, p, "V4", w.GetTestRslt(t).MassEnd))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Mass, string.Format("{0} ()", Strings.VName_Mass), Quantity.Mass, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(u, f, p, "V4", w.GetTestRslt(t).MassEnd - w.GetTestRslt(t).MassStart))); /// /// Density /// - AllItems.Add(new WMeterRsltItemSpec(ItemID.Density, Strings.Density + " ()", Quantity.Density, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(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) => DblFormat(f, p, "V3", w.Batch.DensityCorr))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Density, Strings.Density + " ()", Quantity.Density, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(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) => DblFormat(u, f, p, "V3", (w.Batch.DensityCorr)))); /// /// Time (duration), date and time /// AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_start_time, Strings.T_start + "()", Quantity.DateTime, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : (string.IsNullOrEmpty(f) ? w.GetTestRslt(t).StartTime.ToString() : string.Format(f, w.GetTestRslt(t).StartTime)))); AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_end_time, Strings.T_end + "()", Quantity.DateTime, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : (string.IsNullOrEmpty(f) ? w.GetTestRslt(t).EndTime.ToString() : string.Format(f, w.GetTestRslt(t).EndTime)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_time, Strings.T_s + "()", Quantity.Time, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(f, p, "V3", w.GetTestRslt(t).TestTime))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_time, Strings.T_s + "()", Quantity.Time, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(u, f, p, "V3", w.GetTestRslt(t).TestTime))); /// /// 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) ? "" : DblFormat(f, p, "V3", Config.Units.ConvertTo(u, 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) ? "" : DblFormat(f, p, "V3", Config.Units.ConvertTo(u, 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) ? "" : DblFormat(f, p, "V3", Config.Units.ConvertTo(u, 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) ? "" : DblFormat(f, p, "V3", Config.Units.ConvertTo(u, w.GetTestRslt(t).FlowMean)))); - 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) ? "-" : DblFormat(f, p, "V3", Config.Units.ConvertTo(u, 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) ? "-" : DblFormat(f, p, "V3", Config.Units.ConvertTo(u, w.QFall))) : "")); + 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) ? "" : DblFormat(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) ? "" : DblFormat(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) ? "" : DblFormat(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) ? "" : DblFormat(u, f, p, "V3", w.GetTestRslt(t).FlowMean))); + 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) ? "-" : DblFormat(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) ? "-" : DblFormat(u, f, p, "V3", w.QFall)) : "")); /// /// Temperature /// - AllItems.Add(new WMeterRsltItemSpec(ItemID.T_up_mean, string.Format("{0} UP ME ()", Strings.VName_Temp), Strings.Tooltip_T_up_me, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(f, p, "V3", Config.Units.ConvertTo(u, w.GetTestRslt(t).TempUpMean)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.T_up_start, string.Format("{0} UP ST ()", Strings.VName_Temp), Strings.Tooltip_T_up_st, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(f, p, "V3", Config.Units.ConvertTo(u, w.GetTestRslt(t).TempUpStart)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.T_up_end, string.Format("{0} UP EN ()", Strings.VName_Temp), Strings.Tooltip_T_up_en, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(f, p, "V3", Config.Units.ConvertTo(u, w.GetTestRslt(t).TempUpEnd)))); - 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) ? "" : DblFormat(f, p, "V3", Config.Units.ConvertTo(u, (w.GetTestRslt(t).TempUpStart + w.GetTestRslt(t).TempUpEnd) / 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) ? "" : DblFormat(f, p, "V3", Config.Units.ConvertTo(u, 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) ? "" : DblFormat(f, p, "V3", Config.Units.ConvertTo(u, 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) ? "" : DblFormat(f, p, "V3", Config.Units.ConvertTo(u, w.GetTestRslt(t).TempDownEnd)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.T_down_avg, string.Format("{0} DW avg ()", Strings.VName_Temp), Strings.Tooltip_T_dw_avg, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(f, p, "V3", Config.Units.ConvertTo(u, (w.GetTestRslt(t).TempDownStart + w.GetTestRslt(t).TempDownEnd) / 2)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.T_div, string.Format("{0} DI ME ()", Strings.VName_Temp), Strings.Tooltip_T_di_me, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(f, p, "V3", Config.Units.ConvertTo(u, w.GetTestRslt(t).TempDivMean)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.T_div_start, string.Format("{0} DI ST ()", Strings.VName_Temp), Strings.Tooltip_T_di_st, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(f, p, "V3", Config.Units.ConvertTo(u, w.GetTestRslt(t).TempDivStart)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.T_div_end, string.Format("{0} DI EN ()", Strings.VName_Temp), Strings.Tooltip_T_di_en, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(f, p, "V3", Config.Units.ConvertTo(u, w.GetTestRslt(t).TempDivEnd)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.T_div_avg, string.Format("{0} DI avg ()", Strings.VName_Temp), Strings.Tooltip_T_di_avg, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(f, p, "V3", Config.Units.ConvertTo(u, (w.GetTestRslt(t).TempDivStart + w.GetTestRslt(t).TempDivEnd) / 2)))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.T_up_mean, string.Format("{0} UP ME ()", Strings.VName_Temp), Strings.Tooltip_T_up_me, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(u, f, p, "V3", w.GetTestRslt(t).TempUpMean))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.T_up_start, string.Format("{0} UP ST ()", Strings.VName_Temp), Strings.Tooltip_T_up_st, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(u, f, p, "V3", w.GetTestRslt(t).TempUpStart))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.T_up_end, string.Format("{0} UP EN ()", Strings.VName_Temp), Strings.Tooltip_T_up_en, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(u, f, p, "V3", w.GetTestRslt(t).TempUpEnd))); + 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) ? "" : DblFormat(u, f, p, "V3", (w.GetTestRslt(t).TempUpStart + w.GetTestRslt(t).TempUpEnd) / 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) ? "" : DblFormat(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) ? "" : DblFormat(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) ? "" : DblFormat(u, f, p, "V3", w.GetTestRslt(t).TempDownEnd))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.T_down_avg, string.Format("{0} DW avg ()", Strings.VName_Temp), Strings.Tooltip_T_dw_avg, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(u, f, p, "V3", (w.GetTestRslt(t).TempDownStart + w.GetTestRslt(t).TempDownEnd) / 2))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.T_div, string.Format("{0} DI ME ()", Strings.VName_Temp), Strings.Tooltip_T_di_me, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(u, f, p, "V3", w.GetTestRslt(t).TempDivMean))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.T_div_start, string.Format("{0} DI ST ()", Strings.VName_Temp), Strings.Tooltip_T_di_st, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(u, f, p, "V3", w.GetTestRslt(t).TempDivStart))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.T_div_end, string.Format("{0} DI EN ()", Strings.VName_Temp), Strings.Tooltip_T_di_en, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(u, f, p, "V3", w.GetTestRslt(t).TempDivEnd))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.T_div_avg, string.Format("{0} DI avg ()", Strings.VName_Temp), Strings.Tooltip_T_di_avg, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(u, f, p, "V3", (w.GetTestRslt(t).TempDivStart + w.GetTestRslt(t).TempDivEnd) / 2))); #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) ? "" : Config.Units.ConvertTo(u, 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) ? "" : Config.Units.ConvertTo(u, 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) ? "" : Config.Units.ConvertTo(u, 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) ? "" : Config.Units.ConvertTo(u, (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) ? "" : Config.Units.ConvertTo(u, 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) ? "" : Config.Units.ConvertTo(u, 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) ? "" : Config.Units.ConvertTo(u, 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) ? "" : Config.Units.ConvertTo(u, (w.GetTestRslt(t).Custom7 + w.GetTestRslt(t).Custom8) / 2).ToString(GetPr(p, "F3")))); + 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 /// /// Pressure /// - AllItems.Add(new WMeterRsltItemSpec(ItemID.P_up, string.Format("{0} UP ME ()", Strings.VName_Press), Strings.Tooltip_P_up_me, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(f, p, "V3", Config.Units.ConvertTo(u, w.GetTestRslt(t).PressUpMean)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.P_up_start, string.Format("{0} UP ST ()", Strings.VName_Press), Strings.Tooltip_P_up_st, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(f, p, "V3", Config.Units.ConvertTo(u, w.GetTestRslt(t).PressUpStart)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.P_up_end, string.Format("{0} UP EN ()", Strings.VName_Press), Strings.Tooltip_P_up_en, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(f, p, "V3", Config.Units.ConvertTo(u, w.GetTestRslt(t).PressUpEnd)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.P_up_avg, string.Format("{0} UP avg ()", Strings.VName_Press), Strings.Tooltip_P_up_avg, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(f, p, "V3", Config.Units.ConvertTo(u, (w.GetTestRslt(t).PressUpStart + w.GetTestRslt(t).PressUpEnd) / 2)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.P_down, string.Format("{0} DW ME ()", Strings.VName_Press), Strings.Tooltip_P_dw_me, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(f, p, "V3", Config.Units.ConvertTo(u, w.GetTestRslt(t).PressDownMean)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.P_down_start, string.Format("{0} DW ST ()", Strings.VName_Press), Strings.Tooltip_P_dw_st, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(f, p, "V3", Config.Units.ConvertTo(u, w.GetTestRslt(t).PressDownStart)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.P_down_end, string.Format("{0} DW EN ()", Strings.VName_Press), Strings.Tooltip_P_dw_en, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(f, p, "V3", Config.Units.ConvertTo(u, w.GetTestRslt(t).PressDownEnd)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.P_down_avg, string.Format("{0} DW avg ()", Strings.VName_Press), Strings.Tooltip_P_dw_avg, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(f, p, "V3", Config.Units.ConvertTo(u, (w.GetTestRslt(t).PressDownStart + w.GetTestRslt(t).PressDownEnd) / 2)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.P_delta_mean, string.Format("{0} DE ME ()", Strings.VName_Press), Strings.Tooltip_P_de_me, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(f, p, "V3", Config.Units.ConvertTo(u, w.GetTestRslt(t).PressDeltaMean)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.P_delta_start, string.Format("{0} DE ST ()", Strings.VName_Press), Strings.Tooltip_P_de_st, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(f, p, "V3", Config.Units.ConvertTo(u, w.GetTestRslt(t).PressDeltaStart)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.P_delta_end, string.Format("{0} DE EN ()", Strings.VName_Press), Strings.Tooltip_P_de_en, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(f, p, "V3", Config.Units.ConvertTo(u, w.GetTestRslt(t).PressDeltaEnd)))); - 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) ? "" : DblFormat(f, p, "V3", Config.Units.ConvertTo(u, (w.GetTestRslt(t).PressDeltaStart + w.GetTestRslt(t).PressDeltaEnd) / 2)))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.P_up, string.Format("{0} UP ME ()", Strings.VName_Press), Strings.Tooltip_P_up_me, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(u, f, p, "V3", w.GetTestRslt(t).PressUpMean))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.P_up_start, string.Format("{0} UP ST ()", Strings.VName_Press), Strings.Tooltip_P_up_st, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(u, f, p, "V3", w.GetTestRslt(t).PressUpStart))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.P_up_end, string.Format("{0} UP EN ()", Strings.VName_Press), Strings.Tooltip_P_up_en, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(u, f, p, "V3", w.GetTestRslt(t).PressUpEnd))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.P_up_avg, string.Format("{0} UP avg ()", Strings.VName_Press), Strings.Tooltip_P_up_avg, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(u, f, p, "V3", (w.GetTestRslt(t).PressUpStart + w.GetTestRslt(t).PressUpEnd) / 2))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.P_down, string.Format("{0} DW ME ()", Strings.VName_Press), Strings.Tooltip_P_dw_me, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(u, f, p, "V3", w.GetTestRslt(t).PressDownMean))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.P_down_start, string.Format("{0} DW ST ()", Strings.VName_Press), Strings.Tooltip_P_dw_st, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(u, f, p, "V3", w.GetTestRslt(t).PressDownStart))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.P_down_end, string.Format("{0} DW EN ()", Strings.VName_Press), Strings.Tooltip_P_dw_en, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(u, f, p, "V3", w.GetTestRslt(t).PressDownEnd))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.P_down_avg, string.Format("{0} DW avg ()", Strings.VName_Press), Strings.Tooltip_P_dw_avg, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(u, f, p, "V3", (w.GetTestRslt(t).PressDownStart + w.GetTestRslt(t).PressDownEnd) / 2))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.P_delta_mean, string.Format("{0} DE ME ()", Strings.VName_Press), Strings.Tooltip_P_de_me, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(u, f, p, "V3", w.GetTestRslt(t).PressDeltaMean))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.P_delta_start, string.Format("{0} DE ST ()", Strings.VName_Press), Strings.Tooltip_P_de_st, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(u, f, p, "V3", w.GetTestRslt(t).PressDeltaStart))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.P_delta_end, string.Format("{0} DE EN ()", Strings.VName_Press), Strings.Tooltip_P_de_en, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(u, f, p, "V3", w.GetTestRslt(t).PressDeltaEnd))); + 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) ? "" : DblFormat(u, f, p, "V3", (w.GetTestRslt(t).PressDeltaStart + w.GetTestRslt(t).PressDeltaEnd) / 2))); /// /// Ambient temperature/pressure/humidity/Buoyancy /// - AllItems.Add(new WMeterRsltItemSpec(ItemID.Ambient_temperature, string.Format("{0} Amb M", Strings.VName_Temp), Strings.Tooltip_T_Amb_M, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? DblFormat(f, p, "V3", Config.Units.ConvertTo(u, w.Batch.AmbTempMean())) : DblFormat(f, p, "V3", Config.Units.ConvertTo(u, w.GetTestRslt(t).AmbTempMean)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Ambient_pressure, string.Format("{0} Amb M", Strings.VName_Press), Strings.Tooltip_P_Amb_M, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? DblFormat(f, p, "V4", Config.Units.ConvertTo(u, w.Batch.AmbPressMean())) : DblFormat(f, p, "V4", Config.Units.ConvertTo(u, w.GetTestRslt(t).AmbPressMean)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Ambient_humidity, string.Format("{0} Amb M", Strings.VName_Humi), Strings.Tooltip_Hu_Amb_M, Quantity.Humidity, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? DblFormat(f, p, "V2", Config.Units.ConvertTo(u, w.Batch.AmbHumiMean())) : DblFormat(f, p, "V2", Config.Units.ConvertTo(u, w.GetTestRslt(t).AmbHumiMean)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Buoyancy, "Buoyancy ()", Quantity.Number, ItemCategory.TestResult, (w, t, u, f, p) => string.IsNullOrEmpty(t) ? DblFormat(f, p, "V6", w.Batch.Buoyancy()) : ((w.GetTestRslt(t) != null) ? DblFormat(f, p, "V6", w.GetTestRslt(t).Buoyancy) : ""))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Ambient_temperature, string.Format("{0} Amb M", Strings.VName_Temp), Strings.Tooltip_T_Amb_M, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => DblFormat(u, f, p, "V3", (w.GetTestRslt(t) == null) ? w.Batch.AmbTempMean() : w.GetTestRslt(t).AmbTempMean))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Ambient_pressure, string.Format("{0} Amb M", Strings.VName_Press), Strings.Tooltip_P_Amb_M, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => DblFormat(u, f, p, "V4", (w.GetTestRslt(t) == null) ? w.Batch.AmbPressMean() : w.GetTestRslt(t).AmbPressMean))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Ambient_humidity, string.Format("{0} Amb M", Strings.VName_Humi), Strings.Tooltip_Hu_Amb_M, Quantity.Humidity, ItemCategory.TestResult, (w, t, u, f, p) => DblFormat(u, f, p, "V2", (w.GetTestRslt(t) == null) ? w.Batch.AmbHumiMean() : w.GetTestRslt(t).AmbHumiMean))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Buoyancy, "Buoyancy ()", Quantity.Number, ItemCategory.TestResult, (w, t, u, f, p) => string.IsNullOrEmpty(t) ? DblFormat(u, f, p, "V6", w.Batch.Buoyancy()) : ((w.GetTestRslt(t) != null) ? DblFormat(u, f, p, "V6", (w.GetTestRslt(t).Buoyancy)) : ""))); /// /// Error /// - AllItems.Add(new WMeterRsltItemSpec(ItemID.Error_limit_Lo, Strings.ErrLimLo + "()", Quantity.Error, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(f, p, "V2", Config.Units.ConvertTo(u, w.GetTestRslt(t).ErrLimLo())))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Error_limit_Hi, Strings.ErrLimHi + "()", Quantity.Error, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(f, p, "V2", Config.Units.ConvertTo(u, 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) ? "" : DblFormat(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) ? "" : DblFormat(f, p, "V3", Config.Units.ConvertTo(u, w.GetTestRslt(t).ErrorMaster)))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Error_limit_Lo, Strings.ErrLimLo + "()", Quantity.Error, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(u, f, p, "V2", w.GetTestRslt(t).ErrLimLo()))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Error_limit_Hi, Strings.ErrLimHi + "()", Quantity.Error, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : DblFormat(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) ? "" : DblFormat(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) ? "" : DblFormat(u, f, p, "V3", w.GetTestRslt(t).ErrorMaster))); #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" : DblFormat(f, p, "V3", Config.Units.ConvertTo(u, w.GetMeterTestRslt(t).Error)))); + 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" : DblFormat(u, f, p, "V3", 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) ? "" : DblFormat(f, p, "V3", Config.Units.ConvertTo(u, w.GetMeterTestRslt(t).Error)))); + 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) ? "" : DblFormat(u, f, p, "V3", 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()))); @@ -247,75 +242,73 @@ namespace Results AllItems.Add(new WMeterRsltItemSpec(ItemID.Watermeter_type, Strings.WM_Type, Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => w.WaterMeterData.ProductName)); AllItems.Add(new WMeterRsltItemSpec(ItemID.Producer, Strings.Producer, Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => w.WaterMeterData.Producer)); - AllItems.Add(new WMeterRsltItemSpec(ItemID.DN, "DN", Quantity.Length, ItemCategory.MeterData, (w, t, u, f, p) => DblFormat(f, p, "V2", Config.Units.ConvertTo(u, w.WaterMeterData.DN)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.L, "L", Quantity.Length, ItemCategory.MeterData, (w, t, u, f, p) => DblFormat(f, p, "V3", Config.Units.ConvertTo(u, w.WaterMeterData.L)))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.DN, "DN", Quantity.Length, ItemCategory.MeterData, (w, t, u, f, p) => DblFormat(u, f, p, "V2", w.WaterMeterData.DN))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.L, "L", Quantity.Length, ItemCategory.MeterData, (w, t, u, f, p) => DblFormat(u, f, p, "V3", w.WaterMeterData.L))); AllItems.Add(new WMeterRsltItemSpec(ItemID.Mounting, Strings.Mounting, Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => w.WaterMeterData.Mounting.ToDescription())); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Q4, "Q4_Qmax", Quantity.Flow, ItemCategory.MeterData, (w, t, u, f, p) => DblFormat(u, f, p, "V3", w.WaterMeterData.Q4_Qmax))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Q3, "Q3_Qn", Quantity.Flow, ItemCategory.MeterData, (w, t, u, f, p) => DblFormat(u, f, p, "V2", w.WaterMeterData.Q3_Qn))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2, "Q2_Qt", Quantity.Flow, ItemCategory.MeterData, (w, t, u, f, p) => DblFormat(u, f, p, "V3", w.WaterMeterData.Q2_Qt))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Q1, "Q1_Qmin", Quantity.Flow, ItemCategory.MeterData, (w, t, u, f, p) => DblFormat(u, f, p, "V3", w.WaterMeterData.Q1_Qmin))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Q4, "Q4_Qmax", Quantity.Flow, ItemCategory.MeterData, (w, t, u, f, p) => DblFormat(f, p, "V3", Config.Units.ConvertTo(u, w.WaterMeterData.Q4_Qmax)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Q3, "Q3_Qn", Quantity.Flow, ItemCategory.MeterData, (w, t, u, f, p) => DblFormat(f, p, "V2", Config.Units.ConvertTo(u, w.WaterMeterData.Q3_Qn)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2, "Q2_Qt", Quantity.Flow, ItemCategory.MeterData, (w, t, u, f, p) => DblFormat(f, p, "V3", Config.Units.ConvertTo(u, w.WaterMeterData.Q2_Qt)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Q1, "Q1_Qmin", Quantity.Flow, ItemCategory.MeterData, (w, t, u, f, p) => DblFormat(f, p, "V3", Config.Units.ConvertTo(u, w.WaterMeterData.Q1_Qmin)))); - - AllItems.Add(new WMeterRsltItemSpec(ItemID.Metrological_class, Strings.MClass, Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => w.WaterMeterData.MetrologicalClass)); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Temperature_class, "Temperature class", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => w.WaterMeterData.TemperatureClass.ToDescription())); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Pressure_loss_class, "Pressure loss class", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => w.WaterMeterData.PressureLossClass.ToDescription())); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Max_admissible_pressure, "Max. admissible pressure", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => w.WaterMeterData.MaxAdmissiblePressure.ToDescription())); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Metrological_class, Strings.MClass, Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => w.WaterMeterData.MetrologicalClass)); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Temperature_class, "Temperature class", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => w.WaterMeterData.TemperatureClass.ToDescription())); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Pressure_loss_class, "Pressure loss class", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => w.WaterMeterData.PressureLossClass.ToDescription())); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Max_admissible_pressure, "Max. admissible pressure", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => w.WaterMeterData.MaxAdmissiblePressure.ToDescription())); AllItems.Add(new WMeterRsltItemSpec(ItemID.Flow_profile_sensitivity_class, "Flow profile sensitivity class", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => w.WaterMeterData.FlowProfileSensitivityClass.ToDescription())); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Approval_info, Strings.Approval, Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => w.WaterMeterData.ApprovalInfo)); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Certificate, "Certificate", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => w.WaterMeterData.Certificate)); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Approval_info, Strings.Approval, Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => w.WaterMeterData.ApprovalInfo)); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Certificate, "Certificate", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => w.WaterMeterData.Certificate)); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Pulses_per_liter, Strings.PulsesLiter, Quantity.PulsePerLtr, ItemCategory.MeterData, (w, t, u, f, p) => DblFormat(u, f, p, "V4", w.WaterMeterData.PulsesPerLtr))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Pulses_per_liter, Strings.PulsesLiter, Quantity.PulsePerLtr, ItemCategory.MeterData, (w, t, u, f, p) => DblFormat(f, p, "V4", w.WaterMeterData.PulsesPerLtr))); - - AllItems.Add(new WMeterRsltItemSpec(ItemID.Text1, "Text1", Quantity.String, ItemCategory.Other, (w, t, u, f, p) => w.WaterMeterData.Text1)); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Text2, "Text2", Quantity.String, ItemCategory.Other, (w, t, u, f, p) => w.WaterMeterData.Text2)); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Text3, "Text3", Quantity.String, ItemCategory.Other, (w, t, u, f, p) => w.WaterMeterData.Text3)); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Text4, "Text4", Quantity.String, ItemCategory.Other, (w, t, u, f, p) => w.WaterMeterData.Text4)); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Text5, "Text5", Quantity.String, ItemCategory.Other, (w, t, u, f, p) => w.WaterMeterData.Text5)); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Text1, "Text1", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => w.WaterMeterData.Text1)); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Text2, "Text2", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => w.WaterMeterData.Text2)); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Text3, "Text3", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => w.WaterMeterData.Text3)); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Text4, "Text4", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => w.WaterMeterData.Text4)); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Text5, "Text5", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => w.WaterMeterData.Text5)); /// Water meters results - AllItems.Add(new WMeterRsltItemSpec(ItemID.Serial_Nr, Strings.sn, Strings.Tooltip_sn, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => w.SerialNr)); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Purchase_order, Strings.PO, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => w.PurchaseOrder)); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Year_of_production, Strings.Year, Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => w.YearOfProduction.ToString())); - AllItems.Add(new WMeterRsltItemSpec(ItemID.WM_Position, Strings.Pos, Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => w.WMPosition.ToString())); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Serial_Nr, Strings.sn, Strings.Tooltip_sn, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => w.SerialNr)); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Purchase_order, Strings.PO, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => w.PurchaseOrder)); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Year_of_production, Strings.Year, Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => w.YearOfProduction.ToString())); + AllItems.Add(new WMeterRsltItemSpec(ItemID.WM_Position, Strings.Pos, Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => w.WMPosition.ToString())); /// Water meters results (single) - AllItems.Add(new WMeterRsltItemSpec(ItemID.End_state, Strings.End_state, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => w.EndState)); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Pulses, Strings.Pulses + "()", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : DblFormat(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) ? "" : DblFormat(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) ? "" : DblFormat(f, p, "V4", w.GetMeterTestRslt(t).PulsesPerLiter))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.End_state, Strings.End_state, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => w.EndState)); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Pulses, Strings.Pulses + "()", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : DblFormat(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) ? "" : DblFormat(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) ? "" : DblFormat(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) ? "" : DblFormat(f, p, "V3", Config.Units.ConvertTo(u, w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain).Error)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Error_aux, Strings.Err_aux + "()", Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux) == null) ? "" : DblFormat(f, p, "V3", Config.Units.ConvertTo(u, w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux).Error)))); + 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) ? "" : DblFormat(u, f, p, "V3", w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain).Error))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Error_aux, Strings.Err_aux + "()", Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux) == null) ? "" : DblFormat(u, f, p, "V3", w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux).Error))); AllItems.Add(new WMeterRsltItemSpec(ItemID.Serial_Nr_main, string.Format("{0} {1}", Strings.sn, Strings.main), Strings.Tooltip_sn_main, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => w.SerialNr)); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Serial_Nr_aux, string.Format("{0} {1}", Strings.sn, Strings.aux), Strings.Tooltip_sn_aux, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => w.SerialNrAux)); - AllItems.Add(new WMeterRsltItemSpec(ItemID.End_state_main, Strings.EndState_main, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => w.EndState)); - AllItems.Add(new WMeterRsltItemSpec(ItemID.End_state_aux, Strings.EndState_aux, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => w.EndStateAux)); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Serial_Nr_aux, string.Format("{0} {1}", Strings.sn, Strings.aux), Strings.Tooltip_sn_aux, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => w.SerialNrAux)); + AllItems.Add(new WMeterRsltItemSpec(ItemID.End_state_main, Strings.EndState_main, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => w.EndState)); + AllItems.Add(new WMeterRsltItemSpec(ItemID.End_state_aux, Strings.EndState_aux, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => w.EndStateAux)); /// Batch info - AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_bench_ID, Strings.Bench, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => w.Batch.TestBenchId.ToString())); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Program_version, Strings.Ver, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => w.Batch.ProgramVersion)); - AllItems.Add(new WMeterRsltItemSpec(ItemID.User_nr, Strings.User_nr, Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => w.Batch.UserNumber.ToString())); - AllItems.Add(new WMeterRsltItemSpec(ItemID.User_name, Strings.User, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => Users.Entities.User.EncodedStrToUserName(w.Batch.UserName))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.User_description, Strings.User_description, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => Users.Entities.User.EncodedStrToFullName(w.Batch.UserName))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Legalizator, Strings.Legalizator, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => Users.Entities.User.EncodedStrToLegalizator(w.Batch.UserName))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Watermeters, Strings.WMs, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => w.Batch.WatermetersStr)); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Protocol_title, Strings.Protocol, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => w.Batch.ProtocolTitle)); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Batch_start_time, Strings.Start, Quantity.DateTime, ItemCategory.Other, (w, t, u, f, p) => string.IsNullOrEmpty(f) ? w.Batch.StartTime.ToString() : string.Format(f, w.Batch.StartTime))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Batch_end_time, Strings.End, Quantity.DateTime, ItemCategory.Other, (w, t, u, f, p) => string.IsNullOrEmpty(f) ? w.Batch.EndTime.ToString() : string.Format(f, w.Batch.EndTime))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Lite_per_pulse_Read, "1 / PlsPerLtr_Read", Quantity.PulsePerLtr, ItemCategory.Other, (w, t, u, f, p) => DblFormat(f, p, "V4", (w.WaterMeterData.PulsesPerLtr != 0) ? 1/w.WaterMeterData.PulsesPerLtr : 0))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Passed_meters_count, Strings.Passed_meters_count, Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => w.Batch.PassedMetersCount().ToString())); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Failed_meters_count, Strings.Failed_meters_count, Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => w.Batch.FailedMetersCount().ToString())); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_bench_ID, Strings.Bench, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => w.Batch.TestBenchId.ToString())); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Program_version, Strings.Ver, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => w.Batch.ProgramVersion)); + AllItems.Add(new WMeterRsltItemSpec(ItemID.User_nr, Strings.User_nr, Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => w.Batch.UserNumber.ToString())); + AllItems.Add(new WMeterRsltItemSpec(ItemID.User_name, Strings.User, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => Users.Entities.User.EncodedStrToUserName(w.Batch.UserName))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.User_description, Strings.User_description, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => Users.Entities.User.EncodedStrToFullName(w.Batch.UserName))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Legalizator, Strings.Legalizator, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => Users.Entities.User.EncodedStrToLegalizator(w.Batch.UserName))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Watermeters, Strings.WMs, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => w.Batch.WatermetersStr)); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Protocol_title, Strings.Protocol, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => w.Batch.ProtocolTitle)); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Batch_start_time, Strings.Start, Quantity.DateTime, ItemCategory.Other, (w, t, u, f, p) => string.IsNullOrEmpty(f) ? w.Batch.StartTime.ToString() : string.Format(f, w.Batch.StartTime))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Batch_end_time, Strings.End, Quantity.DateTime, ItemCategory.Other, (w, t, u, f, p) => string.IsNullOrEmpty(f) ? w.Batch.EndTime.ToString() : string.Format(f, w.Batch.EndTime))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Lite_per_pulse_Read, "1 / PlsPerLtr_Read", Quantity.PulsePerLtr, ItemCategory.Other, (w, t, u, f, p) => DblFormat(u, f, p, "V4", (w.WaterMeterData.PulsesPerLtr != 0) ? 1/w.WaterMeterData.PulsesPerLtr : 0))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Passed_meters_count, Strings.Passed_meters_count, Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => w.Batch.PassedMetersCount().ToString())); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Failed_meters_count, Strings.Failed_meters_count, Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => w.Batch.FailedMetersCount().ToString())); /// Extra water meter data AllItems.Add(new WMeterRsltItemSpec(ItemID.Result_code, Strings.Result_code, Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => string.IsNullOrEmpty(f) ? w.ResultCode.ToString() : string.Format(f, w.ResultCode))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Remark, Strings.Remark, Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => w.Batch.Remark)); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Meter_type, Strings.Meter_type, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => w.WaterMeterData.Compound ? Strings.Compound : (w.WaterMeterData.HeatMeter ? Strings.Heat_meter : Strings.Single))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Remark, Strings.Remark, Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => w.Batch.Remark)); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Meter_type, Strings.Meter_type, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => 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) ? "" : Config.Units.ConvertTo(u, 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) ? "" : Config.Units.ConvertTo(u, w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy).VolumeRef).ToString(GetPr(p, "F1")))); + 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 @@ -358,14 +351,16 @@ namespace Results public static int TableColumnNr; - public static string DblFormat(string fmt, string precisionOrEmpty, string dfltPrecision, double value) + public static string DblFormat(Config.Unit units, string format, string precisionOrEmpty, string dfltPrecision, double value) { - return DblFormat(fmt, precisionOrEmpty, dfltPrecision, value, CultureInfo.CurrentCulture); + return DblFormat(units, format, precisionOrEmpty, dfltPrecision, value, CultureInfo.CurrentCulture); } - public static string DblFormat(string fmt, string precisionOrEmpty, string dfltPrecision, double value, CultureInfo cultureInfo) + public static string DblFormat(Config.Unit units, string format, string precisionOrEmpty, string dfltPrecision, double value, CultureInfo cultureInfo) { + double val = Config.Units.ConvertTo(units, value); + string precision = string.IsNullOrEmpty(precisionOrEmpty) ? dfltPrecision : precisionOrEmpty; /// Modify "Vx" precision specification to an appropriate "Fx" format specification @@ -374,23 +369,23 @@ namespace Results int significantDigits; if (int.TryParse(precision.Substring(1), out significantDigits)) { - precision = Utils.SignificantDigitsToFmt(value, significantDigits); + precision = Utils.SignificantDigitsToFmt(val, significantDigits); } } - if (string.IsNullOrEmpty(fmt)) + if (string.IsNullOrEmpty(format)) { - if (-float.Epsilon <= value && value <= float.Epsilon) + if (-float.Epsilon <= val && val <= float.Epsilon) return "0"; else - return value.ToString(precision, cultureInfo); + return val.ToString(precision, cultureInfo); } else { - if (-float.Epsilon <= value && value <= float.Epsilon) - return string.Format(fmt, "0"); + if (-float.Epsilon <= val && val <= float.Epsilon) + return string.Format(format, "0"); else - return string.Format(fmt, value.ToString(precision, cultureInfo)); + return string.Format(format, val.ToString(precision, cultureInfo)); } }