diff --git a/Test.UI.sln b/Test.UI.sln index d00bbdb..7fba70d 100644 --- a/Test.UI.sln +++ b/Test.UI.sln @@ -11,8 +11,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebWindowConfigurator", "We EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebAedificaConfigurator", "WebAedificaConfigurator\WebAedificaConfigurator.csproj", "{BD1F43E8-BE5F-469E-9552-C98CA8639A06}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebWindowJWD", "WebWindowJWD\WebWindowJWD.csproj", "{D32E55D6-8C37-477F-8065-4020EB27900E}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebWindowComplex", "WebWindowComplex\WebWindowComplex.csproj", "{4E197932-13B1-45FB-9EDD-694604644745}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebWindowTest", "WebWindowTest\WebWindowTest.csproj", "{C22770A7-C344-4CE9-8D6F-6ACE62091C31}" @@ -41,10 +39,6 @@ Global {BD1F43E8-BE5F-469E-9552-C98CA8639A06}.Debug|Any CPU.Build.0 = Debug|Any CPU {BD1F43E8-BE5F-469E-9552-C98CA8639A06}.Release|Any CPU.ActiveCfg = Release|Any CPU {BD1F43E8-BE5F-469E-9552-C98CA8639A06}.Release|Any CPU.Build.0 = Release|Any CPU - {D32E55D6-8C37-477F-8065-4020EB27900E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D32E55D6-8C37-477F-8065-4020EB27900E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D32E55D6-8C37-477F-8065-4020EB27900E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D32E55D6-8C37-477F-8065-4020EB27900E}.Release|Any CPU.Build.0 = Release|Any CPU {4E197932-13B1-45FB-9EDD-694604644745}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4E197932-13B1-45FB-9EDD-694604644745}.Debug|Any CPU.Build.0 = Debug|Any CPU {4E197932-13B1-45FB-9EDD-694604644745}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/Test.UI/Components/_Imports.razor b/Test.UI/Components/_Imports.razor index f1e6548..2d121d4 100644 --- a/Test.UI/Components/_Imports.razor +++ b/Test.UI/Components/_Imports.razor @@ -11,6 +11,5 @@ @using Test.UI.Components @using WebWindowConfigurator @using WebAedificaConfigurator -@using WebWindowJWD @using WebWindowComplex @using WebWindowTest \ No newline at end of file diff --git a/Test.UI/Test.UI.csproj b/Test.UI/Test.UI.csproj index 435a85f..e3221e7 100644 --- a/Test.UI/Test.UI.csproj +++ b/Test.UI/Test.UI.csproj @@ -34,7 +34,6 @@ - diff --git a/WebWindow.Base/WebWindow.Base.csproj b/WebWindow.Base/WebWindow.Base.csproj index 89df9d4..60c4fc2 100644 --- a/WebWindow.Base/WebWindow.Base.csproj +++ b/WebWindow.Base/WebWindow.Base.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.9.1913 + 2.7.9.2214 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -28,5 +28,13 @@ + + + + + + + + diff --git a/WebWindowComplex/TableComp.razor b/WebWindowComplex/TableComp.razor index 4dd794c..1dd914a 100644 --- a/WebWindowComplex/TableComp.razor +++ b/WebWindowComplex/TableComp.razor @@ -136,7 +136,7 @@ } else { - @fillTable(i, j) + @FillTable(i, j) } } @@ -195,19 +195,19 @@
Frame joints
- +
- +
- +
@foreach (Joint joint in FrameWindow.JointList) {
- + +
@@ -501,19 +501,19 @@
Sash joints
- +
- +
- +
@foreach (Joint joint in item.JointList) {
- + + - - - - -
- +
+
+ + +
diff --git a/WebWindowComplex/TableComp.razor.cs b/WebWindowComplex/TableComp.razor.cs index ad6fdca..22d230b 100644 --- a/WebWindowComplex/TableComp.razor.cs +++ b/WebWindowComplex/TableComp.razor.cs @@ -4,7 +4,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System.Reflection.Metadata; using System.Runtime.InteropServices; -using WebWindowComplex; +using WebWindow.Base; using WebWindowComplex.DTO; using WebWindowComplex.Json; using static WebWindowComplex.Json.WindowConst; @@ -33,25 +33,21 @@ namespace WebWindowComplex get => m_CurrJwd; set { + // Se viene passato un JWD if (m_CurrJwd != value && value != "") { m_CurrJwd = value; - SelFamilyHardware = IN_SelFamilyHardware; - SelColorMaterial = IN_SelColorMaterial ?? ""; - SelMaterial = IN_SelMaterial ?? ""; - SelGlass = IN_SelGlass ?? ""; + // Aggiornati parametri di ingresso selezionati + UpdateSelParameter(); JsonWindow WindowFromJson = JsonConvert.DeserializeObject(m_CurrJwd, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); if (m_CurrWindow != null) { m_CurrWindow.OnPreview -= M_CurrWindow_OnPreview; m_CurrWindow = null; } - Sash.m_HardwareCompleteList = IN_HardwareList; - Sash.s_FamilyHardwareList = IN_FamilyHardwareList; - Sash.s_SelFamilyHW = IN_SelFamilyHardware; m_CurrWindow = WindowFromJson.Deserialize(); m_CurrWindow.OnPreview += M_CurrWindow_OnPreview; - // recupero dimensioni Frame e Joint Frame della finestra precedente + // Recupero dimensioni Frame e Joint del frame della finestra precedente if (m_PreviousWindow != null) { for (int i = 0; i < 2; i++) @@ -62,16 +58,8 @@ namespace WebWindowComplex } if (m_CurrWindow != null) { - m_maxCol = 0; - m_maxRow = 0; - m_FillList = new List(); - m_SashList = new List(); - m_SplitList = new List(); - //m_SplitParentList = new List(); - m_SplittedList = new List(); - m_ItemTableList = new List(); - CreateWindowsList(m_CurrWindow.AreaList[0], false); - CreateElementTable(m_CurrWindow.AreaList[0], 1, 1, 1, 1); + // Aggiornate liste di sash, split, splitted, fill e itemTable + UpdateLists(); } } } @@ -82,26 +70,21 @@ namespace WebWindowComplex get => m_SelTemplate; set { - // Se non ho ancora selezionato template oppure se cambio template di selezione + // Se viene passato il template selezionato oppure se non è ancora stato selezionato un template oppure se si cambia template di selezione if (value != null && (m_SelTemplate == null || (m_SelTemplate != null && value.nIndex != m_SelTemplate.nIndex)) && !string.IsNullOrEmpty(value.JWD)) { m_SelTemplate = value; - SelFamilyHardware = IN_SelFamilyHardware; - SelColorMaterial = IN_SelColorMaterial ?? ""; - SelMaterial = IN_SelMaterial ?? ""; - SelGlass = IN_SelGlass ?? ""; + // Aggiornamento parametri di ingresso selezionati + UpdateSelParameter(); JsonWindow WindowFromJson = JsonConvert.DeserializeObject(m_SelTemplate.JWD, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); if (m_CurrWindow != null) { m_CurrWindow.OnPreview -= M_CurrWindow_OnPreview; m_CurrWindow = null; } - Sash.m_HardwareCompleteList = IN_HardwareList; - Sash.s_FamilyHardwareList = IN_FamilyHardwareList; - Sash.s_SelFamilyHW = IN_SelFamilyHardware; m_CurrWindow = WindowFromJson.Deserialize(); m_CurrWindow.OnPreview += M_CurrWindow_OnPreview; - // recupero dimensioni Frame e Joint Frame della finestra precedente + // Recupero dimensioni Frame e Joint del frame della finestra precedente if (m_PreviousWindow != null) { for (int i = 0; i < 2; i++) @@ -112,16 +95,8 @@ namespace WebWindowComplex } if (m_CurrWindow != null) { - m_maxCol = 0; - m_maxRow = 0; - m_FillList = new List(); - m_SashList = new List(); - m_SplitList = new List(); - //m_SplitParentList = new List(); - m_SplittedList = new List(); - m_ItemTableList = new List(); - CreateWindowsList(m_CurrWindow.AreaList[0], false); - CreateElementTable(m_CurrWindow.AreaList[0], 1, 1, 1, 1); + // Aggiornamento liste sash, split, splitted, fill e itemTable + UpdateLists(); } } } @@ -191,7 +166,7 @@ namespace WebWindowComplex General } - protected enum positionJoints + protected enum PositionJoints { BL = 0, // Bottom Left BR = 1, // Bottom Right @@ -205,10 +180,10 @@ namespace WebWindowComplex protected Frame FrameWindow { - get => m_Frame; + get => m_Frame!; set => m_Frame = value; } - protected string m_CurrJwd { get; set; } + protected string? m_CurrJwd { get; set; } protected string m_SelSVG { get; set; } = ""; /// @@ -240,17 +215,11 @@ namespace WebWindowComplex { get => m_SplittedList; } - //protected List SplitParentList - //{ - // get => m_SplitParentList; - //} protected List ItemTableList { get => m_ItemTableList; } - protected TemplateSelectDTO? SelTemplateDTO { get; set; } = null; - protected string SelFamilyHardware { get @@ -273,11 +242,11 @@ namespace WebWindowComplex } } } - protected string SelColorMaterial { get; set; } = null; + protected string SelColorMaterial { get; set; } = ""; - protected string SelMaterial { get; set; } = null; + protected string SelMaterial { get; set; } = ""!; - protected string SelGlass { get; set; } = null; + protected string SelGlass { get; set; } = ""; #endregion Protected Properties @@ -296,22 +265,60 @@ namespace WebWindowComplex await DoPreviewSvg(); } + /// + /// Metodo che resetta le liste (sash, split, splitted, fill e itemTable) e le crea nuovamente + /// + protected void UpdateLists() + { + m_maxCol = 0; + m_maxRow = 0; + m_FillList = new List(); + m_SashList = new List(); + m_SplitList = new List(); + m_SplittedList = new List(); + m_ItemTableList = new List(); + CreateWindowsList((m_CurrWindow!).AreaList[0], false); + CreateElementTable(m_CurrWindow.AreaList[0], 1, 1, 1, 1); + } + + /// + /// Metodo per settare i parmateri di ingresso selezionati + /// + protected void UpdateSelParameter() + { + SelFamilyHardware = IN_SelFamilyHardware; + SelColorMaterial = IN_SelColorMaterial ?? ""; + SelMaterial = IN_SelMaterial ?? ""; + SelGlass = IN_SelGlass ?? ""; + Sash.m_HardwareCompleteList = IN_HardwareList; + Sash.s_FamilyHardwareList = IN_FamilyHardwareList; + Sash.s_SelFamilyHW = IN_SelFamilyHardware; + } + /// /// Metodo per la scelta della maniglia univoca /// - /// + /// anta su cui si seleziona la maniglia /// - protected void changeHandle(SashDimension sashDim) + protected void changeHandle(SashDimension sashDim, Sash currSash) { - foreach (SashDimension item in SashList[0].SashList) + // Cerco la Sash che si sta considerando nella lista Sash + foreach (Sash s in SashList) { - if (item.Equals(sashDim)) + if (s.Equals(currSash)) { - item.bHasHandle = true; - } - else - { - item.bHasHandle = false; + // Per ogni anta della Sash setto bHasHandle + foreach (SashDimension item in s.SashList) + { + if (item.Equals(sashDim)) + { + item.bHasHandle = true; + } + else + { + item.bHasHandle = false; + } + } } } } @@ -332,8 +339,8 @@ namespace WebWindowComplex { var CurrJwd = JsonConvert.SerializeObject(m_CurrWindow.Serialize(), Formatting.Indented); Dictionary Args = new Dictionary(); + Args.Add("Mode", $"{(int)Enums.EngineQueryType.Preview}"); Args.Add("Jwd", CurrJwd); - Args.Add("Mode", 1.ToString()); await EC_OnUpdate.InvokeAsync(Args); } } @@ -343,15 +350,13 @@ namespace WebWindowComplex /// protected async Task DoReset() { - SelFamilyHardware = IN_SelFamilyHardware; - SelColorMaterial = IN_SelColorMaterial ?? ""; - SelMaterial = IN_SelMaterial ?? ""; - SelGlass = IN_SelGlass ?? ""; + // Aggiornati parametri di ingresso selezionati + UpdateSelParameter(); JsonWindow WindowFromJson; if (string.IsNullOrEmpty(CurrJwd)) WindowFromJson = JsonConvert.DeserializeObject(m_SelTemplate.JWD, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); else - WindowFromJson = JsonConvert.DeserializeObject(m_CurrJwd, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); + WindowFromJson = JsonConvert.DeserializeObject(m_CurrJwd!, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); if (m_CurrWindow != null) { m_CurrWindow.OnPreview -= M_CurrWindow_OnPreview; @@ -359,17 +364,8 @@ namespace WebWindowComplex } m_CurrWindow = WindowFromJson.Deserialize(); m_CurrWindow.OnPreview += M_CurrWindow_OnPreview; - m_FillList = new List(); - m_SashList = new List(); - m_SplitList = new List(); - m_SplittedList = new List(); - //m_SplitParentList = new List(); - m_ItemTableList = new List(); - m_maxCol = 0; - m_maxRow = 0; - // popolo le liste Fill, Sash e Split - CreateWindowsList(m_CurrWindow.AreaList[0], false); - CreateElementTable(m_CurrWindow.AreaList[0], 1, 1, 1, 1); + // Aggiorante liste sash, split, splitted, fill e itemTable + UpdateLists(); currSash = -1; await DoPreviewSvg(); } @@ -384,18 +380,17 @@ namespace WebWindowComplex /// /// Selezione del template /// - /// template selezionato + /// template selezionato protected async void DoSelect(TemplateSelectDTO newSel) { SelTemplateDTO = newSel; - //DoSelectAndPreview(CompileStep.Frame); await EC_OnSelectedTemplate.InvokeAsync(newSel); } /// /// Metodo per cambiare step e aggiornare preview svg /// - /// step successivo + /// step successivo protected async void NextStepAndPreview(CompileStep newStep, int Index = -1) { currStep = newStep; @@ -406,6 +401,11 @@ namespace WebWindowComplex await DoPreviewSvg(); } + /// + /// Metodo per riempire le liste Sash, Split, Splitted e Fill + /// + /// Area da classificare + /// Parametro per sapere se si è dentro un'anta protected void CreateWindowsList(Area node, bool IntoSash) { if (node != null) @@ -450,6 +450,14 @@ namespace WebWindowComplex } } + /// + /// Metodo per riempire la lista ItemTable in modo da poter rappresentarla come tabella + /// + /// Area da classificare + /// numero di riga + /// numero di colonna + /// numero di riga massimo + /// numero di colonna massimo protected void CreateElementTable(Area node, int row, int col, int maxRow, int maxCol) { if (node != null) @@ -559,7 +567,13 @@ namespace WebWindowComplex } } - private string fillTable(int row, int col) + /// + /// Metodo per riempire tabella con contenuto vuoto o con i simboli per rappresentare la struttura + /// + /// riga della cella + /// colonna della cella + /// + private string FillTable(int row, int col) { List itemSameCol = new List(); for (int k = 0; k < row; k++) @@ -606,7 +620,7 @@ namespace WebWindowComplex return "├"; } } - // Non solo alla riga successiva + // Non sono alla riga successiva else { // se ha un solo figlio @@ -641,20 +655,11 @@ namespace WebWindowComplex /// /// Metodo per settare tutti i Joints di Frame o Sash come ANGLED o FULL_H o FULL_V /// - /// tipo di giunzione (ANGLED o FULL_H o FULL_V) - /// area su cui eseguire la funzione (Frame o Sash) + /// tipo di giunzione (ANGLED o FULL_H o FULL_V) + /// area su cui eseguire la funzione (Frame o Sash) /// - private async Task AllJointsFrame(int n_type, Area area) + private async Task ChangeAllJoints(WindowConst.Joints type, Area area) { - Joints type = Joints.ANGLED; - if (n_type == 2) - { - type = Joints.FULL_H; - } - else if (n_type == 3) - { - type = Joints.FULL_V; - } if (area is Frame) { foreach (Joint joint in FrameWindow.JointList) @@ -664,8 +669,8 @@ namespace WebWindowComplex } else { - Sash s = (Sash)area; - foreach (Joint joint in s.JointList) + Sash a = (Sash)area; + foreach (Joint joint in a.JointList) { joint.SetSelJointType(type); } @@ -674,17 +679,12 @@ namespace WebWindowComplex } /// - /// Metodo per settare tutti i Joints di Frame o Sash come ANGLED o FULL_H o FULL_V + /// Metodo per settare tutti i Fill in contemporanea /// - /// tipo di riempimento (GLASS o WOOD) + /// tipo di riempimento (GLASS o WOOD) /// - private async Task AllFill(int n_type) + private async Task ChangeAllFill(WindowConst.FillTypes type) { - FillTypes type = FillTypes.GLASS; - if (n_type == 2) - { - type = FillTypes.WOOD; - } foreach (Fill currFill in m_FillList) { currFill.SetFillType(type); @@ -695,9 +695,9 @@ namespace WebWindowComplex /// /// Metodo per copiare contenuto di un'anta in un'altra anta /// - /// Sash dove si torva anta - /// Indice dell'anta che si copia - /// Indice dell'anta che si modifica + /// Sash corrispondente all'anta + /// Indice dell'anta che si copia + /// Indice dell'anta che si modifica private async Task CopyContentSash(Sash sashItem, int IndexCopy, int IndexModify) { // Anta selezionata @@ -712,10 +712,10 @@ namespace WebWindowComplex } /// - /// Metodo per copiare una sash intera + /// Metodo per copiare una Sash intera /// - /// - /// + /// Area Splitted corrente + /// Indice della Sash che si vuole copiare /// private async Task CopySash(Splitted currSplitted, int numSash) { @@ -729,6 +729,11 @@ namespace WebWindowComplex await DoPreviewSvg(); } + /// + /// Metodo per scambiare due aree di uno split + /// + /// Area corrente + /// private async Task SwapTwoAree(Area currArea) { currArea.SwapAree(); @@ -738,24 +743,15 @@ namespace WebWindowComplex #endregion Protected Methods #region Private Fields + private CompileStep currStep; - private int currSash = -1; - - private Frame m_Frame; - + private Frame? m_Frame; private List m_SashList = new List(); - private List m_SplitList = new List(); - private List m_FillList = new List(); - private List m_SplittedList = new List(); - private List m_ItemTableList = new List(); - - //private List m_SplitParentList = new List(); - private int m_maxCol = 0; private int m_maxRow = 0; @@ -764,11 +760,8 @@ namespace WebWindowComplex #region Private Properties private Window? m_CurrWindow { get; set; } = null; - private Window? m_PreviousWindow { get; set; } = null; - private Template m_SelTemplate { get; set; } = null!; - private string m_SelFamilyHardware { get; set; } = ""; #endregion Private Properties @@ -778,7 +771,7 @@ namespace WebWindowComplex /// /// Metodo per andare allo step successivo /// - /// step successivo + /// step successivo private void AdvStep(CompileStep newStep) { currStep = newStep; @@ -788,28 +781,24 @@ namespace WebWindowComplex private void M_CurrWindow_OnPreview(object? sender, OnPreviewEventArgs e) { Dictionary Args = new Dictionary(); + Args.Add("Mode", $"{(int)Enums.EngineQueryType.Preview}"); Args.Add("Jwd", e.sJwd); - Args.Add("Mode", 1.ToString()); EC_OnUpdate.InvokeAsync(Args); } /// /// Calcola il css del tab selezionato /// - /// + /// Step /// private string tabNavCss(CompileStep testStep, int Index = -1) { if (testStep == CompileStep.Sash) { if ((currSash == 0 && Index == 0) || (currSash == 1 && Index == 1)) - { return "nav-link active fw-bold"; - } else - { return "nav-link text-secondary"; - } } return (testStep == currStep) ? "nav-link active fw-bold" : "nav-link text-secondary"; } diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index 44782ad..f4c0b9a 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.9.1616 + 2.7.9.2214 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -37,6 +37,21 @@ + + + + + + + + + + + + + + + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index ba6c9d8..f67d3f2 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.9.1913 + 2.7.9.2214 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -56,6 +56,18 @@ + + + + + + + + + + + + diff --git a/WebWindowTest/Test.razor b/WebWindowTest/Test.razor index c4ed868..14efe05 100644 --- a/WebWindowTest/Test.razor +++ b/WebWindowTest/Test.razor @@ -136,7 +136,7 @@ } else { - @fillTable(i, j) + @FillTable(i, j) } } @@ -144,7 +144,7 @@ - + } else if (currStep == CompileStep.Frame) { @@ -195,19 +195,19 @@
Frame joints
- +
- +
- +
@foreach (Joint joint in FrameWindow.JointList) {
- + - - + + @@ -470,20 +470,20 @@
- +
-
+
@for (int k = 1; k <= i * 2 + j; k++) { int IndexCopy = k; int IndexModify = i * 2 + j; -
-
- +
+
+
} @@ -501,19 +501,19 @@
Sash joints
- +
- +
- +
@foreach (Joint joint in item.JointList) {
- + + - - - - -
- +
+
+ + +
diff --git a/WebWindowTest/Test.razor.cs b/WebWindowTest/Test.razor.cs index d7f5c51..533ee97 100644 --- a/WebWindowTest/Test.razor.cs +++ b/WebWindowTest/Test.razor.cs @@ -1,9 +1,11 @@ using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Web; +using Microsoft.Net.Http.Headers; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System.Reflection.Metadata; using System.Runtime.InteropServices; +using WebWindow.Base; using WebWindowTest.DTO; using WebWindowTest.Json; using static WebWindowTest.Json.WindowConst; @@ -32,25 +34,21 @@ namespace WebWindowTest get => m_CurrJwd; set { + // Se viene passato un JWD if (m_CurrJwd != value && value != "") { m_CurrJwd = value; - SelFamilyHardware = IN_SelFamilyHardware; - SelColorMaterial = IN_SelColorMaterial ?? ""; - SelMaterial = IN_SelMaterial ?? ""; - SelGlass = IN_SelGlass ?? ""; + // Aggiornati parametri di ingresso selezionati + UpdateSelParameter(); JsonWindow WindowFromJson = JsonConvert.DeserializeObject(m_CurrJwd, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); if (m_CurrWindow != null) { m_CurrWindow.OnPreview -= M_CurrWindow_OnPreview; m_CurrWindow = null; } - Sash.m_HardwareCompleteList = IN_HardwareList; - Sash.s_FamilyHardwareList = IN_FamilyHardwareList; - Sash.s_SelFamilyHW = IN_SelFamilyHardware; m_CurrWindow = WindowFromJson.Deserialize(); m_CurrWindow.OnPreview += M_CurrWindow_OnPreview; - // recupero dimensioni Frame e Joint Frame della finestra precedente + // Recupero dimensioni Frame e Joint del frame della finestra precedente if (m_PreviousWindow != null) { for (int i = 0; i < 2; i++) @@ -61,16 +59,8 @@ namespace WebWindowTest } if (m_CurrWindow != null) { - m_maxCol = 0; - m_maxRow = 0; - m_FillList = new List(); - m_SashList = new List(); - m_SplitList = new List(); - //m_SplitParentList = new List(); - m_SplittedList = new List(); - m_ItemTableList = new List(); - CreateWindowsList(m_CurrWindow.AreaList[0], false); - CreateElementTable(m_CurrWindow.AreaList[0], 1, 1, 1, 1); + // Aggiornate liste di sash, split, splitted, fill e itemTable + UpdateLists(); } } } @@ -81,26 +71,21 @@ namespace WebWindowTest get => m_SelTemplate; set { - // Se non ho ancora selezionato template oppure se cambio template di selezione + // Se viene passato il template selezionato oppure se non è ancora stato selezionato un template oppure se si cambia template di selezione if (value != null && (m_SelTemplate == null || (m_SelTemplate != null && value.nIndex != m_SelTemplate.nIndex)) && !string.IsNullOrEmpty(value.JWD)) { m_SelTemplate = value; - SelFamilyHardware = IN_SelFamilyHardware; - SelColorMaterial = IN_SelColorMaterial ?? ""; - SelMaterial = IN_SelMaterial ?? ""; - SelGlass = IN_SelGlass ?? ""; + // Aggiornamento parametri di ingresso selezionati + UpdateSelParameter(); JsonWindow WindowFromJson = JsonConvert.DeserializeObject(m_SelTemplate.JWD, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); if (m_CurrWindow != null) { m_CurrWindow.OnPreview -= M_CurrWindow_OnPreview; m_CurrWindow = null; } - Sash.m_HardwareCompleteList = IN_HardwareList; - Sash.s_FamilyHardwareList = IN_FamilyHardwareList; - Sash.s_SelFamilyHW = IN_SelFamilyHardware; m_CurrWindow = WindowFromJson.Deserialize(); m_CurrWindow.OnPreview += M_CurrWindow_OnPreview; - // recupero dimensioni Frame e Joint Frame della finestra precedente + // Recupero dimensioni Frame e Joint del frame della finestra precedente if (m_PreviousWindow != null) { for (int i = 0; i < 2; i++) @@ -111,16 +96,8 @@ namespace WebWindowTest } if (m_CurrWindow != null) { - m_maxCol = 0; - m_maxRow = 0; - m_FillList = new List(); - m_SashList = new List(); - m_SplitList = new List(); - //m_SplitParentList = new List(); - m_SplittedList = new List(); - m_ItemTableList = new List(); - CreateWindowsList(m_CurrWindow.AreaList[0], false); - CreateElementTable(m_CurrWindow.AreaList[0], 1, 1, 1, 1); + // Aggiornamento liste sash, split, splitted, fill e itemTable + UpdateLists(); } } } @@ -190,7 +167,7 @@ namespace WebWindowTest General } - protected enum positionJoints + protected enum PositionJoints { BL = 0, // Bottom Left BR = 1, // Bottom Right @@ -204,10 +181,10 @@ namespace WebWindowTest protected Frame FrameWindow { - get => m_Frame; + get => m_Frame!; set => m_Frame = value; } - protected string m_CurrJwd { get; set; } + protected string? m_CurrJwd { get; set; } protected string m_SelSVG { get; set; } = ""; /// @@ -239,17 +216,11 @@ namespace WebWindowTest { get => m_SplittedList; } - //protected List SplitParentList - //{ - // get => m_SplitParentList; - //} protected List ItemTableList { get => m_ItemTableList; } - protected TemplateSelectDTO? SelTemplateDTO { get; set; } = null; - protected string SelFamilyHardware { get @@ -272,11 +243,11 @@ namespace WebWindowTest } } } - protected string SelColorMaterial { get; set; } = null; + protected string SelColorMaterial { get; set; } = ""; - protected string SelMaterial { get; set; } = null; + protected string SelMaterial { get; set; } = ""!; - protected string SelGlass { get; set; } = null; + protected string SelGlass { get; set; } = ""; #endregion Protected Properties @@ -295,22 +266,74 @@ namespace WebWindowTest await DoPreviewSvg(); } + /// + /// Metodo che resetta le liste (sash, split, splitted, fill e itemTable) e le crea nuovamente + /// + protected void UpdateLists() + { + m_maxCol = 0; + m_maxRow = 0; + m_FillList = new List(); + m_SashList = new List(); + m_SplitList = new List(); + m_SplittedList = new List(); + m_ItemTableList = new List(); + CreateWindowsList((m_CurrWindow!).AreaList[0], false); + CreateElementTable(m_CurrWindow.AreaList[0], 1, 1, 1, 1); + } + + /// + /// Metodo per settare i parmateri di ingresso selezionati + /// + protected void UpdateSelParameter() + { + SelFamilyHardware = IN_SelFamilyHardware; + SelColorMaterial = IN_SelColorMaterial ?? ""; + SelMaterial = IN_SelMaterial ?? ""; + SelGlass = IN_SelGlass ?? ""; + Sash.m_HardwareCompleteList = IN_HardwareList; + Sash.s_FamilyHardwareList = IN_FamilyHardwareList; + Sash.s_SelFamilyHW = IN_SelFamilyHardware; + } + /// /// Metodo per la scelta della maniglia univoca /// - /// + /// anta su cui si seleziona la maniglia /// - protected void changeHandle(SashDimension sashDim) + protected void changeHandle(SashDimension sashDim, Sash currSash) { - foreach (SashDimension item in SashList[0].SashList) + // Cerco la Sash che si sta considerando nella lista Sash + foreach (Sash s in SashList) { - if (item.Equals(sashDim)) + if (s.Equals(currSash)) { - item.bHasHandle = true; - } - else - { - item.bHasHandle = false; + // Per ogni anta della Sash setto bHasHandle + foreach (SashDimension item in s.SashList) + { + if (item.Equals(sashDim)) + { + item.bHasHandle = true; + } + else + { + if (item.bHasHandle) + { + switch (item.SelOpeningType) + { + case Openings.TILTTURN_LEFT: + item.SetOpeningType(Openings.TURNONLY_LEFT); + break; + case Openings.TILTTURN_RIGHT: + item.SetOpeningType(Openings.TURNONLY_RIGHT); + break; + default: + break; + } + } + item.bHasHandle = false; + } + } } } } @@ -331,8 +354,8 @@ namespace WebWindowTest { var CurrJwd = JsonConvert.SerializeObject(m_CurrWindow.Serialize(), Formatting.Indented); Dictionary Args = new Dictionary(); + Args.Add("Mode", $"{(int)Enums.EngineQueryType.Preview}"); Args.Add("Jwd", CurrJwd); - Args.Add("Mode", 1.ToString()); await EC_OnUpdate.InvokeAsync(Args); } } @@ -342,15 +365,13 @@ namespace WebWindowTest /// protected async Task DoReset() { - SelFamilyHardware = IN_SelFamilyHardware; - SelColorMaterial = IN_SelColorMaterial ?? ""; - SelMaterial = IN_SelMaterial ?? ""; - SelGlass = IN_SelGlass ?? ""; + // Aggiornati parametri di ingresso selezionati + UpdateSelParameter(); JsonWindow WindowFromJson; if (string.IsNullOrEmpty(CurrJwd)) WindowFromJson = JsonConvert.DeserializeObject(m_SelTemplate.JWD, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); else - WindowFromJson = JsonConvert.DeserializeObject(m_CurrJwd, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); + WindowFromJson = JsonConvert.DeserializeObject(m_CurrJwd!, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); if (m_CurrWindow != null) { m_CurrWindow.OnPreview -= M_CurrWindow_OnPreview; @@ -358,17 +379,8 @@ namespace WebWindowTest } m_CurrWindow = WindowFromJson.Deserialize(); m_CurrWindow.OnPreview += M_CurrWindow_OnPreview; - m_FillList = new List(); - m_SashList = new List(); - m_SplitList = new List(); - m_SplittedList = new List(); - //m_SplitParentList = new List(); - m_ItemTableList = new List(); - m_maxCol = 0; - m_maxRow = 0; - // popolo le liste Fill, Sash e Split - CreateWindowsList(m_CurrWindow.AreaList[0], false); - CreateElementTable(m_CurrWindow.AreaList[0], 1, 1, 1, 1); + // Aggiorante liste sash, split, splitted, fill e itemTable + UpdateLists(); currSash = -1; await DoPreviewSvg(); } @@ -383,18 +395,17 @@ namespace WebWindowTest /// /// Selezione del template /// - /// template selezionato + /// template selezionato protected async void DoSelect(TemplateSelectDTO newSel) { SelTemplateDTO = newSel; - //DoSelectAndPreview(CompileStep.Frame); await EC_OnSelectedTemplate.InvokeAsync(newSel); } /// /// Metodo per cambiare step e aggiornare preview svg /// - /// step successivo + /// step successivo protected async void NextStepAndPreview(CompileStep newStep, int Index = -1) { currStep = newStep; @@ -405,6 +416,11 @@ namespace WebWindowTest await DoPreviewSvg(); } + /// + /// Metodo per riempire le liste Sash, Split, Splitted e Fill + /// + /// Area da classificare + /// Parametro per sapere se si è dentro un'anta protected void CreateWindowsList(Area node, bool IntoSash) { if (node != null) @@ -449,6 +465,14 @@ namespace WebWindowTest } } + /// + /// Metodo per riempire la lista ItemTable in modo da poter rappresentarla come tabella + /// + /// Area da classificare + /// numero di riga + /// numero di colonna + /// numero di riga massimo + /// numero di colonna massimo protected void CreateElementTable(Area node, int row, int col, int maxRow, int maxCol) { if (node != null) @@ -457,7 +481,7 @@ namespace WebWindowTest { case AreaTypes.FRAME: { - if(node.AreaList.Count >= 1) + if (node.AreaList.Count >= 1) ItemTableList.Add(new ItemTable(AreaTypes.FRAME, "FR", row, col, -1, node.AreaList.Count)); else ItemTableList.Add(new ItemTable(AreaTypes.FRAME, "FR", row, col, -1, 0)); @@ -473,12 +497,12 @@ namespace WebWindowTest if ((node.ParentArea.ParentArea != null && node.ParentArea.ParentArea.AreaList.Count > 1) || (node.ParentArea != null && node.ParentArea.AreaList.Count > 1)) { - for(int i = 0; i < SashList.Count; i++) + for (int i = 0; i < SashList.Count; i++) { if (SashList[i].Equals(node)) { // Se il nodo ha figli, salvo il numero nell'oggetto - if(node.AreaList.Count >= 1) + if (node.AreaList.Count >= 1) ItemTableList.Add(new ItemTable(AreaTypes.SASH, "SH", maxRow, col, i, node.AreaList.Count)); else ItemTableList.Add(new ItemTable(AreaTypes.SASH, "SH", maxRow, col, i, 0)); @@ -502,7 +526,7 @@ namespace WebWindowTest } case AreaTypes.FILL: { - if((node.ParentArea.AreaList.Count > 1 && node.ParentArea.AreaList[0].Equals(node)) || + if ((node.ParentArea.AreaList.Count > 1 && node.ParentArea.AreaList[0].Equals(node)) || (node.ParentArea.ParentArea != null && node.ParentArea.ParentArea.AreaList.Count > 1 && node.ParentArea.ParentArea.AreaList[0].AreaList[0].Equals(node))) maxCol++; ItemTableList.Add(new ItemTable(AreaTypes.FILL, "FL", maxRow, col, -1, 0)); @@ -516,7 +540,7 @@ namespace WebWindowTest if (node.ParentArea.AreaList.Count > 1 || (node.ParentArea.ParentArea != null && node.ParentArea.ParentArea.AreaList.Count > 1)) { if (node.ParentArea.AreaList[0].Equals(node) || node.ParentArea.ParentArea.AreaList[0].Equals(node)) - maxCol ++; + maxCol++; if (node.AreaList.Count >= 1 || node.AreaList.Count >= 1) ItemTableList.Add(new ItemTable(AreaTypes.SPLIT, "SP", maxRow, col, -1, node.AreaList.Count)); else @@ -548,7 +572,7 @@ namespace WebWindowTest CreateElementTable(item, row, col, maxRow, maxCol); } } - if(maxCol> m_maxCol) + if (maxCol > m_maxCol) { m_maxCol = maxCol; } @@ -557,13 +581,19 @@ namespace WebWindowTest m_maxRow = maxRow; } } - - private string fillTable(int row, int col) + + /// + /// Metodo per riempire tabella con contenuto vuoto o con i simboli per rappresentare la struttura + /// + /// riga della cella + /// colonna della cella + /// + private string FillTable(int row, int col) { List itemSameCol = new List(); - for(int k = 0; k < row; k++) + for (int k = 0; k < row; k++) { - if(ItemTableList[k].Col == col+1) + if (ItemTableList[k].Col == col + 1) { itemSameCol.Add(ItemTableList[k]); } @@ -589,10 +619,10 @@ namespace WebWindowTest if (itemSameCol.Count > 0) { // Sono alla riga successiva di un elemento e nella stessa colonna - if(itemSameCol.Last().Row == row) + if (itemSameCol.Last().Row == row) { // se ha un solo figlio - if(itemSameCol.Last().NumChild == 1) + if (itemSameCol.Last().NumChild == 1) { return "└"; } @@ -605,11 +635,11 @@ namespace WebWindowTest return "├"; } } - // Non solo alla riga successiva + // Non sono alla riga successiva else { // se ha un solo figlio - if(itemSameCol.Last().NumChild == 1) + if (itemSameCol.Last().NumChild == 1) { return " "; } @@ -640,21 +670,12 @@ namespace WebWindowTest /// /// Metodo per settare tutti i Joints di Frame o Sash come ANGLED o FULL_H o FULL_V /// - /// tipo di giunzione (ANGLED o FULL_H o FULL_V) - /// area su cui eseguire la funzione (Frame o Sash) + /// tipo di giunzione (ANGLED o FULL_H o FULL_V) + /// area su cui eseguire la funzione (Frame o Sash) /// - private async Task AllJointsFrame(int n_type, Area area) + private async Task ChangeAllJoints(WindowConst.Joints type, Area area) { - Joints type = Joints.ANGLED; - if (n_type == 2) - { - type = Joints.FULL_H; - } - else if (n_type == 3) - { - type = Joints.FULL_V; - } - if(area is Frame) + if (area is Frame) { foreach (Joint joint in FrameWindow.JointList) { @@ -663,8 +684,8 @@ namespace WebWindowTest } else { - Sash s = (Sash)area; - foreach (Joint joint in s.JointList) + Sash a = (Sash)area; + foreach (Joint joint in a.JointList) { joint.SetSelJointType(type); } @@ -673,17 +694,12 @@ namespace WebWindowTest } /// - /// Metodo per settare tutti i Joints di Frame o Sash come ANGLED o FULL_H o FULL_V + /// Metodo per settare tutti i Fill in contemporanea /// - /// tipo di riempimento (GLASS o WOOD) + /// tipo di riempimento (GLASS o WOOD) /// - private async Task AllFill(int n_type) + private async Task ChangeAllFill(WindowConst.FillTypes type) { - FillTypes type = FillTypes.GLASS; - if (n_type == 2) - { - type = FillTypes.WOOD; - } foreach (Fill currFill in m_FillList) { currFill.SetFillType(type); @@ -694,9 +710,9 @@ namespace WebWindowTest /// /// Metodo per copiare contenuto di un'anta in un'altra anta /// - /// Sash dove si torva anta - /// Indice dell'anta che si copia - /// Indice dell'anta che si modifica + /// Sash corrispondente all'anta + /// Indice dell'anta che si copia + /// Indice dell'anta che si modifica private async Task CopyContentSash(Sash sashItem, int IndexCopy, int IndexModify) { // Anta selezionata @@ -704,17 +720,17 @@ namespace WebWindowTest // Rimuovo riempimento da anta selezionata sashSplitted.AreaList.RemoveAt(0); // Creo la copia dell'anta scelta - Area a = sashItem.AreaList[IndexCopy-1].AreaList[0].Copy(sashSplitted); + Area a = sashItem.AreaList[IndexCopy - 1].AreaList[0].Copy(sashSplitted); // Aggiungo copia all'anta selezionata sashItem.AreaList[IndexModify].AreaList.Add(a); await DoPreviewSvg(); } /// - /// Metodo per copiare una sash intera + /// Metodo per copiare una Sash intera /// - /// - /// + /// Area Splitted corrente + /// Indice della Sash che si vuole copiare /// private async Task CopySash(Splitted currSplitted, int numSash) { @@ -728,6 +744,11 @@ namespace WebWindowTest await DoPreviewSvg(); } + /// + /// Metodo per scambiare due aree di uno split + /// + /// Area corrente + /// private async Task SwapTwoAree(Area currArea) { currArea.SwapAree(); @@ -737,24 +758,15 @@ namespace WebWindowTest #endregion Protected Methods #region Private Fields + private CompileStep currStep; - private int currSash = -1; - - private Frame m_Frame; - + private Frame? m_Frame; private List m_SashList = new List(); - private List m_SplitList = new List(); - private List m_FillList = new List(); - private List m_SplittedList = new List(); - private List m_ItemTableList = new List(); - - //private List m_SplitParentList = new List(); - private int m_maxCol = 0; private int m_maxRow = 0; @@ -763,11 +775,8 @@ namespace WebWindowTest #region Private Properties private Window? m_CurrWindow { get; set; } = null; - private Window? m_PreviousWindow { get; set; } = null; - private Template m_SelTemplate { get; set; } = null!; - private string m_SelFamilyHardware { get; set; } = ""; #endregion Private Properties @@ -777,7 +786,7 @@ namespace WebWindowTest /// /// Metodo per andare allo step successivo /// - /// step successivo + /// step successivo private void AdvStep(CompileStep newStep) { currStep = newStep; @@ -787,28 +796,24 @@ namespace WebWindowTest private void M_CurrWindow_OnPreview(object? sender, OnPreviewEventArgs e) { Dictionary Args = new Dictionary(); + Args.Add("Mode", $"{(int)Enums.EngineQueryType.Preview}"); Args.Add("Jwd", e.sJwd); - Args.Add("Mode", 1.ToString()); EC_OnUpdate.InvokeAsync(Args); } /// /// Calcola il css del tab selezionato /// - /// + /// Step /// private string tabNavCss(CompileStep testStep, int Index = -1) { if (testStep == CompileStep.Sash) { if ((currSash == 0 && Index == 0) || (currSash == 1 && Index == 1)) - { return "nav-link active fw-bold"; - } else - { return "nav-link text-secondary"; - } } return (testStep == currStep) ? "nav-link active fw-bold" : "nav-link text-secondary"; } diff --git a/WebWindowTest/WebWindowTest.csproj b/WebWindowTest/WebWindowTest.csproj index 8b86ea8..b72783d 100644 --- a/WebWindowTest/WebWindowTest.csproj +++ b/WebWindowTest/WebWindowTest.csproj @@ -18,4 +18,8 @@ + + + + diff --git a/WebWindowTest/Window.cs b/WebWindowTest/Window.cs index 9b99a1b..6cb84c9 100644 --- a/WebWindowTest/Window.cs +++ b/WebWindowTest/Window.cs @@ -96,7 +96,6 @@ namespace WebWindowTest internal string sSerialized() { return JsonConvert.SerializeObject(Serialize(), Formatting.Indented); - } internal void OnUpdatePreview(string sJwd) @@ -2299,13 +2298,13 @@ namespace WebWindowTest case Openings.TILTTURN_LEFT: { - SetOpeningType(Openings.TILTTURN_RIGHT); + SetOpeningType(Openings.TURNONLY_RIGHT); break; } case Openings.TILTTURN_RIGHT: { - SetOpeningType(Openings.TILTTURN_LEFT); + SetOpeningType(Openings.TURNONLY_LEFT); break; }