From eaea52f45d3d36ae997ab5dbd6b117ea4d7a0186 Mon Sep 17 00:00:00 2001 From: Annamaria Sassi Date: Tue, 28 Oct 2025 15:04:04 +0100 Subject: [PATCH] Serializzazione hw option nel JWD --- Test.UI/Data/AntaDoppia.jwd | 90 ++++++++++--------- WebWindowComplex/Json/JsonUtility.cs | 60 +++++++++++++ WebWindowComplex/Models/AGBOption.cs | 17 +++- WebWindowComplex/Models/AGBOptionCombo.cs | 11 +++ WebWindowComplex/Models/AGBOptionText.cs | 11 +++ WebWindowComplex/Models/Sash.cs | 2 + WebWindowComplex/TableComp.razor | 9 +- WebWindowComplex/TableComp.razor.cs | 16 +++- WebWindowComplex/WebWindowComplex.csproj | 3 +- .../WebWindowConfigurator.csproj | 11 ++- 10 files changed, 175 insertions(+), 55 deletions(-) diff --git a/Test.UI/Data/AntaDoppia.jwd b/Test.UI/Data/AntaDoppia.jwd index b81a6b1..86e2fa4 100644 --- a/Test.UI/Data/AntaDoppia.jwd +++ b/Test.UI/Data/AntaDoppia.jwd @@ -10,30 +10,30 @@ { "nIndex": 1, "sName": "Width", - "dValue": 1200.0 + "dValue": 800.0 }, { "nIndex": 2, "sName": "Height", - "dValue": 1500.0 + "dValue": 1200.0 } ], "JointList": [ { "nIndex": 1, - "JointType": "FULL_V" + "JointType": "FULL_H" }, { "nIndex": 2, - "JointType": "FULL_V" + "JointType": "FULL_H" }, { "nIndex": 3, - "JointType": "FULL_V" + "JointType": "FULL_H" }, { "nIndex": 4, - "JointType": "FULL_V" + "JointType": "FULL_H" } ], "BottomRail": false, @@ -45,62 +45,72 @@ "SashList": [ { "nSashId": 1, - "OpeningType": "TURNONLY_LEFT", - "bHasHandle": false, - "dDimension": 50.0 - }, - { - "nSashId": 2, - "OpeningType": "TILTTURN_RIGHT", + "OpeningType": "TILTTURN_LEFT", "bHasHandle": true, - "dDimension": 50.0 + "dDimension": 100.0 } ], "SashType": "NULL", "JointList": [ { "nIndex": 1, - "JointType": "FULL_V" + "JointType": "FULL_H" }, { "nIndex": 2, - "JointType": "FULL_V" + "JointType": "FULL_H" }, { "nIndex": 3, - "JointType": "FULL_V" + "JointType": "FULL_H" }, { "nIndex": 4, - "JointType": "FULL_V" + "JointType": "FULL_H" + } + ], + "BottomRail": false, + "BottomRailQty": 0, + "Hardware": "000632", + "HwOptionList": [ + { + "Name": "Entrata", + "Value": "15 mm", + "Type": "Combo" + }, + { + "Name": "LavManigliaPassante", + "Value": "No", + "Type": "Combo" + }, + { + "Name": "PosizioneForoCilindro", + "Value": "Cilindro sopra la maniglia", + "Type": "Combo" + }, + { + "Name": "ModelloCilindro", + "Value": "Nessun cilindro", + "Type": "Combo" + }, + { + "Name": "LavCilindroPassante", + "Value": "No", + "Type": "Combo" + }, + { + "Name": "HMan", + "Value": "", + "Type": "Text" } ], - "Hardware": "000631", "GroupId": 2, "AreaList": [ { + "FillType": "GLASS", "GroupId": 3, - "AreaList": [ - { - "GroupId": 4, - "FillType": "GLASS", - "AreaList": [], - "AreaType": "FILL" - } - ], - "AreaType": "SPLITTED" - }, - { - "GroupId": 5, - "AreaList": [ - { - "FillType": "GLASS", - "GroupId": 6, - "AreaList": [], - "AreaType": "FILL" - } - ], - "AreaType": "SPLITTED" + "AreaList": [], + "AreaType": "FILL" } ], "AreaType": "SASH" diff --git a/WebWindowComplex/Json/JsonUtility.cs b/WebWindowComplex/Json/JsonUtility.cs index 70cb19a..110e931 100644 --- a/WebWindowComplex/Json/JsonUtility.cs +++ b/WebWindowComplex/Json/JsonUtility.cs @@ -367,6 +367,20 @@ namespace WebWindowComplex.Json } } + private List m_HwOptionList = new List(); + [JsonProperty] + public List HwOptionList + { + get + { + return m_HwOptionList; + } + set + { + m_HwOptionList = value; + } + } + public JsonSash() : base(AreaTypes.SASH) { } @@ -401,6 +415,8 @@ namespace WebWindowComplex.Json newSash.SetSelFamilyHardwareFromIndex(Hardware); newSash.ReqRefreshShape(); newSash.SetSelHardwareFromId(Hardware); + //foreach (var HwOption in m_HwOptionList) + // newSash.HwOptionList.Add(HwOption.Deserialize()); foreach (var Area in AreaList) { var AreaDeserealized = Area.Deserialize(newSash, ParentWindow); @@ -640,6 +656,50 @@ namespace WebWindowComplex.Json } } + public class JsonHwOption + { + private string m_Name; + [JsonProperty] + public string Name + { + get + { + return m_Name; + } + set + { + m_Name = value; + } + } + + private string m_Value; + [JsonProperty] + public string Value + { + get + { + return m_Value; + } + set + { + m_Value = value; + } + } + + public JsonHwOption(string sName, string sValue) + { + m_Name = sName; + m_Value = sValue; + } + + //internal AGBOption Deserialize() + //{ + // AGBOption newOption = new AGBOption(m_Name, m_Value); + // return newOption; + //} + + } + public class JsonFrameDimension { private int m_nIndex; diff --git a/WebWindowComplex/Models/AGBOption.cs b/WebWindowComplex/Models/AGBOption.cs index e92e902..f6e3f36 100644 --- a/WebWindowComplex/Models/AGBOption.cs +++ b/WebWindowComplex/Models/AGBOption.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using WebWindowComplex.Json; using static WebWindowComplex.Json.WindowConst; namespace WebWindowComplex.Models @@ -11,11 +12,16 @@ namespace WebWindowComplex.Models { #region Public Constructors + /// + /// Costruttore partendo da xml + /// + /// public AGBOption(ParametriOpzioniParametri HdwOptionParam) { m_sName = HdwOptionParam.NomeParametro; m_sDescription = HdwOptionParam.DescrizioneParametro; - m_OptVisibility = Visibility.VISIBLE; // If(HdwOptionParam.Visible.ToLower = "true", Visibility.Visible, Visibility.Collapsed) + m_OptVisibility = Visibility.VISIBLE; + // If(HdwOptionParam.Visible.ToLower = "true", Visibility.Visible, Visibility.Collapsed) } #endregion Public Constructors @@ -56,6 +62,15 @@ namespace WebWindowComplex.Models #endregion Public Properties + #region Internal Methods + + internal virtual JsonHwOption Serialize() + { + return null; + } + + #endregion Internal Methods + #region Protected Fields protected HwOptionTypes m_Type; diff --git a/WebWindowComplex/Models/AGBOptionCombo.cs b/WebWindowComplex/Models/AGBOptionCombo.cs index 4cbe031..352fe03 100644 --- a/WebWindowComplex/Models/AGBOptionCombo.cs +++ b/WebWindowComplex/Models/AGBOptionCombo.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using WebWindowComplex.Json; using static WebWindowComplex.Json.WindowConst; namespace WebWindowComplex.Models @@ -45,6 +46,16 @@ namespace WebWindowComplex.Models #endregion Public Properties + #region Internal Methods + + internal override JsonHwOption Serialize() + { + JsonHwOption JsonHwOption = new JsonHwOption(sName, m_sValue.sDescription); + return JsonHwOption; + } + + #endregion Internal Methods + #region Private Fields private AGBOptionParameter m_sValue; diff --git a/WebWindowComplex/Models/AGBOptionText.cs b/WebWindowComplex/Models/AGBOptionText.cs index fbb5b6d..d325dbb 100644 --- a/WebWindowComplex/Models/AGBOptionText.cs +++ b/WebWindowComplex/Models/AGBOptionText.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using WebWindowComplex.Json; using static WebWindowComplex.Json.WindowConst; namespace WebWindowComplex.Models @@ -80,6 +81,16 @@ namespace WebWindowComplex.Models #endregion Public Properties + #region Internal Methods + + internal override JsonHwOption Serialize() + { + JsonHwOption JsonHwOption = new JsonHwOption(sName, m_sValue); + return JsonHwOption; + } + + #endregion Internal Methods + #region Private Fields private string m_sValue; diff --git a/WebWindowComplex/Models/Sash.cs b/WebWindowComplex/Models/Sash.cs index b9ee70b..349d67e 100644 --- a/WebWindowComplex/Models/Sash.cs +++ b/WebWindowComplex/Models/Sash.cs @@ -655,6 +655,8 @@ namespace WebWindowComplex.Models JsonSash.SashList.Add(SashDimension.Serialize()); foreach (var Joint in JointList) JsonSash.JointList.Add(Joint.Serialize()); + foreach (var HwOption in HwOptionList) + JsonSash.HwOptionList.Add(HwOption.Serialize()); foreach (var Area in AreaList) JsonSash.AreaList.Add(Area.Serialize()); return JsonSash; diff --git a/WebWindowComplex/TableComp.razor b/WebWindowComplex/TableComp.razor index c415f98..37e7422 100644 --- a/WebWindowComplex/TableComp.razor +++ b/WebWindowComplex/TableComp.razor @@ -236,11 +236,4 @@ } } } - - -@if (bError) -{ - -} \ No newline at end of file + \ No newline at end of file diff --git a/WebWindowComplex/TableComp.razor.cs b/WebWindowComplex/TableComp.razor.cs index 4f7ebb2..bb0f976 100644 --- a/WebWindowComplex/TableComp.razor.cs +++ b/WebWindowComplex/TableComp.razor.cs @@ -571,8 +571,6 @@ namespace WebWindowComplex { // reset editLock... editLock = false; - // reset variabile errori - bError = false; listErrPre = new Dictionary(); listErrLink = new Dictionary(); listWarnings = new Dictionary(); @@ -732,6 +730,10 @@ namespace WebWindowComplex } } + /// + /// Metodo per costruire oggetti della Window + /// + /// protected void setCurrWindow(JsonWindow WindowFromJson) { if (m_CurrWindow != null) @@ -812,8 +814,6 @@ namespace WebWindowComplex #region Private Fields - private bool bError = false; - private int currAnta = 0; private int currFill = -1; @@ -900,6 +900,10 @@ namespace WebWindowComplex //await DoPreviewSvg(); } + /// + /// Metodo per aggiungere una sash di default al Frame + /// + /// private void AddSashToFrame(Frame f) { f.AddFirstSash(); @@ -910,6 +914,10 @@ namespace WebWindowComplex _ = DoReqShape(reqList); } + /// + /// Metodo per aggiungere uno split di default al Frame + /// + /// private void AddSplitToFrame(Frame f) { f.AddSplit(); diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index 6a261f2..92e4482 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.10.2716 + 2.7.10.2815 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -163,5 +163,6 @@ + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index 9ddb469..74ab599 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.10.2716 + 2.7.10.2815 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -218,6 +218,15 @@ + + + + + + + + +