From 5a7987d02b7cde05396b566495c61d3001b73f9e Mon Sep 17 00:00:00 2001 From: Annamaria Sassi Date: Mon, 1 Dec 2025 08:55:18 +0100 Subject: [PATCH] Aggiornate chiamate eventi --- WebWindowComplex/Compo/AreaSash.razor | 220 +---------- WebWindowComplex/Compo/AreaSash.razor.cs | 48 +++ WebWindowComplex/Compo/CardFrame.razor.cs | 4 +- WebWindowComplex/Compo/CardSashGroup.razor | 2 +- WebWindowComplex/Compo/CardSashGroup.razor.cs | 134 ++++--- WebWindowComplex/Compo/CardSplit.razor.cs | 17 +- WebWindowComplex/Compo/General.razor.cs | 43 ++- WebWindowComplex/Json/JsonUtility.cs | 6 +- WebWindowComplex/Models/Joint.cs | 1 - WebWindowComplex/Models/Sash.cs | 96 +++-- WebWindowComplex/Models/SashDimension.cs | 11 +- WebWindowComplex/Models/Split.cs | 2 +- WebWindowComplex/Models/SplitDimension.cs | 4 +- WebWindowComplex/Models/Window.cs | 24 +- WebWindowComplex/TableComp.razor | 14 +- WebWindowComplex/TableComp.razor.cs | 352 +++++------------- WebWindowComplex/WebWindowComplex.csproj | 17 +- .../WebWindowConfigurator.csproj | 20 +- 18 files changed, 387 insertions(+), 628 deletions(-) diff --git a/WebWindowComplex/Compo/AreaSash.razor b/WebWindowComplex/Compo/AreaSash.razor index 5961b19..5e91ec6 100644 --- a/WebWindowComplex/Compo/AreaSash.razor +++ b/WebWindowComplex/Compo/AreaSash.razor @@ -28,7 +28,7 @@
- @foreach (var openingType in CurrSashDim.OpeningTypeList) { @@ -37,9 +37,9 @@
Dimension - + @* *@ - @foreach (var mType in CurrSashDim.MeasureTypeList) {
- @* -
-
-
-
Joints
-
-
- -
-
- - @if (!JointCollapsed) - { -
-
-
- -
-
-
-
- -
-
-
-
- -
-
-
- } - @if (!JointCollapsed) - { - @foreach (Joint joint in CurrSashDim.JointList) - { - - } - } -
- - @if (!(CurrAnta.AreaList[0] is Split)) - { -
-
-
- -
-
-
-
- -
-
-
- } -
- @for (int k = 0; k <= CurrSashGroup.SashList.Count - 1; k++) - { - @if (k != IndexSash) - { - int IndexCopy = k; - int IndexModify = IndexSash; -
-
- -
-
- } - } -
*@ } else @@ -165,7 +95,7 @@ else
- @foreach (var openingType in CurrSashDim.OpeningTypeList) { @@ -174,8 +104,8 @@ else
Dimension - - @foreach (var mType in CurrSashDim.MeasureTypeList) {
- @*
- @for (int k = 0; k <= CurrSashGroup.SashList.Count - 1; k++) - { - @if (k != IndexSash) - { - int IndexCopy = k; - int IndexModify = IndexSash; -
-
- -
-
- } - } -
*@
@@ -254,126 +169,3 @@ else
} - - -@* *@ \ No newline at end of file diff --git a/WebWindowComplex/Compo/AreaSash.razor.cs b/WebWindowComplex/Compo/AreaSash.razor.cs index 85a5381..c62b8bf 100644 --- a/WebWindowComplex/Compo/AreaSash.razor.cs +++ b/WebWindowComplex/Compo/AreaSash.razor.cs @@ -100,6 +100,54 @@ namespace WebWindowComplex.Compo return 0; } + /// + /// Selezione tipo di apertura anta + /// + protected int OpeningTypeIndex + { + get => CurrSashDim.SelOpeningTypeIndex; + set + { + if (CurrSashDim.SelOpeningTypeIndex != value) + { + CurrSashDim.SelOpeningTypeIndex = value; + _ = EC_UpdateSashDim.InvokeAsync(CurrSashDim); + } + } + } + + /// + /// Selezione tipo di misura della dimensione dell'anta + /// + protected int MeasureTypeIndex + { + get => CurrSashDim.SelMeasureTypeIndex; + set + { + if (CurrSashDim.SelMeasureTypeIndex != value) + { + CurrSashDim.SelMeasureTypeIndex = value; + _ = EC_UpdateSashDim.InvokeAsync(CurrSashDim); + } + } + } + + /// + /// Selezione tipo di apertura anta + /// + protected double Dimension + { + get => CurrSashDim.dDimension; + set + { + if (CurrSashDim.dDimension != value) + { + CurrSashDim.dDimension = value; + _ = EC_UpdateSashDim.InvokeAsync(CurrSashDim); + } + } + } + /// /// Sollevo evento richiesta per cambiare tutti i Joint /// diff --git a/WebWindowComplex/Compo/CardFrame.razor.cs b/WebWindowComplex/Compo/CardFrame.razor.cs index b2b2e29..e49e527 100644 --- a/WebWindowComplex/Compo/CardFrame.razor.cs +++ b/WebWindowComplex/Compo/CardFrame.razor.cs @@ -20,7 +20,7 @@ namespace WebWindowComplex.Compo public EventCallback EC_ReqResetDictShape { get; set; } /// - /// Evento per richiedere reset dizionario Shape + /// Evento per richiedere opzioni hardware /// [Parameter] public EventCallback EC_ReqOptionHw { get; set; } @@ -67,13 +67,13 @@ namespace WebWindowComplex.Compo { s.SelHardwareFromId = "000000"; } - _ = EC_ReqOptionHw.InvokeAsync(CurrFrameWindow); var args = new DataUpdateFrame() { currFrame = CurrFrameWindow, svgNoHw = true }; _ = EC_UpdatePreview.InvokeAsync(args); + //_ = EC_ReqOptionHw.InvokeAsync(CurrFrameWindow); //_ = EC_UpdateShape.InvokeAsync(CurrFrameWindow); } } diff --git a/WebWindowComplex/Compo/CardSashGroup.razor b/WebWindowComplex/Compo/CardSashGroup.razor index 0ade146..33f4aa2 100644 --- a/WebWindowComplex/Compo/CardSashGroup.razor +++ b/WebWindowComplex/Compo/CardSashGroup.razor @@ -9,7 +9,7 @@
- +
diff --git a/WebWindowComplex/Compo/CardSashGroup.razor.cs b/WebWindowComplex/Compo/CardSashGroup.razor.cs index 5e4b316..8e4f4a2 100644 --- a/WebWindowComplex/Compo/CardSashGroup.razor.cs +++ b/WebWindowComplex/Compo/CardSashGroup.razor.cs @@ -18,7 +18,7 @@ namespace WebWindowComplex.Compo /// Evento per cambiare tutti i fill /// [Parameter] - public EventCallback EC_RemoveArea { get; set; } + public EventCallback EC_UpdateFrame { get; set; } /// /// Evento per tornare nella pagine Tree @@ -32,6 +32,24 @@ namespace WebWindowComplex.Compo [Parameter] public EventCallback EC_ReqResetDictShape { get; set; } + /// + /// Evento per richiedere reset dizionario Hw option + /// + [Parameter] + public EventCallback EC_ReqResetDictHwOpt { get; set; } + + /// + /// Evento per richiedere opzioni hardware + /// + [Parameter] + public EventCallback EC_ReqOptionHw { get; set; } + + /// + /// Evento per richiedere per la prima volta opzioni hardware + /// + [Parameter] + public EventCallback EC_ReqFirstOptionHw { get; set; } + /// /// Evento per segnalare cambio hw e richiesta calcolo /// @@ -44,31 +62,42 @@ namespace WebWindowComplex.Compo [CascadingParameter(Name = "SashList")] public List SashList { get; set; } = null!; + /// + /// Lista di sash + /// + [Parameter] + public Frame FrameWindow { get; set; } = null!; + #endregion Public Properties #region Protected Properties /// - /// Selezione hardware + /// Selezione quantitą di ante /// - protected string SelHwType + protected int SashQty { - get => CurrSashGroup.SelHardwareFromId; + get => CurrSashGroup.nSashQty; set { - if (CurrSashGroup.SelHardwareFromId != value) + if (CurrSashGroup.nSashQty != value) { - CurrSashGroup.SelHardwareFromId = value; - var args = new DataUpdateSash + CurrSashGroup.nSashQty = value; + var args = new DataUpdateSash() { currSash = CurrSashGroup, - reqHwOption = true + svgNoHw = true }; _ = EC_UpdatePreview.InvokeAsync(args); + //_ = EC_ReqResetDictShape.InvokeAsync(true); + _ = EC_ReqOptionHw.InvokeAsync(CurrSashGroup); } } } + /// + /// Selezione quantitą bottom rail + /// protected int SashBottomRailQty { get => CurrSashGroup.SashBottomRailQty; @@ -83,32 +112,16 @@ namespace WebWindowComplex.Compo CurrSashGroup.SetSashBottomRail(false); var args = new DataUpdateSash() { - currSash = CurrSashGroup, - reqHwOption = false - }; - _ = EC_UpdatePreview.InvokeAsync(args); - } - } - } - - protected int SashQty - { - get => CurrSashGroup.nSashQty; - set - { - if (CurrSashGroup.nSashQty != value) - { - CurrSashGroup.nSashQty = value; - var args = new DataUpdateSash() - { - currSash = CurrSashGroup, - reqHwOption = false + currSash = CurrSashGroup }; _ = EC_UpdatePreview.InvokeAsync(args); } } } + /// + /// Selezione tipo di orientamento della sash + /// protected int OrientationSashTypeIndex { get => CurrSashGroup.SelOrientationSashTypeIndex; @@ -119,14 +132,16 @@ namespace WebWindowComplex.Compo CurrSashGroup.SelOrientationSashTypeIndex = value; var args = new DataUpdateSash() { - currSash = CurrSashGroup, - reqHwOption = false + currSash = CurrSashGroup }; _ = EC_UpdatePreview.InvokeAsync(args); } } } + /// + /// Selezione famiglia hardware + /// protected string FamilyHardware { get => CurrSashGroup.SelFamilyHardware; @@ -138,9 +153,32 @@ namespace WebWindowComplex.Compo var args = new DataUpdateSash() { currSash = CurrSashGroup, - reqHwOption = false + svgNoHw = true }; _ = EC_UpdatePreview.InvokeAsync(args); + _ = EC_ReqResetDictHwOpt.InvokeAsync(true); + _ = EC_ReqOptionHw.InvokeAsync(CurrSashGroup); + } + } + } + + /// + /// Selezione hardware + /// + protected string SelHwType + { + get => CurrSashGroup.SelHardwareFromId; + set + { + if (CurrSashGroup.SelHardwareFromId != value) + { + CurrSashGroup.SelHardwareFromId = value; + var args = new DataUpdateSash + { + currSash = CurrSashGroup + }; + _ = EC_UpdatePreview.InvokeAsync(args); + _ = EC_ReqOptionHw.InvokeAsync(CurrSashGroup); } } } @@ -154,11 +192,16 @@ namespace WebWindowComplex.Compo /// /// area da rimuovere /// - protected async Task RemoveArea(Area currArea) + protected async Task RemoveArea() { + CurrSashGroup.Remove(); + var args = new DataUpdateFrame() + { + currFrame = FrameWindow + }; // richiesta reset dict shape await EC_ReqResetDictShape.InvokeAsync(true); - await EC_RemoveArea.InvokeAsync(currArea); + await EC_UpdateFrame.InvokeAsync(args); } protected async Task SetMeasureType(MeasureTypes type) @@ -170,8 +213,7 @@ namespace WebWindowComplex.Compo } var args = new DataUpdateSash { - currSash = CurrSashGroup, - reqHwOption = false + currSash = CurrSashGroup }; await EC_UpdatePreview.InvokeAsync(args); } @@ -184,8 +226,7 @@ namespace WebWindowComplex.Compo currRec = updateSD; var args = new DataUpdateSash { - currSash = CurrSashGroup, - reqHwOption = false + currSash = CurrSashGroup }; await EC_UpdatePreview.InvokeAsync(args); } @@ -198,8 +239,7 @@ namespace WebWindowComplex.Compo CurrSashGroup = updateS; var args = new DataUpdateSash { - currSash = CurrSashGroup, - reqHwOption = false + currSash = CurrSashGroup }; await EC_UpdatePreview.InvokeAsync(args); } @@ -247,10 +287,10 @@ namespace WebWindowComplex.Compo currRec = AGBOptCombo; var args = new DataUpdateSash { - currSash = CurrSashGroup, - reqHwOption = true + currSash = CurrSashGroup }; await EC_UpdatePreview.InvokeAsync(args); + await EC_ReqOptionHw.InvokeAsync(CurrSashGroup); } } else @@ -263,10 +303,10 @@ namespace WebWindowComplex.Compo currRec = AGBOptText; var args = new DataUpdateSash { - currSash = CurrSashGroup, - reqHwOption = true + currSash = CurrSashGroup }; await EC_UpdatePreview.InvokeAsync(args); + await EC_ReqOptionHw.InvokeAsync(CurrSashGroup); } } } @@ -280,10 +320,10 @@ namespace WebWindowComplex.Compo { var args = new DataUpdateSash { - currSash = CurrSashGroup, - reqHwOption = true + currSash = CurrSashGroup }; - await EC_UpdatePreview.InvokeAsync(args); + //await EC_UpdatePreview.InvokeAsync(args); + await EC_ReqFirstOptionHw.InvokeAsync(CurrSashGroup); } private string ButtonMeasureCss(MeasureTypes type) @@ -307,6 +347,6 @@ namespace WebWindowComplex.Compo public class DataUpdateSash { public Sash currSash { get; set; } = null!; - public bool reqHwOption { get; set; } = false; + public bool svgNoHw { get; set; } = false; } } \ No newline at end of file diff --git a/WebWindowComplex/Compo/CardSplit.razor.cs b/WebWindowComplex/Compo/CardSplit.razor.cs index 592fe86..b25fc40 100644 --- a/WebWindowComplex/Compo/CardSplit.razor.cs +++ b/WebWindowComplex/Compo/CardSplit.razor.cs @@ -27,10 +27,10 @@ namespace WebWindowComplex.Compo public List SplitList { get; set; } = null!; /// - /// Evento per rimuovere split + /// Frame /// [Parameter] - public EventCallback EC_RemoveArea { get; set; } + public Frame FrameWindow { get; set; } = null!; /// /// Evento per richiedere reset dizionario Shape @@ -44,6 +44,12 @@ namespace WebWindowComplex.Compo [Parameter] public EventCallback EC_UpdatePreview { get; set; } + /// + /// Evento per aggiornare Frame + /// + [Parameter] + public EventCallback EC_UpdateFrame { get; set; } + /// /// Evento per tornare nella pagine Tree /// @@ -73,9 +79,14 @@ namespace WebWindowComplex.Compo /// protected async Task RemoveArea() { + CurrSplit.Remove(); + var args = new DataUpdateFrame() + { + currFrame = FrameWindow + }; // richiesta reset dict shape await EC_ReqResetDictShape.InvokeAsync(true); - await EC_RemoveArea.InvokeAsync(CurrSplit); + await EC_UpdateFrame.InvokeAsync(args); } /// diff --git a/WebWindowComplex/Compo/General.razor.cs b/WebWindowComplex/Compo/General.razor.cs index 9ed2b11..04a4242 100644 --- a/WebWindowComplex/Compo/General.razor.cs +++ b/WebWindowComplex/Compo/General.razor.cs @@ -15,16 +15,7 @@ namespace WebWindowComplex.Compo public Window CurrWindow { get; set; } = null!; [Parameter] - public EventCallback EC_SelColor { get; set; } - - [Parameter] - public EventCallback EC_SelGlass { get; set; } - - [Parameter] - public EventCallback EC_SelWindMat { get; set; } - - [Parameter] - public EventCallback EC_SelProfile { get; set; } + public EventCallback EC_UpdateGeneral { get; set; } [Parameter] public EventCallback EC_ReqClose { get; set; } @@ -51,7 +42,11 @@ namespace WebWindowComplex.Compo set { currColor = value; - _ = EC_SelColor.InvokeAsync(value); + var args = new DataUpdateGeneral + { + Color = value, + }; + _ = EC_UpdateGeneral.InvokeAsync(args); } } @@ -61,7 +56,11 @@ namespace WebWindowComplex.Compo set { currGlass = value; - _ = EC_SelGlass.InvokeAsync(value); + var args = new DataUpdateGeneral + { + Glass = value, + }; + _ = EC_UpdateGeneral.InvokeAsync(args); } } @@ -71,7 +70,11 @@ namespace WebWindowComplex.Compo set { currMaterial = value; - _ = EC_SelWindMat.InvokeAsync(value); + var args = new DataUpdateGeneral + { + Material = value, + }; + _ = EC_UpdateGeneral.InvokeAsync(args); } } @@ -81,7 +84,11 @@ namespace WebWindowComplex.Compo set { currProfile = value; - _ = EC_SelProfile.InvokeAsync(value); + var args = new DataUpdateGeneral + { + Profile = value, + }; + _ = EC_UpdateGeneral.InvokeAsync(args); } } @@ -123,4 +130,12 @@ namespace WebWindowComplex.Compo _ = EC_ReqClose.InvokeAsync(true); } } + + public class DataUpdateGeneral + { + public string Color { get; set; } = ""; + public string Glass { get; set; } = ""; + public string Material { get; set; } = ""; + public string Profile { get; set; } = ""; + } } \ No newline at end of file diff --git a/WebWindowComplex/Json/JsonUtility.cs b/WebWindowComplex/Json/JsonUtility.cs index 616a03a..11df650 100644 --- a/WebWindowComplex/Json/JsonUtility.cs +++ b/WebWindowComplex/Json/JsonUtility.cs @@ -413,15 +413,11 @@ namespace WebWindowComplex.Json foreach (var Joint in m_SashList[SashIndex].JointList) newSash.SashList[SashIndex].JointList.Add(Joint.Deserialize((Area)ParentArea)); } - //foreach (var Joint in m_JointList) - // newSash.JointList.Add(Joint.Deserialize((Area)ParentArea)); newSash.SetSelFamilyHardwareFromIndex(Hardware); - newSash.ReqRefreshShape(); + //newSash.ReqRefreshShape(); newSash.SetSelHardwareFromId(Hardware); foreach (var HwOption in m_HwOptionList) newSash.SelHwOptionList.Add(HwOption.Name, HwOption.Value); - //foreach (var HwOption in m_HwOptionList) - // newSash.HwOptionList.Add(HwOption.Deserialize()); foreach (var Area in AreaList) { var AreaDeserealized = Area.Deserialize(newSash, ParentWindow); diff --git a/WebWindowComplex/Models/Joint.cs b/WebWindowComplex/Models/Joint.cs index d1161ba..ba05570 100644 --- a/WebWindowComplex/Models/Joint.cs +++ b/WebWindowComplex/Models/Joint.cs @@ -68,7 +68,6 @@ namespace WebWindowComplex.Models set { m_SelJointType = (Joints)value; - //m_ParentArea.ParentWindow.OnUpdatePreview(m_ParentArea.ParentWindow.sSerialized()); } } diff --git a/WebWindowComplex/Models/Sash.cs b/WebWindowComplex/Models/Sash.cs index aa89f5a..401565b 100644 --- a/WebWindowComplex/Models/Sash.cs +++ b/WebWindowComplex/Models/Sash.cs @@ -112,7 +112,7 @@ namespace WebWindowComplex.Models var addSashDim = new SashDimension(dNewDimension, m_SashList[m_SashList.Count - 1].MeasureType, this, SplitIndex + 1); for(int i = 1; i <= 4; i++) { - addSashDim.JointList.Add(new Joint(this, i, Joints.FULL_H)); + addSashDim.JointList.Add(new Joint(this, i, Joints.FULL_V)); } SashList.Add(addSashDim); } @@ -215,10 +215,8 @@ namespace WebWindowComplex.Models } } RefreshHardwareList(); - RefreshHardwareOptionList(); + ClearHardwareOptionList(); SetFirstHardware(); - //m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); - ReqRefreshHwOption(); } } @@ -270,7 +268,6 @@ namespace WebWindowComplex.Models { m_bSashBottomRail = false; } - // m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); } } } @@ -308,7 +305,6 @@ namespace WebWindowComplex.Models set { SetSelFamilyHardware(value); - //m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); } } @@ -323,8 +319,7 @@ namespace WebWindowComplex.Models m_SelHardware = value; if (HwOptionList.Count != 0) { - RefreshHardwareOptionList(); - ReqRefreshHwOption(); + ClearHardwareOptionList(); } } } @@ -440,6 +435,9 @@ namespace WebWindowComplex.Models } } + /// + /// Metodo per rimuovere l'intero sash group + /// public void Remove() { ParentArea.AreaList.Remove(this); @@ -449,30 +447,30 @@ namespace WebWindowComplex.Models //m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); } - /// - /// Richiesta calcolo shape corrente - /// - public void ReqRefreshShape() - { - if (m_HardwareCompleteList != null && m_HardwareCompleteList.Count > 0) - { - m_HardwareList.Clear(); - // reset shape corrente - m_CurrShape = ""; - // chiamata evento calcolo shape: gruppo da calcolare - //m_ParentWindow.OnReqShapePreview(m_ParentWindow.sSerialized(), GroupId); - } - } + ///// + ///// Richiesta calcolo shape corrente + ///// + //public void ReqRefreshShape() + //{ + // if (m_HardwareCompleteList != null && m_HardwareCompleteList.Count > 0) + // { + // m_HardwareList.Clear(); + // // reset shape corrente + // m_CurrShape = ""; + // // chiamata evento calcolo shape: gruppo da calcolare + // } + //} - /// - /// Richiesta calcolo hardware option list - /// - public void ReqRefreshHwOption() - { - HwOptionList.Clear(); - // chiamata evento calcolo opzioni hardware - //m_ParentWindow.OnReqHwOptionPreview(m_ParentWindow.sSerialized(), GroupId); - } + ///// + ///// Richiesta calcolo hardware option list + ///// + //public void ReqRefreshHwOption() + //{ + // HwOptionList.Clear(); + // m_ReqHwOption = true; + // // chiamata evento calcolo opzioni hardware + // //m_ParentWindow.OnReqHwOptionPreview(m_ParentWindow.sSerialized(), GroupId); + //} public void SetSelFamilyHardware(string sFamilyHw) { @@ -484,10 +482,7 @@ namespace WebWindowComplex.Models } SetFirstHardware(); if (HwOptionList.Count != 0) - { - RefreshHardwareOptionList(); - ReqRefreshHwOption(); - } + ClearHardwareOptionList(); } /// @@ -502,31 +497,33 @@ namespace WebWindowComplex.Models if(string.IsNullOrEmpty(m_SelFamilyHardware) || m_SelFamilyHardware == "") { var listHwValid = Sash.m_HardwareCompleteList - .Where(x => x.Shape == m_CurrShape && - x.SashQty == nSashQty && - x.OpeningType == ConvertOpeningType() - ) - .FirstOrDefault(); + .FirstOrDefault(x => x.Shape == m_CurrShape && + x.SashQty == nSashQty && + x.OpeningType == ConvertOpeningType() + ); if(listHwValid == null) { noHwValid = true; var familyHwValid = Sash.m_HardwareCompleteList .Select(x => x.FamilyName) .First(); + SelHardwareFromId = "000000"; + ClearHardwareOptionList(); } else + { SetSelFamilyHardware(listHwValid.FamilyName); - } - if (noHwValid) - { - SelHardwareFromId = "000000"; + } } else { RefreshHardwareList(); // se il vecchio hw selezionato non va più bene viene selezionato il primo della lista if (!HardwareList.Contains(m_SelHardware) || m_SelHardware.Shape != m_CurrShape) + { SetFirstHardware(); + ClearHardwareOptionList(); + } } } @@ -626,12 +623,10 @@ namespace WebWindowComplex.Models for (var JointIndex = 0; JointIndex <= 3; JointIndex++) sashDim.JointList.Add(new Joint(newSash, JointIndex + 1, Joints.FULL_H)); } - //for (var JointIndex = 0; JointIndex <= 3; JointIndex++) - // newSash.JointList.Add(new Joint(newSash, JointIndex + 1, Joints.FULL_H)); newSash.SetSashBottomRail(false); newSash.SetSashBottomRailQty(0); newSash.SetSelFamilyHardware(Sash.s_FamilyHardwareList.First()); - newSash.RefreshHardwareOptionList(); + newSash.ClearHardwareOptionList(); newSash.SetFirstHardware(); return newSash; } @@ -716,7 +711,7 @@ namespace WebWindowComplex.Models } } - internal void RefreshHardwareOptionList() + internal void ClearHardwareOptionList() { m_HwdOptionList.Clear(); } @@ -903,11 +898,6 @@ namespace WebWindowComplex.Models return SelFamilyHardware; } - internal void SetSelHardware(Hardware value) - { - SelHardware = value; - } - internal void SetSelHardwareFromId(string sId) { if (m_HardwareList.Count == 0) diff --git a/WebWindowComplex/Models/SashDimension.cs b/WebWindowComplex/Models/SashDimension.cs index 5d3a9e4..72cdea9 100644 --- a/WebWindowComplex/Models/SashDimension.cs +++ b/WebWindowComplex/Models/SashDimension.cs @@ -103,7 +103,6 @@ namespace WebWindowComplex.Models set { m_bHasHandle = value; - //m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); } } @@ -278,7 +277,6 @@ namespace WebWindowComplex.Models item.SetDimension(ConvertIn(absolutValList[i], (MeasureTypes)item.SelMeasureTypeIndex, widthTot)); } } - m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); } } } @@ -316,8 +314,7 @@ namespace WebWindowComplex.Models set { m_SelOpeningType = value; - m_Parent.ReqRefreshShape(); - m_Parent.RefreshHardwareOptionList(); + m_Parent.ClearHardwareOptionList(); m_Parent.SetFirstHardware(); } } @@ -326,7 +323,6 @@ namespace WebWindowComplex.Models { get { - //return IdNameStruct.IndFromId((int)m_SelOpeningType, m_OpeningTypeList); return (int)m_SelOpeningType; } set @@ -337,10 +333,8 @@ namespace WebWindowComplex.Models (newOpening == Openings.TILTTURN_RIGHT && m_bHasHandle)) { m_SelOpeningType = newOpening; - m_Parent.ReqRefreshShape(); - m_Parent.RefreshHardwareOptionList(); + m_Parent.ClearHardwareOptionList(); m_Parent.SetFirstHardware(); - m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); } } } @@ -387,7 +381,6 @@ namespace WebWindowComplex.Models double widthTot = CalculateWidthSashGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dValue); m_dDimension = ConvertDimension(m_SelMeasureType, newType, widthTot); m_SelMeasureType = (MeasureTypes)value; - m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); } } } diff --git a/WebWindowComplex/Models/Split.cs b/WebWindowComplex/Models/Split.cs index 3963b80..b2fcc48 100644 --- a/WebWindowComplex/Models/Split.cs +++ b/WebWindowComplex/Models/Split.cs @@ -342,7 +342,7 @@ namespace WebWindowComplex.Models Fill newFill = Fill.CreateFill(ParentArea, FillTypes.GLASS); newFill.SetAreaType(AreaTypes.FILL); ParentArea.AreaList.Add(newFill); - m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); + //m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); } #endregion Public Methods diff --git a/WebWindowComplex/Models/SplitDimension.cs b/WebWindowComplex/Models/SplitDimension.cs index 0ad1e99..bb103a0 100644 --- a/WebWindowComplex/Models/SplitDimension.cs +++ b/WebWindowComplex/Models/SplitDimension.cs @@ -204,7 +204,7 @@ namespace WebWindowComplex.Models item.SetDimension(ConvertIn(absolutValList[i], (MeasureTypes)item.SelMeasureTypeIndex, widthTot, dimensions)); } } - m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); + //m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); } //// Controllo che il valore inserito sia compreso tra 0 e 100 //if (value > 0 && value < 100) @@ -348,7 +348,7 @@ namespace WebWindowComplex.Models } m_dDimension = ConvertDimension(m_SelMeasureType, newType, tot, splitList); m_SelMeasureType = (MeasureTypes)value; - m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); + //m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); } } } diff --git a/WebWindowComplex/Models/Window.cs b/WebWindowComplex/Models/Window.cs index 2685c9a..020611e 100644 --- a/WebWindowComplex/Models/Window.cs +++ b/WebWindowComplex/Models/Window.cs @@ -19,7 +19,7 @@ namespace WebWindowComplex.Models { #region Public Events - public event EventHandler OnPreview = delegate { }; + //public event EventHandler OnPreview = delegate { }; //public event EventHandler OnReqShape = delegate { }; //public event EventHandler OnReqHwOption = delegate { }; @@ -48,7 +48,6 @@ namespace WebWindowComplex.Models set { m_sColorMaterial = value; - OnUpdatePreview(sSerialized()); } } @@ -61,7 +60,6 @@ namespace WebWindowComplex.Models set { m_sGlass = value; - OnUpdatePreview(sSerialized()); } } @@ -74,7 +72,6 @@ namespace WebWindowComplex.Models set { m_sMaterial = value; - OnUpdatePreview(sSerialized()); } } @@ -87,7 +84,6 @@ namespace WebWindowComplex.Models set { m_sProfilePath = value; - OnUpdatePreview(sSerialized()); } } @@ -95,15 +91,15 @@ namespace WebWindowComplex.Models #region Internal Methods - internal void OnUpdatePreview(string sJwd) - { - OnPreviewEventArgs e = new OnPreviewEventArgs(sJwd); - EventHandler handler = OnPreview; - if (handler != null) - { - handler(this, e); - } - } + //internal void OnUpdatePreview(string sJwd) + //{ + // OnPreviewEventArgs e = new OnPreviewEventArgs(sJwd); + // EventHandler handler = OnPreview; + // if (handler != null) + // { + // handler(this, e); + // } + //} //internal void OnReqShapePreview(string sJwd, int groupId) //{ diff --git a/WebWindowComplex/TableComp.razor b/WebWindowComplex/TableComp.razor index d8fe216..3e4cde4 100644 --- a/WebWindowComplex/TableComp.razor +++ b/WebWindowComplex/TableComp.razor @@ -101,7 +101,8 @@ @@ -119,9 +120,13 @@ - @@ -179,10 +184,7 @@ } diff --git a/WebWindowComplex/TableComp.razor.cs b/WebWindowComplex/TableComp.razor.cs index 95711a0..20c4d59 100644 --- a/WebWindowComplex/TableComp.razor.cs +++ b/WebWindowComplex/TableComp.razor.cs @@ -117,7 +117,7 @@ namespace WebWindowComplex { if (m_CurrWindow != null) { - m_CurrWindow.OnPreview -= M_CurrWindow_OnPreview; + //m_CurrWindow.OnPreview -= M_CurrWindow_OnPreview; //m_CurrWindow.OnReqHwOption -= M_CurrWindow_OnHwOption; //m_CurrWindow.OnReqShape -= M_CurrWindow_OnShape; m_CurrWindow = null; @@ -385,92 +385,6 @@ namespace WebWindowComplex } } - //protected void calculateWidth(Area area) - //{ - // if (area is Sash) - // { - // Sash sash = (Sash)area; - // if (area.ParentArea is Frame) - // { - // Frame frame = (Frame)area.ParentArea; - // sash.Width = (frame.DimensionList.Where(x => x.sName == "Width").FirstOrDefault())!.dValue; - // } - // else if (sash.ParentArea.ParentArea is Split) - // { - // Split split = (Split)sash.ParentArea.ParentArea; - // if (split.SplitVertList.Count > 0) - // { - // int indexSplit = 0; - // for(int i = 0; i < split.AreaList.Count; i++) - // { - // if (split.AreaList.ElementAt(i).AreaList.First().Equals(sash)) - // indexSplit = i; - // } - // switch (split.SplitVertList.ElementAt(indexSplit).MeasureType) - // { - // case MeasureTypes.ABSOLUT: - // { - // sash.Width = split.SplitVertList.ElementAt(indexSplit).dDimension; - // break; - // } - // case MeasureTypes.PROPORTIONAL: - // { - // /// TO DO!!!!! - // break; - // } - // case MeasureTypes.PERCENTAGE: - // { - // sash.Width = split.SplitVertList.ElementAt(indexSplit).dDimension / 100 * split.Width; - // break; - // } - // } - // } - // else - // { - // Frame frame = (Frame)sash.ParentWindow.AreaList[0]; - // sash.Width = (frame.DimensionList.Where(x => x.sName == "Width").FirstOrDefault())!.dValue; - // } - // } - // } - // else if (area is Split) - // { - // Split split = (Split)area; - // if (area.ParentArea is Frame) - // { - // Frame frame = (Frame)area.ParentArea; - // split.Width = (frame.DimensionList.Where(x => x.sName == "Width").FirstOrDefault())!.dValue; - // } - // else if (split.ParentArea.ParentArea is Sash) - // { - // Sash sash = (Sash)split.ParentArea.ParentArea; - // int indexSash = 0; - // for (int i = 0; i < sash.AreaList.Count; i++) - // { - // if (sash.AreaList.ElementAt(i).AreaList.First().Equals(split)) - // indexSash = i; - // } - // switch (sash.SashList.ElementAt(indexSash).MeasureType) - // { - // case MeasureTypes.ABSOLUT: - // { - // split.Width = sash.SashList.ElementAt(indexSash).dDimension; - // break; - // } - // case MeasureTypes.PROPORTIONAL: - // { - // //split.Width = Proportional2AbsolutVal(split); - // break; - // } - // case MeasureTypes.PERCENTAGE: - // { - // split.Width = sash.SashList.ElementAt(indexSash).dDimension / 100 * sash.Width; - // break; - // } - // } - // } - // } - //} - /// /// Calcola CSS warning /// @@ -522,7 +436,7 @@ namespace WebWindowComplex } /// - /// Richiesta calcolo Options HW da JWD + /// Richiesta calcolo Options HW /// /// Lista degli ID numerici dei gruppi da valutare /// @@ -726,13 +640,21 @@ namespace WebWindowComplex List reqList = SashList.Select(x => x.GroupId).ToList(); if (reqList.Count > 0) { + //prevReq = (int)DataReq.ReqShape; await DoReqShape(reqList); } } else { // chiedo SVG - await DoPreviewSvg(true); + //prevReq = (int)DataReq.ReqSvg; + if(prevReq != (int)DataReq.ReqSvg || !prevLiveData.JwdEqual(LiveData.CurrJwd)) + { + if(prevReq != (int)DataReq.ReqHwOpt) + await DoPreviewSvg(true); + else if (LiveData.DictOptionsXml.Count > 0) + await DoPreviewSvg(true); + } } } } @@ -752,17 +674,10 @@ namespace WebWindowComplex { if (m_CurrWindow != null) { - m_CurrWindow.OnPreview -= M_CurrWindow_OnPreview; - //m_CurrWindow.OnReqHwOption -= M_CurrWindow_OnHwOption; - //m_CurrWindow.OnReqShape -= M_CurrWindow_OnShape; m_CurrWindow = null; } m_CurrWindow = WindowFromJson.Deserialize(); FrameWindow = m_CurrWindow.AreaList[0]; - m_CurrWindow.OnPreview += M_CurrWindow_OnPreview; - //m_CurrWindow.OnReqHwOption += M_CurrWindow_OnHwOption; - //m_CurrWindow.OnReqShape += M_CurrWindow_OnShape; - // Recupero dimensioni Frame e Joint del frame della finestra precedente if (m_PreviousWindow != null) { for (int i = 0; i < 2; i++) @@ -792,10 +707,17 @@ namespace WebWindowComplex // Inserisco le forme ricevuto nei sash group foreach (var item in LiveData.DictShape) { - Sash sashFromGroupId = SashList.Where(x => x.GroupId == item.Key).First(); + Sash sashFromGroupId = SashList.First(x => x.GroupId == item.Key); sashFromGroupId.SashShape = item.Value; sashFromGroupId.UpdateShape(item.Value); } + if(prevReq == (int)DataReq.ReqShape){ + if(reqHwOpt > 0) + { + List reqList = SashList.Select(x => x.GroupId).ToList(); + _=DoReqOptHardware(reqList); + } + } } // se ho le opzioni hw le aggiungo if (LiveData.DictOptionsXml.Count > 0) @@ -917,6 +839,7 @@ namespace WebWindowComplex /// Salvataggio tipo di domanda precedente /// private int prevReq { get; set; } = 0; + private int reqHwOpt { get; set; } = 0; #endregion Private Properties @@ -934,30 +857,6 @@ namespace WebWindowComplex currSplitIndex = -1; } - /// - /// 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); - } - - /// - /// Metodo per settare tutti i Fill in contemporanea - /// - /// tipo di riempimento (GLASS o WOOD) - /// - private async Task ChangeOneFill(FillTypes type) - { - Fill fillChange = FillList.ElementAt(currFillIndex); - fillChange.SetSelFillType(type); - await DoPreviewSvg(); - } - /// /// Verifica errori prelimionari per mostrare dove sia il problema /// @@ -1048,41 +947,6 @@ namespace WebWindowComplex } } - private void M_CurrWindow_OnHwOption(object? sender, OnReqHwOptEventArgs e) - { - // chiamo reset dizionario - ReqResetHwOpt(true); - // setto che sto chiedendo update opzioni - loadListAdd("LoadHwOpt"); - _ = InvokeAsync(StateHasChanged); - Dictionary Args = new Dictionary(); - Args.Add("Mode", $"{(int)Enums.QuestionModes.HARDWARE}"); - Args.Add("SubMode", $"{(int)Enums.QuestionHwSubModes.HARDWAREOPTIONS}"); - Args.Add("SerializedData", e.sJwd); - string listGroupId = JsonConvert.SerializeObject(new List { e.nGroupId }); - Args.Add("GroupId", listGroupId); - _ = EC_DoUpdate.InvokeAsync(Args); - } - - private void M_CurrWindow_OnPreview(object? sender, OnPreviewEventArgs e) - { - Dictionary Args = new Dictionary(); - Args.Add("Mode", $"{(int)Enums.QuestionModes.PREVIEW}"); - Args.Add("SerializedData", e.sJwd); - _ = EC_DoUpdate.InvokeAsync(Args); - } - - private void M_CurrWindow_OnShape(object? sender, OnReqShapeEventArgs e) - { - Dictionary Args = new Dictionary(); - Args.Add("Mode", $"{(int)Enums.QuestionModes.HARDWARE}"); - Args.Add("SubMode", $"{(int)Enums.QuestionHwSubModes.SASHSHAPE}"); - Args.Add("SerializedData", e.sJwd); - string listGroupId = JsonConvert.SerializeObject(new List { e.groupId }); - Args.Add("GroupId", listGroupId); - _ = EC_DoUpdate.InvokeAsync(Args); - } - /// /// Metodo per cambiare step /// @@ -1128,22 +992,6 @@ namespace WebWindowComplex NextStep(newStep, Index); } - /// - /// Metodo per eliminare Split o Sash - /// - /// Area corrente - /// - private void RemoveArea(Area currArea) - { - if (currArea is Split) - ((Split)currArea).Remove(); - else if (currArea is Sash) - { - ((Sash)currArea).Remove(); - } - currStep = CompileStep.Tree; - } - /// /// Richiesta reset dizionario Shape con action /// @@ -1154,10 +1002,10 @@ namespace WebWindowComplex } /// - /// Richiesta reset dizionario options con action + /// Richiesta reset dizionario Hw Option con action /// /// - private void ReqResetHwOpt(bool args) + private void ReqResetDictHwOpt(bool args) { _ = EC_ActionReq.InvokeAsync(DataAction.ResetHwOpt); } @@ -1189,71 +1037,26 @@ namespace WebWindowComplex } /// - /// Selezione del colore + /// Metodo per aggiornare valori della sezione General /// /// - private void SelectColor(string newVal) + private void UpdatePreviewGeneral(DataUpdateGeneral args) { + string Color = args.Color; + string Glass = args.Glass; + string Material = args.Material; + string Profile = args.Profile; if (m_CurrWindow != null) { - m_CurrWindow.sColorMaterial = newVal; - } - } - - /// - /// Selezione del vetro - /// - /// - private void SelectGlass(string newVal) - { - if (m_CurrWindow != null) - { - m_CurrWindow.sGlass = newVal; - } - } - - /// - /// Selezione del materiale - /// - /// - private void SelectMat(string newVal) - { - if (m_CurrWindow != null) - { - m_CurrWindow.sMaterial = newVal; - } - } - - /// - /// Selezione del profilo - /// - /// - private void SelectProfile(string newVal) - { - if (m_CurrWindow != null) - { - m_CurrWindow.sProfilePath = newVal; - } - } - - /// - /// Metodo per scambiare due aree di uno split - /// - /// Area corrente - /// - private async Task SwapTwoAree(Area currArea) - { - currArea.SwapAree(); - await DoPreviewSvg(true, true); - if (currArea is Split) - { - List reqList = SashList.Select(x => x.GroupId).ToList(); - //List reqShape = new List(); - //if (currArea.AreaList[0].AreaList.Where(x => x.AreaType == AreaTypes.SASH).ToList().Count() > 0) - // reqShape.Add(currArea.AreaList[0].AreaList.Where(x => x.AreaType == AreaTypes.SASH).Select(x => x.GroupId).FirstOrDefault()); - //if (currArea.AreaList[1].AreaList.Where(x => x.AreaType == AreaTypes.SASH).ToList().Count() > 0) - // reqShape.Add(currArea.AreaList[1].AreaList.Where(x => x.AreaType == AreaTypes.SASH).Select(x => x.GroupId).FirstOrDefault()); - await DoReqShape(reqList); + if (!string.IsNullOrEmpty(Color)) + m_CurrWindow.sColorMaterial = Color; + else if (!string.IsNullOrEmpty(Glass)) + m_CurrWindow.sGlass = Glass; + else if (!string.IsNullOrEmpty(Material)) + m_CurrWindow.sMaterial = Material; + else if(!string.IsNullOrEmpty(Profile)) + m_CurrWindow.sProfilePath = Profile; + _ = DoPreviewSvg(); } } @@ -1372,6 +1175,58 @@ namespace WebWindowComplex currRec = newFrame; // resetto hw lst await EC_ActionReq.InvokeAsync(DataAction.ResetHwOpt); + reqHwOpt++; + if (prevReq == (int)DataReq.ReqShape) + { + // richiesta calcolo opzioni hardware per la singola sash group + List reqList = SashList.Select(x => x.GroupId).ToList(); + // chiamo con gruppo della nuova sash + await DoReqOptHardware(reqList); + } + } + } + + /// + /// Aggiornamento opzioni data nuova sash group + /// + /// nuovo frame + /// + private async Task UpdateHwOptionsSash(Sash newSash) + { + if (newSash != null) + { + // cerco il record + var currRec = SearchArea(FrameWindow, newSash.GroupId, newSash); + // lo aggiorno + currRec = newSash; + // resetto hw lst + await EC_ActionReq.InvokeAsync(DataAction.ResetHwOpt); + //reqHwOpt++; + //if(prevReq == (int)DataReq.ReqShape) + //{ + // richiesta calcolo opzioni hardware per la singola sash group + List reqList = SashList.Select(x => x.GroupId).ToList(); + // chiamo con gruppo della nuova sash + await DoReqOptHardware(reqList); + //} + } + } + + /// + /// Richiesta opzioni hardware per la prima volta + /// + /// nuovo frame + /// + private async Task ReqFirstOptionHw(Sash newSash) + { + if (newSash != null) + { + // cerco il record + var currRec = SearchArea(FrameWindow, newSash.GroupId, newSash); + // lo aggiorno + currRec = newSash; + // resetto hw lst + await EC_ActionReq.InvokeAsync(DataAction.ResetHwOpt); // richiesta calcolo opzioni hardware per la singola sash group List reqList = SashList.Select(x => x.GroupId).ToList(); // chiamo con gruppo della nuova sash @@ -1416,14 +1271,12 @@ namespace WebWindowComplex UpdateLists(); // richiedo update shape List reqList = SashList.Select(x => x.GroupId).ToList(); - await DoReqShape(reqList); await DoPreviewSvg(); + await DoReqShape(reqList); } } - - /// /// Aggiornamento opzioni dato update sash /// @@ -1432,14 +1285,15 @@ namespace WebWindowComplex private async Task UpdatePreviewSashGroup(DataUpdateSash args) { Sash newSash = args.currSash; - bool reqHwOpt = args.reqHwOption; - if (reqHwOpt) + bool svgNoHw = args.svgNoHw; + if (svgNoHw) { - // resetto hw lst - await EC_ActionReq.InvokeAsync(DataAction.ResetHwOpt); - // richiesta calcolo opzioni hardware per la singola sash group - List reqList = new List() { newSash.GroupId }; - await DoReqOptHardware(reqList); + Sash item = (Sash)SearchArea(FrameWindow, newSash.GroupId, newSash); + if (newSash != null && item != null) + { + item = newSash; + await DoPreviewSvg(true, true); + } } else { @@ -1452,16 +1306,6 @@ namespace WebWindowComplex } } - private async Task UpdateSplit(Split newSplit) - { - if (newSplit != null) - { - Split item = (Split)SearchArea(FrameWindow, newSplit.GroupId, newSplit); - item = newSplit; - await DoPreviewSvg(); - } - } - #endregion Private Methods } } \ No newline at end of file diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index c69c677..be9f69c 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.11.2617 + 2.7.11.2818 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -169,6 +169,21 @@ + + + + + + + + + + + + + + + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index 167fb10..7678d14 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.11.2617 + 2.7.11.2818 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -253,6 +253,24 @@ + + + + + + + + + + + + + + + + + +