From 7a0735fc430c3f57d7aa7366e009507b3b98aee0 Mon Sep 17 00:00:00 2001 From: Annamaria Sassi Date: Mon, 18 Aug 2025 17:37:33 +0200 Subject: [PATCH] Dizionario per passare jwd --- Test.UI/Components/Pages/Aedifica.razor | 2 - Test.UI/Components/Pages/EditJWD.razor.cs | 24 ++- Test.UI/Components/Pages/Home.razor.cs | 20 +- .../Components/Pages/TestComponent.razor.cs | 19 +- .../WebWindowConfigurator.csproj | 21 +- WebWindowConfigurator/WebWindowMaker.razor | 194 +++++++++++++----- WebWindowConfigurator/WebWindowMaker.razor.cs | 48 ++--- WebWindowConfigurator/Window.cs | 44 ++-- WebWindowJWD/WebWindowJWDInput.razor.cs | 32 +-- 9 files changed, 284 insertions(+), 120 deletions(-) diff --git a/Test.UI/Components/Pages/Aedifica.razor b/Test.UI/Components/Pages/Aedifica.razor index 34fb91c..556d0b0 100644 --- a/Test.UI/Components/Pages/Aedifica.razor +++ b/Test.UI/Components/Pages/Aedifica.razor @@ -8,5 +8,3 @@ LiveSVG="@currSvg"> -@*

@currText

