From 9d4d6128c321b1b05b2c510fcc77719c8de196b1 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Wed, 29 Oct 2025 16:52:59 +0100 Subject: [PATCH] Fix chiamata senza HW iniziale + altre in ordine --- WebWindowComplex/Models/Area.cs | 2 +- WebWindowComplex/Models/Fill.cs | 4 +- WebWindowComplex/Models/Frame.cs | 4 +- WebWindowComplex/Models/Sash.cs | 7 ++- WebWindowComplex/Models/Split.cs | 4 +- WebWindowComplex/Models/Splitted.cs | 4 +- WebWindowComplex/Models/Window.cs | 9 ++- WebWindowComplex/TableComp.razor.cs | 55 ++++++++++++------- WebWindowComplex/WebWindowComplex.csproj | 16 ++++++ .../WebWindowConfigurator.csproj | 19 +++++++ 10 files changed, 89 insertions(+), 35 deletions(-) diff --git a/WebWindowComplex/Models/Area.cs b/WebWindowComplex/Models/Area.cs index 65f52d7..858f6de 100644 --- a/WebWindowComplex/Models/Area.cs +++ b/WebWindowComplex/Models/Area.cs @@ -239,7 +239,7 @@ namespace WebWindowComplex.Models #region Internal Methods - internal abstract JsonArea Serialize(); + internal abstract JsonArea Serialize(bool hideHw); internal void SetAreaType(AreaTypes AreaType) { diff --git a/WebWindowComplex/Models/Fill.cs b/WebWindowComplex/Models/Fill.cs index 6126005..27cb798 100644 --- a/WebWindowComplex/Models/Fill.cs +++ b/WebWindowComplex/Models/Fill.cs @@ -84,13 +84,13 @@ namespace WebWindowComplex.Models return Fill; } - internal override JsonArea Serialize() + internal override JsonArea Serialize(bool hideHw) { if (nCounterGroup < GroupId) Area.nCounterGroup = GroupId; JsonFill JsonFill = new JsonFill(FillType, GroupId); foreach (var Area in AreaList) - JsonFill.AreaList.Add(Area.Serialize()); + JsonFill.AreaList.Add(Area.Serialize(hideHw)); return JsonFill; } diff --git a/WebWindowComplex/Models/Frame.cs b/WebWindowComplex/Models/Frame.cs index 7434d54..7ec1e72 100644 --- a/WebWindowComplex/Models/Frame.cs +++ b/WebWindowComplex/Models/Frame.cs @@ -237,7 +237,7 @@ namespace WebWindowComplex.Models return NewFrame; } - internal override JsonArea Serialize() + internal override JsonArea Serialize(bool hideHw) { Area.nCounterGroup = 0; if (nCounterGroup < GroupId) @@ -248,7 +248,7 @@ namespace WebWindowComplex.Models foreach (var Joint in JointList) JsonFrame.JointList.Add(Joint.Serialize()); foreach (var Area in AreaList) - JsonFrame.AreaList.Add(Area.Serialize()); + JsonFrame.AreaList.Add(Area.Serialize(hideHw)); return JsonFrame; } diff --git a/WebWindowComplex/Models/Sash.cs b/WebWindowComplex/Models/Sash.cs index 7fd3216..2c19ef9 100644 --- a/WebWindowComplex/Models/Sash.cs +++ b/WebWindowComplex/Models/Sash.cs @@ -655,11 +655,12 @@ namespace WebWindowComplex.Models m_HwdOptionList.Clear(); } - internal override JsonArea Serialize() + internal override JsonArea Serialize(bool hideHw) { if (nCounterGroup < GroupId) Area.nCounterGroup = GroupId; - JsonSash JsonSash = new JsonSash(m_bIsSashVertical, m_SashType, m_bSashBottomRail, m_nSashBottomRailQty, m_SelHardware.Id, GroupId); + string currHwId = hideHw ? CustomHwId : m_SelHardware.Id; + JsonSash JsonSash = new JsonSash(m_bIsSashVertical, m_SashType, m_bSashBottomRail, m_nSashBottomRailQty, currHwId, GroupId); foreach (var SashDimension in SashList) JsonSash.SashList.Add(SashDimension.Serialize()); foreach (var Joint in JointList) @@ -667,7 +668,7 @@ namespace WebWindowComplex.Models foreach (var HwOption in HwOptionList) JsonSash.HwOptionList.Add(HwOption.Serialize()); foreach (var Area in AreaList) - JsonSash.AreaList.Add(Area.Serialize()); + JsonSash.AreaList.Add(Area.Serialize(hideHw)); return JsonSash; } diff --git a/WebWindowComplex/Models/Split.cs b/WebWindowComplex/Models/Split.cs index e845b3e..d0b49b6 100644 --- a/WebWindowComplex/Models/Split.cs +++ b/WebWindowComplex/Models/Split.cs @@ -369,7 +369,7 @@ namespace WebWindowComplex.Models return Split; } - internal override JsonArea Serialize() + internal override JsonArea Serialize(bool hideHw) { if (nCounterGroup < GroupId) Area.nCounterGroup = GroupId; @@ -382,7 +382,7 @@ namespace WebWindowComplex.Models foreach (var SplitHoriz in m_SplitHorizList) JsonSplit.SplitHorizList.Add(SplitHoriz.Serialize()); foreach (var Area in AreaList) - JsonSplit.AreaList.Add(Area.Serialize()); + JsonSplit.AreaList.Add(Area.Serialize(hideHw)); return JsonSplit; } diff --git a/WebWindowComplex/Models/Splitted.cs b/WebWindowComplex/Models/Splitted.cs index 012c38d..02baf89 100644 --- a/WebWindowComplex/Models/Splitted.cs +++ b/WebWindowComplex/Models/Splitted.cs @@ -42,13 +42,13 @@ namespace WebWindowComplex.Models return Splitted; } - internal override JsonArea Serialize() + internal override JsonArea Serialize(bool hideHw) { if (nCounterGroup < GroupId) Area.nCounterGroup = GroupId; JsonSplitted JsonSplitted = new JsonSplitted(GroupId); foreach (var Area in AreaList) - JsonSplitted.AreaList.Add(Area.Serialize()); + JsonSplitted.AreaList.Add(Area.Serialize(hideHw)); return JsonSplitted; } diff --git a/WebWindowComplex/Models/Window.cs b/WebWindowComplex/Models/Window.cs index 4b37f20..cbe80e5 100644 --- a/WebWindowComplex/Models/Window.cs +++ b/WebWindowComplex/Models/Window.cs @@ -103,11 +103,16 @@ namespace WebWindowComplex.Models } } - internal JsonWindow Serialize() + /// + /// Serializzazione dell'oggetto windows + /// + /// Hide hw x preview SVG veloci + /// + internal JsonWindow Serialize(bool hideHw = false) { JsonWindow JsonWindow = new JsonWindow(sProfilePath, sMaterial, sColorMaterial, sGlass); foreach (var Area in AreaList) - JsonWindow.AreaList.Add(Area.Serialize()); + JsonWindow.AreaList.Add(Area.Serialize(hideHw)); return JsonWindow; } diff --git a/WebWindowComplex/TableComp.razor.cs b/WebWindowComplex/TableComp.razor.cs index 36a0ea7..befd99b 100644 --- a/WebWindowComplex/TableComp.razor.cs +++ b/WebWindowComplex/TableComp.razor.cs @@ -452,15 +452,19 @@ namespace WebWindowComplex /// /// Richiesta update anteprima SVG /// + /// Forza richiesta anche con JWD invariato + /// Nasconde hw (def. false) poiché senza è piu rapido /// - protected async Task DoPreviewSvg(bool doForce = false) + protected async Task DoPreviewSvg(bool doForce = false, bool hideHw = false) { if (m_CurrWindow != null) { #if DEBUG - var CurrJwd = JsonConvert.SerializeObject(m_CurrWindow.Serialize(), Formatting.Indented); + var CurrJwd = JsonConvert.SerializeObject(m_CurrWindow.Serialize(false), Formatting.Indented); + var CalcJwd = JsonConvert.SerializeObject(m_CurrWindow.Serialize(hideHw), Formatting.Indented); #else - var CurrJwd = JsonConvert.SerializeObject(m_CurrWindow.Serialize()); + var CurrJwd = JsonConvert.SerializeObject(m_CurrWindow.Serialize(false)); + var CalcJwd = JsonConvert.SerializeObject(m_CurrWindow.Serialize(hideHw)); #endif // verifico variazione JWD if (!prevJwd.Equals(CurrJwd) || doForce) @@ -468,7 +472,7 @@ namespace WebWindowComplex prevJwd = CurrJwd; Dictionary Args = new Dictionary(); Args.Add("Mode", $"{(int)Enums.QuestionModes.PREVIEW}"); - Args.Add("Jwd", CurrJwd); + Args.Add("Jwd", CalcJwd); await EC_DoUpdate.InvokeAsync(Args); } } @@ -564,7 +568,7 @@ namespace WebWindowComplex protected override void OnAfterRender(bool firstRender) { - isLoading = false; + isRendered = true; } /// @@ -579,6 +583,8 @@ namespace WebWindowComplex listWarnings = new Dictionary(); } + private bool firstDisplay = true; + /// /// Gestione update post ricezione parametri da controllo chiamante /// @@ -697,31 +703,37 @@ namespace WebWindowComplex } if (updRequested) { - // se mancasse xml opzioni hardware lo chiedo - if (LiveData.DictOptionsXml.Count == 0) - { - List reqList = SashList.Select(x => x.GroupId).ToList(); - //foreach (var item in SashList) - //{ - // string req = item.SelHardware.Id; - // if (string.IsNullOrEmpty(req)) - // { - // } - //} - if (reqList.Count > 0) - { - await DoReqOptHardware(reqList); - } - } + // se mancasse dizionario forme chiamo quello if (LiveData.DictShape.Count == 0) { + if (firstDisplay && isRendered) + { + firstDisplay = false; + // preview SVG senza HW + await DoPreviewSvg(true, true); + } List reqList = SashList.Select(x => x.GroupId).ToList(); if (reqList.Count > 0) { await DoReqShape(reqList); } } + // se mancasse xml opzioni hardware lo chiedo + else if (LiveData.DictOptionsXml.Count == 0) + { + if (firstDisplay && isRendered) + { + firstDisplay = false; + // preview SVG senza HW + await DoPreviewSvg(true, true); + } + List reqList = SashList.Select(x => x.GroupId).ToList(); + if (reqList.Count > 0) + { + await DoReqOptHardware(reqList); + } + } else { // chiedo SVG @@ -846,6 +858,7 @@ namespace WebWindowComplex /// Booleana fase loading /// private bool isLoading = false; + private bool isRendered = false; /// /// ELenco errori di coerenza/link dati (vanno risolti per disegnare/procedere) diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index e1e04cf..c722e95 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -168,6 +168,22 @@ + + + + + + + + + + + + + + + + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index 3568d74..0f07a09 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -240,6 +240,25 @@ + + + + + + + + + + + + + + + + + + +