From fa9a477a885b51ee7152297eb8afdd6e2e2ff568 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 21 Jul 2020 17:46:03 +0200 Subject: [PATCH] Fix decoding of softkey new data --- Thermo.Active.Config/ServerConfigController.cs | 4 +++- .../ConfigModels/UserSoftKeyConfigModel.cs | 2 ++ Thermo.Active.Model/DTOModels/DTOUserSoftKeyModel.cs | 7 +++++++ Thermo.Active.NC/NcAdapter.cs | 8 ++++++++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Thermo.Active.Config/ServerConfigController.cs b/Thermo.Active.Config/ServerConfigController.cs index 46f00ac0..fbce0ebe 100644 --- a/Thermo.Active.Config/ServerConfigController.cs +++ b/Thermo.Active.Config/ServerConfigController.cs @@ -518,6 +518,8 @@ namespace Thermo.Active.Config IsActive = Convert.ToBoolean(x.Element("active").Value), IsVisible = Convert.ToBoolean(x.Element("visible").Value), IsStarred = x.Element("starred") != null ? Convert.ToBoolean(x.Element("starred").Value) : false, + RefCallParam = x.Element("refCallParam") != null ? x.Element("refCallParam").Value : "", + RefCallLabel = x.Element("refCallLabel") != null ? x.Element("refCallLabel").Value : "", Category = Convert.ToInt32(x.Element("category").Value), LocalizedNames = x.Element("localizedNames").Elements().ToDictionary( // Read localized names and convert into a dictionary y => y.Attribute("langKey").Value, y => y.Value @@ -760,7 +762,7 @@ namespace Thermo.Active.Config SetpointThermo = 0, MaxPower = riferimento.Potenza, NumResist = 1, - CalcIchMin = riferimento.Modello.Contains("Quarzo") || riferimento.Modello.Contains("Alogena") + CalcIchMin = riferimento.Modello.Contains("Quarzo") || riferimento.Modello.Contains("Alogena") }); } else diff --git a/Thermo.Active.Model/ConfigModels/UserSoftKeyConfigModel.cs b/Thermo.Active.Model/ConfigModels/UserSoftKeyConfigModel.cs index bf84c04b..a3cc51ed 100644 --- a/Thermo.Active.Model/ConfigModels/UserSoftKeyConfigModel.cs +++ b/Thermo.Active.Model/ConfigModels/UserSoftKeyConfigModel.cs @@ -11,6 +11,8 @@ namespace Thermo.Active.Model.ConfigModels public bool IsActive { get; set; } public bool IsVisible { get; set; } public bool IsStarred { get; set; } = false; + public string RefCallParam { get; set; } = ""; + public string RefCallLabel { get; set; } = ""; public bool OperatorConfirmationNeeded { get; set; } public List SubKeys { get; set; } public int PlcId { get; set; } diff --git a/Thermo.Active.Model/DTOModels/DTOUserSoftKeyModel.cs b/Thermo.Active.Model/DTOModels/DTOUserSoftKeyModel.cs index 3348e440..7bbcfc07 100644 --- a/Thermo.Active.Model/DTOModels/DTOUserSoftKeyModel.cs +++ b/Thermo.Active.Model/DTOModels/DTOUserSoftKeyModel.cs @@ -20,6 +20,8 @@ namespace Thermo.Active.Model.DTOModels public bool Visible { get; set; } public bool Starred { get; set; } = false; public bool Value { get; set; } + public string RefCallParam { get; set; } = ""; + public string RefCallLabel { get; set; } = ""; public override bool Equals(object obj) { @@ -34,6 +36,10 @@ namespace Thermo.Active.Model.DTOModels return false; if (Value != item.Value) return false; + if (RefCallParam != item.RefCallParam) + return false; + if (RefCallLabel != item.RefCallLabel) + return false; return true; } @@ -43,4 +49,5 @@ namespace Thermo.Active.Model.DTOModels return base.GetHashCode(); } } + } diff --git a/Thermo.Active.NC/NcAdapter.cs b/Thermo.Active.NC/NcAdapter.cs index 04237fa0..30ced3fe 100644 --- a/Thermo.Active.NC/NcAdapter.cs +++ b/Thermo.Active.NC/NcAdapter.cs @@ -1011,6 +1011,8 @@ namespace Thermo.Active.NC Id = subkey.Id, Active = plcSoftKey.Active, Starred = softKey.IsStarred, + RefCallParam = softKey.RefCallParam, + RefCallLabel = softKey.RefCallLabel, Category = softKey.Category, Value = plcSoftKey.Value }); @@ -1032,6 +1034,8 @@ namespace Thermo.Active.NC Id = softKey.Id, Active = plcSoftKey.Active, Starred = softKey.IsStarred, + RefCallParam = softKey.RefCallParam, + RefCallLabel = softKey.RefCallLabel, Category = softKey.Category, Visible = softKey.IsVisible, Value = plcSoftKey.Value @@ -1071,6 +1075,8 @@ namespace Thermo.Active.NC Id = subkey.Id, Active = plcSoftKey.Active, Starred = softKey.IsStarred, + RefCallParam = softKey.RefCallParam, + RefCallLabel = softKey.RefCallLabel, Category = softKey.Category, Value = plcSoftKey.Value }); @@ -1098,6 +1104,8 @@ namespace Thermo.Active.NC Id = softKey.Id, Active = plcSoftKey.Active, Starred = softKey.IsStarred, + RefCallParam = softKey.RefCallParam, + RefCallLabel = softKey.RefCallLabel, Category = softKey.Category, Visible = softKey.IsVisible, Value = plcSoftKey.Value