From d6261e4d80b764d83c828fb2c8bc7b03a0aa62a3 Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Thu, 25 Jun 2020 11:55:07 +0200 Subject: [PATCH] (1) Units : Quantity.Enumerated added, (2) LoginDlgWithBenchSelection : List of benches is alphabetically sorted. --- Config/DatabaseSettings.cs | 8 +++++++- Config/Units.cs | 6 +++++- Results/WMeterRsltItemSpec.cs | 2 +- TBF/UI/Shared/LoginDlgWithBenchSelection.cs | 1 + 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Config/DatabaseSettings.cs b/Config/DatabaseSettings.cs index 23850d0bc..7c813ead1 100644 --- a/Config/DatabaseSettings.cs +++ b/Config/DatabaseSettings.cs @@ -10,7 +10,7 @@ namespace Config /// /// Test bench database settings, contains bench name and settings od several databases /// - public class DatabaseSettings : ICloneable + public class DatabaseSettings : ICloneable, IComparable { // Public fields public string BenchName; @@ -45,6 +45,12 @@ namespace Config return result; } + public int CompareTo(object dbs2) + { + if (!(dbs2 is DatabaseSettings)) return 0; + return String.Compare(BenchName, (dbs2 as DatabaseSettings).BenchName); + } + public override string ToString() { return string.Format("{0} config={1} results={2} events={3} users={4}", diff --git a/Config/Units.cs b/Config/Units.cs index 44cc22894..9fd3a4464 100644 --- a/Config/Units.cs +++ b/Config/Units.cs @@ -122,6 +122,7 @@ namespace Config [Description("Text")] String, [Description("Boolean")] Boolean, [Description("Datum und Uhrzeit")] DateTime, + [Description("Aufgezählt")] Enumerated, #elif LANG_PL [Description("Objętość")] Volume, [Description("Przepływ")] Flow, @@ -144,6 +145,7 @@ namespace Config [Description("Tekst")] String, [Description("Boolean")] Boolean, [Description("Data i czas")] DateTime, + [Description("Wyliczone")] Enumerated, #elif LANG_CS [Description("Objem")] Volume, [Description("Průtok")] Flow, @@ -166,6 +168,7 @@ namespace Config [Description("Text")] String, [Description("Boolean")] Boolean, [Description("Datum a čas")] DateTime, + [Description("Vyjmenované")] Enumerated, #elif LANG_IT [Description("Volume")] Volume, [Description("Flusso")] Flow, @@ -188,6 +191,7 @@ namespace Config [Description("Stringa")] String, [Description("Boolean")] Boolean, [Description("Data e ora")] DateTime, + [Description("Enumerato")] Enumerated, #else [Description("Volume")] Volume, [Description("Flow")] Flow, @@ -210,7 +214,7 @@ namespace Config [Description("String")] String, [Description("Boolean")] Boolean, [Description("Date and time")] DateTime, - [Description("Enum")] Enum, + [Description("Enumerated")] Enumerated, #endif Count, } diff --git a/Results/WMeterRsltItemSpec.cs b/Results/WMeterRsltItemSpec.cs index 229b3580a..7ec6b1f36 100644 --- a/Results/WMeterRsltItemSpec.cs +++ b/Results/WMeterRsltItemSpec.cs @@ -336,7 +336,7 @@ namespace Results AllItems.Add(new WMeterRsltItemSpec(ItemID.Passed, Strings.Result, Quantity.Boolean, ItemCategory.MeterResult, (w, t, u, f, p) => string.IsNullOrEmpty(t) ? w.PassedColorStr(f) : ((w.GetMeterTestRslt(t) == null) ? "" : w.GetMeterTestRslt(t).PassedColorStr(f)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.ThreeState, "Three state result", Quantity.Enum, ItemCategory.MeterResult, (w, t, u, f, p) => FormatThreeState(f, w.ThreeStateFromTests()))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.ThreeState, "Three state result", Quantity.Enumerated, ItemCategory.MeterResult, (w, t, u, f, p) => FormatThreeState(f, w.ThreeStateFromTests()))); AllItems.Add(new WMeterRsltItemSpec(ItemID.RefFlowmeter, "Ref. flowmeter", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null) ? FormatStr(f, w.GetTestRslt(t).RefFlowmeter()) : string.Empty)); AllItems.Add(new WMeterRsltItemSpec(ItemID.ResultOrErrorFlags, "Winiki lub E", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.PassedOrErrorFlagsStr()))); /// PL specific result diff --git a/TBF/UI/Shared/LoginDlgWithBenchSelection.cs b/TBF/UI/Shared/LoginDlgWithBenchSelection.cs index dfd685061..417a765d4 100644 --- a/TBF/UI/Shared/LoginDlgWithBenchSelection.cs +++ b/TBF/UI/Shared/LoginDlgWithBenchSelection.cs @@ -87,6 +87,7 @@ namespace TBF.UI.Shared userNameTextBox.Text = "milan"; passwordTextBox.Text = "kremik"; #endif + Array.Sort(Program.LocalSettings.TestBenches); for (int i = 0; i < Program.LocalSettings.BenchesCount; i++) { testBenchComboBox.Items.Add(Program.LocalSettings.TestBenches[i].BenchName);