diff --git a/WebWindowComplex/Compo/AreaHwOption.razor b/WebWindowComplex/Compo/AreaHwOption.razor index 7eb168f..ab8235d 100644 --- a/WebWindowComplex/Compo/AreaHwOption.razor +++ b/WebWindowComplex/Compo/AreaHwOption.razor @@ -1,32 +1,33 @@ @using static WebWindowComplex.Json.WindowConst -@if (CurrSash.HwOptionList.Count > 0) -{ -
-
-
-
-
Hardware option
-
-
- @foreach (var currOpt in CurrSash.HwOptionList) - { - switch (currOpt.Type) - { - case HwOptionTypes.COMBO: - { - AGBOptionCombo currOptCombo = (AGBOptionCombo)currOpt; - - break; - } - case HwOptionTypes.TEXT: - { - AGBOptionText currOptText = (AGBOptionText)currOpt; - - break; - } - } - } -
+
+
+
Hardware option
-} \ No newline at end of file +
+ +
+
+
+ @if (!hwOptCollapsed) + { + @foreach (var currOpt in CurrSash.HwOptionList) + { + switch (currOpt.Type) + { + case HwOptionTypes.COMBO: + { + AGBOptionCombo currOptCombo = (AGBOptionCombo)currOpt; + + break; + } + case HwOptionTypes.TEXT: + { + AGBOptionText currOptText = (AGBOptionText)currOpt; + + break; + } + } + } + } +
\ No newline at end of file diff --git a/WebWindowComplex/Compo/AreaHwOption.razor.cs b/WebWindowComplex/Compo/AreaHwOption.razor.cs index ba75421..8262460 100644 --- a/WebWindowComplex/Compo/AreaHwOption.razor.cs +++ b/WebWindowComplex/Compo/AreaHwOption.razor.cs @@ -1,5 +1,6 @@ using Microsoft.AspNetCore.Components; using System.Runtime.CompilerServices; +using System.Threading.Tasks; using WebWindowComplex.Models; using static WebWindowComplex.Json.WindowConst; @@ -25,6 +26,23 @@ namespace WebWindowComplex.Compo [Parameter] public EventCallback EC_UpdateHwOptText { get; set; } + /// + /// Evento per chiamare la prima volta la lista delle opzioni + /// + [Parameter] + public EventCallback EC_FirstHwOptionList { get; set; } + + private bool hwOptCollapsed = true; + + private async Task changeCollapsed() + { + hwOptCollapsed = !hwOptCollapsed; + if(CurrSash.HwOptionList.Count == 0) + { + await EC_FirstHwOptionList.InvokeAsync(CurrSash.GroupId); + } + } + /// /// Report aggiornamento Option Combo /// diff --git a/WebWindowComplex/Compo/AreaSash.razor b/WebWindowComplex/Compo/AreaSash.razor index 8f50168..ed32baf 100644 --- a/WebWindowComplex/Compo/AreaSash.razor +++ b/WebWindowComplex/Compo/AreaSash.razor @@ -5,7 +5,11 @@
diff --git a/WebWindowComplex/Compo/CardFrame.razor b/WebWindowComplex/Compo/CardFrame.razor index a01154e..61f1efe 100644 --- a/WebWindowComplex/Compo/CardFrame.razor +++ b/WebWindowComplex/Compo/CardFrame.razor @@ -17,14 +17,18 @@
@@ -103,5 +107,10 @@ @if (!(FrameWindow.AreaList[0] is Split) || (SashList.Count == 0 && SplitList.Count == 0)) { - + + } diff --git a/WebWindowComplex/Compo/CardFrame.razor.cs b/WebWindowComplex/Compo/CardFrame.razor.cs index df31459..efacc89 100644 --- a/WebWindowComplex/Compo/CardFrame.razor.cs +++ b/WebWindowComplex/Compo/CardFrame.razor.cs @@ -71,7 +71,7 @@ namespace WebWindowComplex.Compo /// private async Task AddSash() { - await EC_UpdateShape.InvokeAsync(FrameWindow); + //await EC_UpdateShape.InvokeAsync(FrameWindow); await EC_AddSash.InvokeAsync(true); } @@ -130,6 +130,8 @@ namespace WebWindowComplex.Compo { if (FrameWindow.SelShapeIndex != value) { + //foreach(var s in SashList) + // s.SelHardwareFromId = "000000"; FrameWindow.SelShapeIndex = value; _ = EC_UpdateShape.InvokeAsync(FrameWindow); } diff --git a/WebWindowComplex/Compo/CardSashGroup.razor b/WebWindowComplex/Compo/CardSashGroup.razor index 3384dc4..8ced13c 100644 --- a/WebWindowComplex/Compo/CardSashGroup.razor +++ b/WebWindowComplex/Compo/CardSashGroup.razor @@ -46,32 +46,6 @@
-
-
Joints
-
-
-
- -
-
-
-
- -
-
-
-
- -
-
-
- @foreach (Joint joint in CurrItem.JointList) - { - - } -
-
-
Hardware
@@ -97,7 +71,7 @@
} @@ -105,7 +79,7 @@ {
- @foreach (var hlItem in CurrItem.HardwareList) { @@ -113,40 +87,40 @@ }
+ + + } +
+
+
+
+
Joints
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+ @foreach (Joint joint in CurrItem.JointList) + { + }
- - @*
-
-
-
-
Hardware option
-
-
- @if (CurrItem.HwOptionList.Count > 0) - { - @foreach (var currOpt in CurrItem.HwOptionList) - { - switch (currOpt.Type) - { - case HwOptionTypes.COMBO: - { - AGBOptionCombo currOptCombo = (AGBOptionCombo)currOpt; - - break; - } - case HwOptionTypes.TEXT: - { - AGBOptionText currOptText = (AGBOptionText)currOpt; - - break; - } - } - } - } -
-
*@
@@ -155,7 +129,12 @@
@for (int i = 0; i < CurrItem.SashList.Count; i++) { - + + }
diff --git a/WebWindowComplex/Compo/CardSashGroup.razor.cs b/WebWindowComplex/Compo/CardSashGroup.razor.cs index b9c3517..833bab4 100644 --- a/WebWindowComplex/Compo/CardSashGroup.razor.cs +++ b/WebWindowComplex/Compo/CardSashGroup.razor.cs @@ -62,6 +62,12 @@ namespace WebWindowComplex.Compo [Parameter] public EventCallback EC_UpdateSashHardware { get; set; } + /// + /// Evento per richiedere la prima volta le opzioni hardware + /// + [Parameter] + public EventCallback EC_CallFirstHwOpt { get; set; } + /// /// Lista di sash /// @@ -199,6 +205,16 @@ namespace WebWindowComplex.Compo } } + /// + /// Prima chiamata hw option list + /// + /// + /// + private async Task FirstHwOptionList(int groupId) + { + await EC_CallFirstHwOpt.InvokeAsync(groupId); + } + #endregion Private Methods } } \ No newline at end of file diff --git a/WebWindowComplex/Compo/CardSplit.razor b/WebWindowComplex/Compo/CardSplit.razor index 55b2a7e..bead55d 100644 --- a/WebWindowComplex/Compo/CardSplit.razor +++ b/WebWindowComplex/Compo/CardSplit.razor @@ -34,10 +34,14 @@
diff --git a/WebWindowComplex/Compo/CardTree.razor b/WebWindowComplex/Compo/CardTree.razor index 214df6d..9e7c659 100644 --- a/WebWindowComplex/Compo/CardTree.razor +++ b/WebWindowComplex/Compo/CardTree.razor @@ -9,29 +9,34 @@ { CompileStep cs = CompileStep.Frame; int ind = -1; + string s = "Vai a step "; @if (j + 1 == ItemTableList[i].Col) { @if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.FRAME) { cs = CompileStep.Frame; + s = s + cs.ToString(); } else if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.SPLIT) { cs = CompileStep.Split; ind = ItemTableList[i].IndexItem; + s = s + cs.ToString() + ((ind + 1) > 0 ? (ind + 1): ""); } else if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.SASH) { cs = CompileStep.Sash; ind = ItemTableList[i].IndexItem; + s = s + cs.ToString() + ((ind + 1) > 0 ? (ind + 1) : ""); } else if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.FILL) { cs = CompileStep.Fill; ind = ItemTableList[i].IndexItem; + s = s + cs.ToString() + ((ind + 1) > 0 ? (ind + 1) : ""); } - + } else diff --git a/WebWindowComplex/Models/Frame.cs b/WebWindowComplex/Models/Frame.cs index 7ec1e72..4ef5eb4 100644 --- a/WebWindowComplex/Models/Frame.cs +++ b/WebWindowComplex/Models/Frame.cs @@ -79,11 +79,13 @@ namespace WebWindowComplex.Models { get { - return IdNameStruct.IndFromId((int)m_Shape, m_ShapeList); + //return IdNameStruct.IndFromId((int)m_Shape, m_ShapeList); + return (int)m_Shape; } set { - Shapes SelShape = (Shapes)IdNameStruct.IdFromInd(value, m_ShapeList); + //Shapes SelShape = (Shapes)IdNameStruct.IdFromInd(value, m_ShapeList); + Shapes SelShape = (Shapes)value; if (m_Shape != SelShape) { // salvo vecchie dimensioni @@ -194,7 +196,7 @@ namespace WebWindowComplex.Models } m_Shape = SelShape; } - m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); + //m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); } } diff --git a/WebWindowComplex/Models/Sash.cs b/WebWindowComplex/Models/Sash.cs index c96580d..85ce272 100644 --- a/WebWindowComplex/Models/Sash.cs +++ b/WebWindowComplex/Models/Sash.cs @@ -229,14 +229,7 @@ namespace WebWindowComplex.Models } } } - // arriva come terzo evento refresh!!! -#if false - // calcolo senza hw - m_ParentWindow.OnUpdatePreview(JsonConvert.SerializeObject(m_ParentWindow.Serialize(true))); -#endif - m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized(true)); - // continuo refresh - //ReqRefreshShape(); + //m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized(true)); RefreshHardwareList(); RefreshHardwareOptionList(); SetFirstHardware(); @@ -355,9 +348,9 @@ namespace WebWindowComplex.Models } set { - m_SelHardware = m_HardwareList.FirstOrDefault(x => !string.IsNullOrEmpty(value) && x.Id.Equals(value)) ?? new Hardware("", "", "", Enums.OpeningTypes.Null, "", 0, 0); - ReqRefreshHwOption(); - ParentWindow.OnUpdatePreview(ParentWindow.sSerialized()); + m_SelHardware = m_HardwareList.FirstOrDefault(x => !string.IsNullOrEmpty(value) && x.Id.Equals(value)) ?? new Hardware(CustomHwId, "", "", Enums.OpeningTypes.Null, "", 0, 0); + //ReqRefreshHwOption(); + //ParentWindow.OnUpdatePreview(ParentWindow.sSerialized()); } } @@ -415,10 +408,10 @@ namespace WebWindowComplex.Models newSash.SetIsSashVertical(bIsSashVertical); newSash.SetOrientationSashType(OrientationSashType); newSash.SetSashBottomRailQty(SashBottomRailQty); - newSash.SetSelFamilyHardwareFromIndex(SelHardware.Id); + newSash.SetSelFamilyHardwareFromIndex(m_SelHardware.Id); newSash.ReqRefreshShape(); newSash.RefreshHardwareOptionList(); - newSash.SetSelHardware(SelHardware); + newSash.SetSelHardware(m_SelHardware); for (int i = 0; i < SashList.Count; i++) { //Cancello SashDimension di default e aggiungo la copia @@ -694,7 +687,7 @@ namespace WebWindowComplex.Models if (m_HardwareList.Count > 0) { m_SelHardware = m_HardwareList.First(); - ReqRefreshHwOption(); + //ReqRefreshHwOption(); } } diff --git a/WebWindowComplex/Models/SashDimension.cs b/WebWindowComplex/Models/SashDimension.cs index 3fbd106..7703010 100644 --- a/WebWindowComplex/Models/SashDimension.cs +++ b/WebWindowComplex/Models/SashDimension.cs @@ -106,7 +106,7 @@ namespace WebWindowComplex.Models set { m_bHasHandle = value; - m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); + //m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); } } @@ -239,15 +239,23 @@ namespace WebWindowComplex.Models { get { - return IdNameStruct.IndFromId((int)m_SelOpeningType, m_OpeningTypeList); + //return IdNameStruct.IndFromId((int)m_SelOpeningType, m_OpeningTypeList); + return (int)m_SelOpeningType; } set { - m_SelOpeningType = (Openings)IdNameStruct.IdFromInd(value, m_OpeningTypeList); - m_Parent.ReqRefreshShape(); - m_Parent.RefreshHardwareOptionList(); - m_Parent.SetFirstHardware(); - m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); + //Openings newOpening = (Openings)IdNameStruct.IdFromInd(value, m_OpeningTypeList); + Openings newOpening = (Openings)value; + if ((newOpening != Openings.TILTTURN_LEFT && newOpening != Openings.TILTTURN_RIGHT) || + (newOpening == Openings.TILTTURN_LEFT && m_bHasHandle) || + (newOpening == Openings.TILTTURN_RIGHT && m_bHasHandle)) + { + m_SelOpeningType = newOpening; + m_Parent.ReqRefreshShape(); + m_Parent.RefreshHardwareOptionList(); + m_Parent.SetFirstHardware(); + m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); + } } } diff --git a/WebWindowComplex/Models/Split.cs b/WebWindowComplex/Models/Split.cs index d0b49b6..885e9b8 100644 --- a/WebWindowComplex/Models/Split.cs +++ b/WebWindowComplex/Models/Split.cs @@ -222,11 +222,13 @@ namespace WebWindowComplex.Models { get { - return IdNameStruct.IndFromId((int)m_SelSplitShape, m_SplitShapeList); + //return IdNameStruct.IndFromId((int)m_SelSplitShape, m_SplitShapeList); + return (int)m_SelSplitShape; } set { - m_SelSplitShape = (SplitShapes)IdNameStruct.IdFromInd(value, m_SplitShapeList); + //m_SelSplitShape = (SplitShapes)IdNameStruct.IdFromInd(value, m_SplitShapeList); + m_SelSplitShape = (SplitShapes)value; // Cancello elementi nello split e azzero quantità orizzontale e verticale AreaList.Clear(); SetSplitQtyVert(0); diff --git a/WebWindowComplex/TableComp.razor b/WebWindowComplex/TableComp.razor index 37e7422..c63c04a 100644 --- a/WebWindowComplex/TableComp.razor +++ b/WebWindowComplex/TableComp.razor @@ -174,6 +174,7 @@ EC_RemoveArea="RemoveArea" EC_UpdateSash="UpdateSash" EC_UpdateSashHardware="UpdateHwOptions" + EC_CallFirstHwOpt="CallFirstHwOpt" EC_ReqClose="ReturnTree"> } diff --git a/WebWindowComplex/TableComp.razor.cs b/WebWindowComplex/TableComp.razor.cs index 4697947..e244d2c 100644 --- a/WebWindowComplex/TableComp.razor.cs +++ b/WebWindowComplex/TableComp.razor.cs @@ -187,7 +187,7 @@ namespace WebWindowComplex { if (s.Equals(currSash)) { - // Per ogni anta della Sash setto bHasHandle + // Per ogni anta della Sash setto HasHandle foreach (SashDimension item in s.SashList) { if (item.Equals(sashDim)) @@ -201,15 +201,19 @@ namespace WebWindowComplex switch (item.SelOpeningType) { case Openings.TILTTURN_LEFT: - item.SetOpeningType(Openings.TURNONLY_LEFT); - break; - + { + item.SetOpeningType(Openings.TURNONLY_LEFT); + break; + } case Openings.TILTTURN_RIGHT: - item.SetOpeningType(Openings.TURNONLY_RIGHT); - break; - + { + item.SetOpeningType(Openings.TURNONLY_RIGHT); + break; + } default: - break; + { + break; + } } } item.bHasHandle = false; @@ -217,6 +221,9 @@ namespace WebWindowComplex } } } + currSash.RefreshHardwareList(); + currSash.SetFirstHardware(); + _ = DoPreviewSvg(); } /// @@ -485,7 +492,7 @@ namespace WebWindowComplex /// /// Lista degli ID numerici dei gruppi da valutare /// - protected async Task DoReqOptHardware(List groupIdList) + protected async Task DoReqOptHardware(List groupIdList, bool isFirst = false) { if (m_CurrWindow != null) { @@ -495,7 +502,7 @@ namespace WebWindowComplex var CurrJwd = JsonConvert.SerializeObject(m_CurrWindow.Serialize()); #endif // verifico variazione JWD - if (!prevJwd.Equals(CurrJwd)) + if (!prevJwd.Equals(CurrJwd) || isFirst) { prevJwd = CurrJwd; Dictionary Args = new Dictionary(); @@ -636,69 +643,6 @@ namespace WebWindowComplex } } checkWarnings(); -#if false - // controllo sia popolato anche per la componente LIVE - if (LiveData.IsValid()) - { - // SOLO SE modificato live data... - if (prevLiveData == null || !prevLiveData.Equals(LiveData)) - { - prevLiveData = new LivePayload() - { - CurrJwd = LiveData.CurrJwd, - OptionsXml = LiveData.OptionsXml, - DictShape = LiveData.DictShape, - SvgPreview = LiveData.SvgPreview - }; - m_SelSVG = LiveData.SvgPreview; - // Aggiornati parametri di ingresso selezionati - UpdateSelParameter(); - JsonWindow WindowFromJson = new JsonWindow("", "", "", ""); - // provo a deserializzare - try - { - WindowFromJson = JsonConvert.DeserializeObject(LiveData.CurrJwd, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); - setCurrWindow(WindowFromJson); - //SOLO SE non sono in edit... - if (!editLock) - { - currStep = CompileStep.Tree; - } - } - // altrimenti errore! - catch (Exception ex) - { - listErrLink.Add("Window", $"Deserializing Error:{Environment.NewLine}{ex}"); - } - updateSvg = true; - } - checkWarnings(); - } - else if (CurrSelection != null && CurrSelection.Template != null) - { - // Se viene passato il template selezionato oppure se non è ancora stato selezionato un template oppure se si cambia template di selezione - if (m_SelTemplate == null || (m_SelTemplate != null && CurrSelection.Template.nIndex != m_SelTemplate.nIndex) && !string.IsNullOrEmpty(CurrSelection.Template.JWD)) - { - m_SelTemplate = CurrSelection.Template; - // Aggiornamento parametri di ingresso selezionati - UpdateSelParameter(); - JsonWindow WindowFromJson = new JsonWindow("", "", "", ""); - // provo a deserializzare - try - { - WindowFromJson = JsonConvert.DeserializeObject(m_SelTemplate.JWD, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); - setCurrWindow(WindowFromJson); - currStep = CompileStep.Template; - } - // altrimenti errore! - catch (Exception ex) - { - listErrLink.Add("Window", $"Deserializing Error:{Environment.NewLine}{ex}"); - } - } - updateSvg = true; - } -#endif if (SashList.Count > 0) { currAnta = 0; @@ -721,21 +665,21 @@ namespace WebWindowComplex 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); - } - } + //// 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 @@ -1249,6 +1193,7 @@ namespace WebWindowComplex /// private void RemoveArea(Area currArea) { + //LiveData.DictShape.Clear(); if (currArea is Split) ((Split)currArea).Remove(); else if (currArea is Sash) @@ -1382,6 +1327,18 @@ namespace WebWindowComplex await DoReqOptHardware(reqList); } + /// + /// Prima chiamata alle opzioni hardware + /// + /// Group Id del sash group di cui si vuole Hw option + /// + private async Task CallFirstHwOpt(int groupId) + { + bool isFirst = true; + List reqList = new List() { groupId }; + await DoReqOptHardware(reqList, isFirst); + } + /// /// Aggiornamento Sash e Frame /// @@ -1400,16 +1357,11 @@ namespace WebWindowComplex /// private async Task UpdateShape(Frame newFrame) { + //LiveData.DictShape.Clear(); FrameWindow = newFrame; // ciclo x ogni group della mia frame List reqList = SashList.Select(x => x.GroupId).ToList(); await DoReqShape(reqList); -#if false - foreach (var item in SashList) - { - await DoReqShape(item.GroupId); - } -#endif } /// diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index 9e0959b..0aa7741 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.10.3114 + 2.7.11.315 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -242,6 +242,14 @@ + + + + + + + + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index f4c5bb5..4b25143 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.10.3114 + 2.7.11.315 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -343,6 +343,20 @@ + + + + + + + + + + + + + +