*@ - diff --git a/Test.UI/Components/Pages/EditJWD.razor.cs b/Test.UI/Components/Pages/EditJWD.razor.cs index 2e95766..755820b 100644 --- a/Test.UI/Components/Pages/EditJWD.razor.cs +++ b/Test.UI/Components/Pages/EditJWD.razor.cs @@ -1,4 +1,5 @@ using EgwCoreLib.Lux.Core; +using EgwCoreLib.Lux.Core.RestPayload; using EgwCoreLib.Lux.Data.Services; using Microsoft.AspNetCore.Components; using Newtonsoft.Json; @@ -29,6 +30,7 @@ namespace Test.UI.Components.Pages #region Protected Fields protected string currJwd = ""; + protected Dictionary m_CurrArgs = new Dictionary(); #endregion Protected Fields @@ -47,7 +49,7 @@ namespace Test.UI.Components.Pages { get { - string outVal = currJwd; + string outVal = m_CurrArgs["Jwd"]; return (MarkupString)outVal.Replace(Environment.NewLine, "
").Replace(" ", " "); } } @@ -73,12 +75,12 @@ namespace Test.UI.Components.Pages private string apiUrl = ""; private string calcTag = ""; + private string CalcUid = "CurrWindow"; private string cFile = "Data/Setup.json"; private string currSvg = ""; private string imgBasePath = ""; - - private string imgTag = ""; + private string GenericBasePath = ""; private string subChannel = ""; @@ -112,8 +114,8 @@ namespace Test.UI.Components.Pages { apiUrl = Config.GetValue("ServerConf:Prog.ApiUrl") ?? ""; imgBasePath = Config.GetValue("ServerConf:ImageBaseUrl") ?? ""; - imgTag = Config.GetValue("ServerConf:ImageFileTag") ?? ""; - calcTag = Config.GetValue("ServerConf:ImageCalcTag") ?? ""; + GenericBasePath = Config.GetValue("ServerConf:GenericBaseUrl") ?? ""; + calcTag = Config.GetValue("ServerConf:CalcTag") ?? ""; subChannel = Config.GetValue("ServerConf:SvgChannel") ?? ""; } @@ -132,11 +134,17 @@ namespace Test.UI.Components.Pages isLoading = false; } - private async Task SaveJWD(string newSerial) + private async Task SaveJWD(Dictionary CurrArgs) { - currJwd = newSerial; + m_CurrArgs = CurrArgs; // chiamo la chiamata POST alla API, che manda la richiesta via REDIS - await ICService.CallRestPost($"{apiUrl}/{imgBasePath}", $"{calcTag}/{windowUid}", currJwd); + if (m_CurrArgs != null) + { + CalcRequestDTO calcRequestDTO = new CalcRequestDTO(); + calcRequestDTO.EnvType = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW; + calcRequestDTO.DictExec = m_CurrArgs; + await ICService.CallRestPost($"{apiUrl}/{GenericBasePath}", $"{calcTag}/{CalcUid}", calcRequestDTO); + } } #endregion Private Methods diff --git a/Test.UI/Components/Pages/Home.razor.cs b/Test.UI/Components/Pages/Home.razor.cs index ad91dee..6c56626 100644 --- a/Test.UI/Components/Pages/Home.razor.cs +++ b/Test.UI/Components/Pages/Home.razor.cs @@ -1,8 +1,8 @@ using EgwCoreLib.Lux.Core; +using EgwCoreLib.Lux.Core.RestPayload; using EgwCoreLib.Lux.Data.Services; using Microsoft.AspNetCore.Components; using Newtonsoft.Json; -using System.Security.AccessControl; using WebWindowConfigurator; using WebWindowConfigurator.DTO; @@ -28,6 +28,7 @@ namespace Test.UI.Components.Pages #region Protected Fields protected string currJwd = ""; + protected Dictionary m_CurrArgs = new Dictionary(); #endregion Protected Fields @@ -73,13 +74,13 @@ namespace Test.UI.Components.Pages private string apiUrl = ""; private string calcTag = ""; + private string CalcUid = "CurrWindow"; private string cFile = "Data/Setup.json"; private TemplateSelectDTO? currSel = null; private string currSvg = ""; private string imgBasePath = ""; - - private string imgTag = ""; + private string GenericBasePath = ""; private string subChannel = ""; @@ -124,8 +125,8 @@ namespace Test.UI.Components.Pages { apiUrl = Config.GetValue("ServerConf:Prog.ApiUrl") ?? ""; imgBasePath = Config.GetValue("ServerConf:ImageBaseUrl") ?? ""; - imgTag = Config.GetValue("ServerConf:ImageFileTag") ?? ""; - calcTag = Config.GetValue("ServerConf:ImageCalcTag") ?? ""; + GenericBasePath = Config.GetValue("ServerConf:GenericBaseUrl") ?? ""; + calcTag = Config.GetValue("ServerConf:CalcTag") ?? ""; subChannel = Config.GetValue("ServerConf:SvgChannel") ?? ""; } @@ -155,14 +156,17 @@ namespace Test.UI.Components.Pages isLoading = false; } - private async Task SaveJWD(string newSerial) + private async Task SaveJWD(Dictionary CurrArgs) { - currJwd = newSerial; + m_CurrArgs = CurrArgs; // chiamo la chiamata POST alla API, che manda la richiesta via REDIS if (currSel != null) { + CalcRequestDTO calcRequestDTO = new CalcRequestDTO(); + calcRequestDTO.EnvType = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW; + calcRequestDTO.DictExec = m_CurrArgs; + await ICService.CallRestPost($"{apiUrl}/{GenericBasePath}", $"{calcTag}/{CalcUid}", calcRequestDTO); } - await ICService.CallRestPost($"{apiUrl}/{imgBasePath}", $"{calcTag}/{windowUid}", currJwd); } private void SetTemplate(TemplateSelectDTO selTemp) diff --git a/Test.UI/Components/Pages/TestComponent.razor.cs b/Test.UI/Components/Pages/TestComponent.razor.cs index b6c0e38..ec55333 100644 --- a/Test.UI/Components/Pages/TestComponent.razor.cs +++ b/Test.UI/Components/Pages/TestComponent.razor.cs @@ -1,4 +1,5 @@ using EgwCoreLib.Lux.Core; +using EgwCoreLib.Lux.Core.RestPayload; using EgwCoreLib.Lux.Data.Services; using Microsoft.AspNetCore.Components; using Newtonsoft.Json; @@ -28,6 +29,7 @@ namespace Test.UI.Components.Pages #region Protected Fields protected string currJwd = "..."; + protected Dictionary m_CurrArgs = new Dictionary(); #endregion Protected Fields @@ -66,13 +68,13 @@ namespace Test.UI.Components.Pages private string apiUrl = ""; private string calcTag = ""; + private string CalcUid = "CurrWindow"; private string cFile = "Data/Setup.json"; private TemplateSelectDTO? currSel = null; private string currSvg = ""; private string imgBasePath = ""; - - private string imgTag = ""; + private string GenericBasePath = ""; private string subChannel = ""; @@ -117,8 +119,8 @@ namespace Test.UI.Components.Pages { apiUrl = Config.GetValue("ServerConf:Prog.ApiUrl") ?? ""; imgBasePath = Config.GetValue("ServerConf:ImageBaseUrl") ?? ""; - imgTag = Config.GetValue("ServerConf:ImageFileTag") ?? ""; - calcTag = Config.GetValue("ServerConf:ImageCalcTag") ?? ""; + GenericBasePath = Config.GetValue("ServerConf:GenericBaseUrl") ?? ""; + calcTag = Config.GetValue("ServerConf:CalcTag") ?? ""; subChannel = Config.GetValue("ServerConf:SvgChannel") ?? ""; } @@ -146,13 +148,16 @@ namespace Test.UI.Components.Pages } } - private async Task SaveJWD(string newSerial) + private async Task SaveJWD(Dictionary CurrArgs) { - currJwd = newSerial; + m_CurrArgs = CurrArgs; // chiamo la chiamata POST alla API, che manda la richiesta via REDIS if (currSel != null) { - await ICService.CallRestPost($"{apiUrl}/{imgBasePath}", $"{calcTag}/{windowUid}", currJwd); + CalcRequestDTO calcRequestDTO = new CalcRequestDTO(); + calcRequestDTO.EnvType = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW; + calcRequestDTO.DictExec = m_CurrArgs; + await ICService.CallRestPost($"{apiUrl}/{GenericBasePath}", $"{calcTag}/{CalcUid}", calcRequestDTO); } } diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index a58c93b..3444af9 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -4,7 +4,7 @@ net8.0 enable enable - 2.7.8.1117 + 2.7.8.1817 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -62,6 +62,25 @@ + + + + + + + + + + + + + + + + + + + diff --git a/WebWindowConfigurator/WebWindowMaker.razor b/WebWindowConfigurator/WebWindowMaker.razor index 5c1c01a..3dba55a 100644 --- a/WebWindowConfigurator/WebWindowMaker.razor +++ b/WebWindowConfigurator/WebWindowMaker.razor @@ -159,15 +159,23 @@ @foreach (var dim in item.SplitPositionList) { + string desc = ""; + @if (item.SelSplitShape == Json.WindowConst.SplitShapes.VERTICAL) + { + desc = "Larghezza split "; + } + else + { + desc = "Altezza split "; + }
- Altezza area inferiore + @desc @(item.SplitPositionList.IndexOf(dim) + 1)
} } - @* *@ @@ -176,16 +184,16 @@ {
-
+
@foreach (var item in SashList) { -
+
Number
-
+
Orientation
@@ -199,49 +207,145 @@
@foreach (SashDimension sash in item.SashList) { -
-
- @if(item.SashList.Count == 1) - { -
Opening
- } - else - { -
Sash opening @(item.SashList.IndexOf(sash) + 1)
- } -
- - -
-
- Dimension - -
-
-
- +
+
+
+ @if (item.SashList.Count == 1) + { +
Opening
+ } + else + { +
Sash opening @(item.SashList.IndexOf(sash) + 1)
+ } +
+ +
-
- +
+ Dimension + +
+
+
+ +
+
+ +
} -
+ @*
+ @for(int i = 0; i < item.SashList.Count; i += 2) + { +
+
+
+ @if (item.SashList.Count == 1) + { +
Opening
+ } + else + { +
Sash opening @(i + 1)
+ } +
+ + +
+
+ Dimension + +
+
+
+ +
+
+ +
+
+
+
+
+ @if( i + 1 < item.SashList.Count) + { +
+
+
+ @if (item.SashList.Count == 1) + { +
Opening
+ } + else + { +
Sash opening @(i + 2)
+ } +
+ + +
+
+ Dimension + +
+
+
+ +
+
+ +
+
+
+
+
+ } + } +
*@ +
Sash joints
@foreach (Joint joint in item.JointList) @@ -257,7 +361,7 @@ }
-
+
Bottom rail
@@ -267,9 +371,7 @@
} - - @* *@ -
+
} diff --git a/WebWindowConfigurator/WebWindowMaker.razor.cs b/WebWindowConfigurator/WebWindowMaker.razor.cs index 38975e8..1053eeb 100644 --- a/WebWindowConfigurator/WebWindowMaker.razor.cs +++ b/WebWindowConfigurator/WebWindowMaker.razor.cs @@ -1,9 +1,6 @@ using Microsoft.AspNetCore.Components; using Newtonsoft.Json; -using System.Collections.ObjectModel; using System.Reflection.Metadata; -using System.Runtime.Intrinsics.X86; -using System.Text.Json.Serialization; using WebWindowConfigurator.DTO; using WebWindowConfigurator.Json; using static WebWindowConfigurator.Json.WindowConst; @@ -24,12 +21,7 @@ namespace WebWindowConfigurator public EventCallback EC_OnSelectedTemplate { get; set; } [Parameter] - public EventCallback EC_OnUpdate { get; set; } - - public List FillList - { - get => m_FillList; - } + public EventCallback> EC_OnUpdate { get; set; } [Parameter] public Template IN_SelTemplate @@ -110,7 +102,6 @@ namespace WebWindowConfigurator set => m_Frame = value; } - protected string m_CurrJwd { get; set; } protected string m_SelSVG { get; set; } = ""; /// @@ -130,14 +121,18 @@ namespace WebWindowConfigurator { get => m_SashList; } - - protected TemplateSelectDTO? SelTemplateDTO { get; set; } = null; - protected List SplitList { get => m_SplitList; } + protected List FillList + { + get => m_FillList; + } + + protected TemplateSelectDTO? SelTemplateDTO { get; set; } = null; + #endregion Protected Properties #region Protected Methods @@ -149,8 +144,14 @@ namespace WebWindowConfigurator protected async Task DoPreviewSvg() { - var CurrJwd = JsonConvert.SerializeObject(m_CurrWindow.Serialize(), Formatting.Indented); - await EC_OnUpdate.InvokeAsync(CurrJwd); + if (m_CurrWindow != null) + { + var CurrJwd = JsonConvert.SerializeObject(m_CurrWindow.Serialize(), Formatting.Indented); + Dictionary Args = new Dictionary(); + Args.Add("Jwd", CurrJwd); + Args.Add("Mode", 1.ToString()); + await EC_OnUpdate.InvokeAsync(Args); + } } protected async Task DoSave() @@ -213,15 +214,13 @@ namespace WebWindowConfigurator private CompileStep currStep = CompileStep.Template; - private List m_FillList = new List(); - private Frame m_Frame; private List m_SashList = new List(); private List m_SplitList = new List(); - private int counter = 0; + private List m_FillList = new List(); #endregion Private Fields @@ -242,11 +241,10 @@ namespace WebWindowConfigurator private void M_CurrWindow_OnPreview(object? sender, OnPreviewEventArgs e) { - EC_OnUpdate.InvokeAsync(e.sJwd); -#if false - var CurrJwd = JsonConvert.SerializeObject(m_CurrWindow.Serialize(), Formatting.Indented); - EC_OnUpdate.InvokeAsync(CurrJwd); -#endif + Dictionary Args = new Dictionary(); + Args.Add("Jwd", e.sJwd); + Args.Add("Mode", 1.ToString()); + EC_OnUpdate.InvokeAsync(Args); } /// @@ -259,6 +257,10 @@ namespace WebWindowConfigurator return testStep.Equals(currStep) ? "nav-link active fw-bold" : "nav-link text-secondary"; } + /// + /// Calcola larghezza + /// + /// private string mainCss() { return currStep == CompileStep.Template ? "col-12" : "col-6"; diff --git a/WebWindowConfigurator/Window.cs b/WebWindowConfigurator/Window.cs index 081ced4..b769318 100644 --- a/WebWindowConfigurator/Window.cs +++ b/WebWindowConfigurator/Window.cs @@ -367,7 +367,7 @@ namespace WebWindowConfigurator } } // aggiungo Joint - int nJointQty = 4; + //int nJointQty = 4; switch (Value) { case Shapes.RECTANGLE: @@ -902,7 +902,7 @@ namespace WebWindowConfigurator } } - private Hardware m_SelHardware; + //private Hardware m_SelHardware; //public Hardware SelHardware //{ // get @@ -1924,6 +1924,7 @@ namespace WebWindowConfigurator if (m_Parent.bIsPercentage) { int nIndex = RelativeDimList.IndexOf(this); + // se diminuisce dimensione if (value < m_dDimension) { if (nIndex < RelativeDimList.Count - 1) @@ -1936,9 +1937,11 @@ namespace WebWindowConfigurator return; } } + // se aumenta dimensione else { double dRes = value; + // se non ultima anta if (nIndex < RelativeDimList.Count - 1) { for (var nInd = 0; nInd <= nIndex - 1; nInd++) @@ -1947,13 +1950,21 @@ namespace WebWindowConfigurator for (var Ind = nIndex + 1; Ind <= RelativeDimList.Count - 1; Ind++) RelativeDimList[Ind].SetDimension(dRes); } + // se ultima anta else if (RelativeDimList.Count > 1) { - for (var Ind = nIndex + 1; Ind <= RelativeDimList.Count - 1; Ind++) - dRes += RelativeDimList[Ind].dDimension; - dRes = (100 - dRes) / (nIndex - 1); - for (var nInd = 0; nInd <= nIndex - 1; nInd++) - RelativeDimList[nInd].SetDimension(dRes); + if (RelativeDimList.Count > 2) + { + for (var Ind = 0; Ind <= nIndex - 2; Ind++) + dRes += RelativeDimList[Ind].dDimension; + } + + //for (var Ind = nIndex + 1; Ind <= RelativeDimList.Count - 1; Ind++) + // dRes += RelativeDimList[Ind].dDimension; + dRes = (100 - dRes); + RelativeDimList[nIndex - 1].SetDimension(dRes); + //for (var nInd = 0; nInd <= nIndex - 1; nInd++) + // RelativeDimList[nInd].SetDimension(dRes); } else { @@ -2125,11 +2136,20 @@ namespace WebWindowConfigurator } else if (RelativeDimList.Count > 1) { - for (var Ind = nIndex + 1; Ind <= RelativeDimList.Count - 1; Ind++) - dRes += RelativeDimList[Ind].dDimension; - dRes = (100 - dRes) / (nIndex - 1); - for (var nInd = 0; nInd <= nIndex - 1; nInd++) - RelativeDimList[nInd].SetDimension(dRes); + if (RelativeDimList.Count > 2) + { + for (var Ind = 0; Ind <= nIndex - 2; Ind++) + dRes += RelativeDimList[Ind].dDimension; + } + dRes = (100 - dRes); + RelativeDimList[nIndex - 1].SetDimension(dRes); + //for (var nInd = 0; nInd <= nIndex - 1; nInd++) + // RelativeDimList[nInd].SetDimension(dRes); + //for (var Ind = nIndex + 1; Ind <= RelativeDimList.Count - 1; Ind++) + // dRes += RelativeDimList[Ind].dDimension; + //dRes = (100 - dRes) / (nIndex - 1); + //for (var nInd = 0; nInd <= nIndex - 1; nInd++) + // RelativeDimList[nInd].SetDimension(dRes); } else { diff --git a/WebWindowJWD/WebWindowJWDInput.razor.cs b/WebWindowJWD/WebWindowJWDInput.razor.cs index 6b1dc7b..37fced3 100644 --- a/WebWindowJWD/WebWindowJWDInput.razor.cs +++ b/WebWindowJWD/WebWindowJWDInput.razor.cs @@ -38,7 +38,10 @@ namespace WebWindowJWD m_SashList = new List(); m_SplitList = new List(); SearchInAreaList(m_CurrWindow.AreaList[0]); - EC_OnUpdate.InvokeAsync(m_CurrJwd); + Dictionary Args = new Dictionary(); + Args.Add("Jwd", m_CurrJwd); + Args.Add("Mode", 1.ToString()); + EC_OnUpdate.InvokeAsync(Args); } if (m_CurrWindow != null) { @@ -54,7 +57,7 @@ namespace WebWindowJWD public EventCallback EC_OnClose { get; set; } [Parameter] - public EventCallback EC_OnUpdate { get; set; } + public EventCallback> EC_OnUpdate { get; set; } public List FillList { @@ -87,9 +90,8 @@ namespace WebWindowJWD protected enum CompileStep { - Template = 0, - Frame = 1, - Split, + Frame = 0, + Split = 1, Sash, Fill } @@ -141,8 +143,14 @@ namespace WebWindowJWD protected async Task DoPreviewSvg() { - var CurrJwd = JsonConvert.SerializeObject(m_CurrWindow.Serialize(), Formatting.Indented); - await EC_OnUpdate.InvokeAsync(CurrJwd); + if(m_CurrWindow != null) + { + var CurrJwd = JsonConvert.SerializeObject(m_CurrWindow.Serialize(), Formatting.Indented); + Dictionary Args = new Dictionary(); + Args.Add("Jwd", CurrJwd); + Args.Add("Mode", 1.ToString()); + await EC_OnUpdate.InvokeAsync(Args); + } } protected async Task DoSave() @@ -223,13 +231,11 @@ namespace WebWindowJWD private void M_CurrWindow_OnPreview(object? sender, OnPreviewEventArgs e) { - EC_OnUpdate.InvokeAsync(e.sJwd); -#if false - var CurrJwd = JsonConvert.SerializeObject(m_CurrWindow.Serialize(), Formatting.Indented); - EC_OnUpdate.InvokeAsync(CurrJwd); -#endif + Dictionary Args = new Dictionary(); + Args.Add("Jwd", e.sJwd); + Args.Add("Mode", 1.ToString()); + EC_OnUpdate.InvokeAsync(Args); } - /// /// Calcola il css del tab selezionato ///