From 3d092b53fb6bfa80d7f611e9206d9a14f8e261a4 Mon Sep 17 00:00:00 2001 From: Annamaria Sassi Date: Fri, 6 Feb 2026 17:48:03 +0100 Subject: [PATCH] - Modificata gestione elementi split (su dimensione secondaria si specifica solo una larghezza per split) - Aggiunta gestione profili bottom rail per sash e frame - Iniziato a gestire dimensione solo luce per sash --- Test.UI/Data/FinestraSplitGrid.jwd | 10 -- WebWindowComplex/Compo/AreaHwOption.razor.cs | 4 + WebWindowComplex/Compo/AreaSash.razor.cs | 56 ++++---- WebWindowComplex/Compo/AreaSplit.razor.cs | 1 + WebWindowComplex/Compo/BottomRail.razor | 30 ++++ WebWindowComplex/Compo/BottomRail.razor.cs | 79 ++++++++++ WebWindowComplex/Compo/CardFill.razor.cs | 2 +- WebWindowComplex/Compo/CardFrame.razor | 10 +- WebWindowComplex/Compo/CardFrame.razor.cs | 23 ++- WebWindowComplex/Compo/CardSashGroup.razor | 9 +- WebWindowComplex/Compo/CardSashGroup.razor.cs | 136 +++++++++--------- WebWindowComplex/Compo/CardSplit.razor | 4 +- WebWindowComplex/Compo/CardSplit.razor.cs | 42 +++++- WebWindowComplex/Compo/EditElement.razor.cs | 2 +- WebWindowComplex/Compo/EditSplitElement.razor | 2 +- .../Compo/EditSplitElement.razor.cs | 19 +-- .../Compo/FrameBottomRail.razor.cs | 2 +- .../Compo/SashBottomRail.razor.cs | 9 +- WebWindowComplex/Json/JsonUtility.cs | 78 ++++++---- WebWindowComplex/Models/Area.cs | 9 +- WebWindowComplex/Models/Frame.cs | 27 +++- WebWindowComplex/Models/Sash.cs | 25 +++- WebWindowComplex/Models/Split.cs | 81 +++++------ WebWindowComplex/TableComp.razor.cs | 4 +- WebWindowComplex/WebWindowComplex.csproj | 22 ++- .../WebWindowConfigurator.csproj | 3 +- 26 files changed, 450 insertions(+), 239 deletions(-) create mode 100644 WebWindowComplex/Compo/BottomRail.razor create mode 100644 WebWindowComplex/Compo/BottomRail.razor.cs diff --git a/Test.UI/Data/FinestraSplitGrid.jwd b/Test.UI/Data/FinestraSplitGrid.jwd index f1d93c7..0df35d6 100644 --- a/Test.UI/Data/FinestraSplitGrid.jwd +++ b/Test.UI/Data/FinestraSplitGrid.jwd @@ -108,16 +108,6 @@ "Index": 2, "Value": 78.0, "Area": 1 - }, - { - "Index": 1, - "Value": 78.0, - "Area": 2 - }, - { - "Index": 2, - "Value": 78.0, - "Area": 2 } ], "GroupId": 2, diff --git a/WebWindowComplex/Compo/AreaHwOption.razor.cs b/WebWindowComplex/Compo/AreaHwOption.razor.cs index f184a3d..e478947 100644 --- a/WebWindowComplex/Compo/AreaHwOption.razor.cs +++ b/WebWindowComplex/Compo/AreaHwOption.razor.cs @@ -39,6 +39,10 @@ namespace WebWindowComplex.Compo } } + /// + /// Metodo per aprire/chiudere area per hw option + /// + /// private async Task changeCollapsed() { hwOptCollapsed = !hwOptCollapsed; diff --git a/WebWindowComplex/Compo/AreaSash.razor.cs b/WebWindowComplex/Compo/AreaSash.razor.cs index 3ad50dc..520d797 100644 --- a/WebWindowComplex/Compo/AreaSash.razor.cs +++ b/WebWindowComplex/Compo/AreaSash.razor.cs @@ -116,29 +116,29 @@ namespace WebWindowComplex.Compo return 0; } - /// - /// Metodo per avere il lo step da usare nella form-input - /// - /// - public double CssStepNumber() - { - switch (CurrSashDim.MeasureType) - { - case Json.WindowConst.MeasureTypes.ABSOLUTE: - { - return 0.5; - } - case Json.WindowConst.MeasureTypes.PROPORTIONAL: - { - return 1; - } - case Json.WindowConst.MeasureTypes.PERCENTAGE: - { - return 0.5; - } - } - return 0; - } + ///// + ///// Metodo per avere il lo step da usare nella form-input + ///// + ///// + //public double CssStepNumber() + //{ + // switch (CurrSashDim.MeasureType) + // { + // case Json.WindowConst.MeasureTypes.ABSOLUTE: + // { + // return 0.5; + // } + // case Json.WindowConst.MeasureTypes.PROPORTIONAL: + // { + // return 1; + // } + // case Json.WindowConst.MeasureTypes.PERCENTAGE: + // { + // return 0.5; + // } + // } + // return 0; + //} /// /// Selezione tipo di apertura anta @@ -192,6 +192,7 @@ namespace WebWindowComplex.Compo /// /// Sollevo evento richiesta per cambiare tutti i Joint /// + /// Tipo di giunto che si vuole /// private Task ChangeAllJoints(Json.WindowConst.Joints JointType) { @@ -203,7 +204,7 @@ namespace WebWindowComplex.Compo /// /// Aggiornamento joint /// - /// + /// Tipo di giunto che si vuole /// private async Task UpdateJoint(Joint updRec) { @@ -220,7 +221,7 @@ namespace WebWindowComplex.Compo /// /// Aggiornamento element /// - /// + /// Tipo di giunto che si vuole /// private async Task UpdateElement(ElementDimension updRec) { @@ -286,10 +287,12 @@ namespace WebWindowComplex.Compo }; return EC_UpdateSash.InvokeAsync(args); } - + /// /// Copio contenuto anta da indexCopy a IndexModify /// + /// Indice dell'ante di cui voglio copiare contenuto + /// Indice dell'ante di cui voglio modificare contenuto /// private Task CopyContentSash(int IndexCopy, int IndexModify) { @@ -353,6 +356,7 @@ namespace WebWindowComplex.Compo View = 1, Edit = 2 } + protected override void OnParametersSet() { if (EditMode) diff --git a/WebWindowComplex/Compo/AreaSplit.razor.cs b/WebWindowComplex/Compo/AreaSplit.razor.cs index 3594d1a..a272dfa 100644 --- a/WebWindowComplex/Compo/AreaSplit.razor.cs +++ b/WebWindowComplex/Compo/AreaSplit.razor.cs @@ -39,6 +39,7 @@ namespace WebWindowComplex.Compo /// /// Metodo per copiare sash /// + /// Indice della finestra che si vuole copiare /// private Task RaiseCopySash(int indexCurrSash) { diff --git a/WebWindowComplex/Compo/BottomRail.razor b/WebWindowComplex/Compo/BottomRail.razor new file mode 100644 index 0000000..97cc835 --- /dev/null +++ b/WebWindowComplex/Compo/BottomRail.razor @@ -0,0 +1,30 @@ + + + \ No newline at end of file diff --git a/WebWindowComplex/Compo/BottomRail.razor.cs b/WebWindowComplex/Compo/BottomRail.razor.cs new file mode 100644 index 0000000..960e105 --- /dev/null +++ b/WebWindowComplex/Compo/BottomRail.razor.cs @@ -0,0 +1,79 @@ +using Microsoft.AspNetCore.Components; +using WebWindowComplex.Models; + +namespace WebWindowComplex.Compo +{ + public partial class BottomRail + { + #region Public Properties + + [Parameter] + public Area CurrArea { get; set; } = null!; + + [Parameter] + public EventCallback EC_UpdateBottomRail { get; set; } + + #endregion Public Properties + + #region Private Properties + + /// + /// Aggiornamento element Bottom Rail + /// + /// + /// + private async Task UpdateElement(ElementDimension updRec) + { + if (updRec != null) + { + DataBottomRail ans = new(); + ElementDimension currRec = new(CurrArea, -1, 0); + if (CurrFrame() != null) + { + // cerco il record + currRec = CurrFrame().BottomRailElemDimList.FirstOrDefault(x => x.ParentArea == updRec.ParentArea && x.nIndex == updRec.nIndex); + + } + else if(CurrSash() != null) + { + // cerco il record + currRec = CurrSash().BottomRailElemDimList.FirstOrDefault(x => x.ParentArea == updRec.ParentArea && x.nIndex == updRec.nIndex); + } + if (currRec != null) + { + currRec = updRec; + ans = new DataBottomRail + { + frame = CurrFrame(), + sash = CurrSash() + }; + } + await EC_UpdateBottomRail.InvokeAsync(ans); + } + } + + private Frame? CurrFrame() + { + if(CurrArea is Frame) + return (Frame)CurrArea; + else + return null; + } + + private Sash? CurrSash() + { + if (CurrArea is Sash) + return (Sash)CurrArea; + else + return null; + } + + #endregion Private Properties + } + + public class DataBottomRail + { + public Sash? sash { get; set; } + public Frame? frame { get; set; } + } +} \ No newline at end of file diff --git a/WebWindowComplex/Compo/CardFill.razor.cs b/WebWindowComplex/Compo/CardFill.razor.cs index e392a10..6ce6aa9 100644 --- a/WebWindowComplex/Compo/CardFill.razor.cs +++ b/WebWindowComplex/Compo/CardFill.razor.cs @@ -45,7 +45,7 @@ namespace WebWindowComplex.Compo /// /// Metodo per cambiare solo il Fill corrente /// - /// tipo di fill richiesto + /// Tipo di fill richiesto /// protected Task ChangeOneFill(FillTypes reqFillType) { diff --git a/WebWindowComplex/Compo/CardFrame.razor b/WebWindowComplex/Compo/CardFrame.razor index 0dcce3a..1c8f405 100644 --- a/WebWindowComplex/Compo/CardFrame.razor +++ b/WebWindowComplex/Compo/CardFrame.razor @@ -80,11 +80,11 @@ } else { - @if (CurrFrameWindow.BottomRailQty > 0) { - + } + } @@ -102,17 +102,17 @@ {
- +
- +
- +
} diff --git a/WebWindowComplex/Compo/CardFrame.razor.cs b/WebWindowComplex/Compo/CardFrame.razor.cs index f5f13ba..1e2fcfb 100644 --- a/WebWindowComplex/Compo/CardFrame.razor.cs +++ b/WebWindowComplex/Compo/CardFrame.razor.cs @@ -190,15 +190,13 @@ namespace WebWindowComplex.Compo /// /// Metodo per cambiare tutti i joint /// + /// /// - private Task ChangeAllJoints(Json.WindowConst.Joints JointType, Area a) + private Task ChangeAllJoints(Json.WindowConst.Joints JointType) { - if (a is Frame) + foreach (Joint joint in CurrFrameWindow.JointList) { - foreach (Joint joint in CurrFrameWindow.JointList) - { - joint.SetSelJointType(JointType); - } + joint.SetSelJointType(JointType); } var args = new DataUpdateFrame() { currFrame = CurrFrameWindow, svgNoHw = false }; return EC_UpdateFrame.InvokeAsync(args); @@ -215,7 +213,8 @@ namespace WebWindowComplex.Compo /// /// Aggiornamento dimensione editata /// - /// + /// Dimensione aggiornata + /// private async Task UpdateDim(FrameDimension updRec) { // cerco il record @@ -281,15 +280,15 @@ namespace WebWindowComplex.Compo } /// - /// Aggiornamento Bottom Rail + /// Aggiornamento Frame /// /// - private async Task UpdateFrame(Frame updRec) + private async Task UpdateFrame(DataBottomRail updRec) { // lo aggiorno - if (updRec != null) + if (updRec.frame != null) { - CurrFrameWindow = updRec; + CurrFrameWindow = updRec.frame; var args = new DataUpdateFrame() { currFrame = CurrFrameWindow, @@ -304,7 +303,7 @@ namespace WebWindowComplex.Compo ///
/// /// - private string ButtonJointCss(WebWindowComplex.Json.WindowConst.Joints type) + private string ButtonJointCss(Json.WindowConst.Joints type) { foreach (var item in CurrFrameWindow.JointList) { diff --git a/WebWindowComplex/Compo/CardSashGroup.razor b/WebWindowComplex/Compo/CardSashGroup.razor index e340b36..e2e88a3 100644 --- a/WebWindowComplex/Compo/CardSashGroup.razor +++ b/WebWindowComplex/Compo/CardSashGroup.razor @@ -14,10 +14,10 @@ - @*
+
-
*@ +
}
@@ -69,11 +69,11 @@ } else { - @if (CurrSashGroup.SashBottomRailQty > 0) { - + } + }
@@ -198,6 +198,7 @@ EditMode="editMode" EC_UpdateSash="UpdateSash" EC_UpdateSashDim="UpdateSashDimension" + EC_ReqResetDict="ResetDict" EC_EditView="EditView"> } diff --git a/WebWindowComplex/Compo/CardSashGroup.razor.cs b/WebWindowComplex/Compo/CardSashGroup.razor.cs index 608ce00..57838a3 100644 --- a/WebWindowComplex/Compo/CardSashGroup.razor.cs +++ b/WebWindowComplex/Compo/CardSashGroup.razor.cs @@ -198,9 +198,8 @@ namespace WebWindowComplex.Compo #region Protected Methods /// - /// Metodo per rimuovere area + /// Metodo per rimuovere area corrente /// - /// area da rimuovere /// protected async Task RemoveArea() { @@ -218,37 +217,37 @@ namespace WebWindowComplex.Compo } /// - /// Metodo per cambiare l'anta su cui è presente la maniglia + /// Metodo per cambiare dimensione solo luce /// /// - //private async Task ChangeTypeDimension() - //{ - // CurrSashGroup.bIsDimensionLight = !CurrSashGroup.bIsDimensionLight; - // foreach(var CurrSashDim in CurrSashGroup.SashList) - // { - // if(CurrSashDim.SelMeasureType is MeasureTypes.ABSOLUTE) - // { - // if (CurrSashGroup.bIsDimensionLight) - // { - // CurrSashDim.SetDimensionLight(CurrSashDim.dDimension - - // CurrSashDim.ElementDimensionList.ElementAt(1).dDimension - - // CurrSashDim.ElementDimensionList.ElementAt(3).dDimension); - // } - // else - // { - // CurrSashDim.SetDimensionLight(CurrSashDim.dDimension + - // CurrSashDim.ElementDimensionList.ElementAt(1).dDimension + - // CurrSashDim.ElementDimensionList.ElementAt(3).dDimension); - // } - // } - // } - // DataUpdateSash args = new DataUpdateSash() - // { - // currSash = CurrSashGroup, - // noSvg = false - // }; - // await EC_UpdateSashGroup.InvokeAsync(args); - //} + private Task ChangeTypeDimension() + { + CurrSashGroup.bIsDimensionLight = !CurrSashGroup.bIsDimensionLight; + foreach (var CurrSashDim in CurrSashGroup.SashList) + { + if (CurrSashDim.SelMeasureType is MeasureTypes.ABSOLUTE) + { + if (CurrSashGroup.bIsDimensionLight) + { + CurrSashDim.SetDimensionLight(CurrSashDim.dDimension - + CurrSashDim.ElementDimensionList.ElementAt(1).dDimension - + CurrSashDim.ElementDimensionList.Last().dDimension); + } + else + { + CurrSashDim.SetDimensionLight(CurrSashDim.dDimension + + CurrSashDim.ElementDimensionList.ElementAt(1).dDimension + + CurrSashDim.ElementDimensionList.Last().dDimension); + } + } + } + DataUpdateSash args = new DataUpdateSash() + { + currSash = CurrSashGroup, + noSvg = false + }; + return EC_UpdateSashGroup.InvokeAsync(args); + } /// /// Metodo per scegliere tipo di misura @@ -288,7 +287,7 @@ namespace WebWindowComplex.Compo } /// - /// Metodo per aggiornare sash + /// Metodo per aggiornare sash group /// /// /// @@ -309,9 +308,27 @@ namespace WebWindowComplex.Compo } /// - /// Metodo per aggiornare sash + /// Metodo per aggiornare sash group /// - /// + /// + /// + protected async Task UpdateBottomRail(DataBottomRail updRec) + { + if (updRec.sash != null) + { + CurrSashGroup = updRec.sash; + var args = new DataUpdateSash + { + currSash = CurrSashGroup + }; + await EC_UpdateSashGroup.InvokeAsync(args); + } + } + + /// + /// Metodo per aggiornare bottom rail + /// + /// /// protected async Task UpdateBottomRail(ElementDimension updRec) { @@ -327,6 +344,11 @@ namespace WebWindowComplex.Compo } } + /// + /// Metodo per resettare dizionario richiesto + /// + /// + /// protected Task ResetDict(DataUpdateRes args) { return EC_ReqResetDict.InvokeAsync(args); @@ -358,7 +380,7 @@ namespace WebWindowComplex.Compo /// /// Aggiornamento opzioni hardware /// - /// + /// /// private async Task UpdateOpt(DataUpdateHwOption argsHw) { @@ -368,40 +390,28 @@ namespace WebWindowComplex.Compo { // cerco il record var currRec = CurrSashGroup.HwOptionList.FirstOrDefault(x => x.sName == AGBOptCombo.sName && x.sDescription == AGBOptCombo.sDescription); - // lo aggiorno - if (AGBOptCombo != null) - { - currRec = AGBOptCombo; - var args = new DataUpdateSash - { - currSash = CurrSashGroup - }; - await EC_UpdateSashGroup.InvokeAsync(args); - await EC_ReqOptionHw.InvokeAsync(CurrSashGroup); - } + currRec = AGBOptCombo; } - else + else if(AGBOptText != null) { // cerco il record var currRec = CurrSashGroup.HwOptionList.FirstOrDefault(x => x.sName == AGBOptText.sName && x.sDescription == AGBOptText.sDescription); - // lo aggiorno - if (AGBOptText != null) + currRec = AGBOptText; + } + if(AGBOptCombo != null || AGBOptText != null) + { + var args = new DataUpdateSash { - currRec = AGBOptText; - var args = new DataUpdateSash - { - currSash = CurrSashGroup - }; - await EC_UpdateSashGroup.InvokeAsync(args); - await EC_ReqOptionHw.InvokeAsync(CurrSashGroup); - } + currSash = CurrSashGroup + }; + await EC_UpdateSashGroup.InvokeAsync(args); + await EC_ReqOptionHw.InvokeAsync(CurrSashGroup); } } /// /// Prima chiamata hw option list /// - /// /// private Task FirstHwOptionList() { @@ -409,16 +419,6 @@ namespace WebWindowComplex.Compo return EC_ReqFirstOptionHw.InvokeAsync(CurrSashGroup); } - private string ButtonMeasureCss(MeasureTypes type) - { - foreach(var item in CurrSashGroup.SashList) - { - if (!item.SelMeasureType.Equals(type)) - return "btn btn-outline-secondary btn-sm"; - } - return "btn btn-secondary btn-sm"; - } - private bool isOpen = false; private void ToggleDropdown() { diff --git a/WebWindowComplex/Compo/CardSplit.razor b/WebWindowComplex/Compo/CardSplit.razor index 7d3f8f9..3f5db0a 100644 --- a/WebWindowComplex/Compo/CardSplit.razor +++ b/WebWindowComplex/Compo/CardSplit.razor @@ -181,7 +181,7 @@
Element vert
- @foreach (var element in CurrSplit.ElemDimVertList) + @foreach (var element in vertList()) { } @@ -193,7 +193,7 @@
Element horiz
- @foreach (var element in CurrSplit.ElemDimHorizList) + @foreach (var element in horizList()) { } diff --git a/WebWindowComplex/Compo/CardSplit.razor.cs b/WebWindowComplex/Compo/CardSplit.razor.cs index 95c5e5a..e80a4db 100644 --- a/WebWindowComplex/Compo/CardSplit.razor.cs +++ b/WebWindowComplex/Compo/CardSplit.razor.cs @@ -196,12 +196,34 @@ namespace WebWindowComplex.Compo /// private async Task UpdateElement(SplitElementDimension updRec) { - // cerco il record - var currRec = CurrSplit.ElemDimHorizList.FirstOrDefault(x => x.ParentArea == updRec.ParentArea && x.nIndex == updRec.nIndex); - // lo aggiorno if (updRec != null) { - currRec = updRec; + SplitElementDimension? currRec = new SplitElementDimension(null, 0,0,-1); + if (updRec.nSubArea != 0) + { + List ElemIndexList = new List(); + if (CurrSplit.bSplitStartVert) + ElemIndexList = CurrSplit.ElemDimHorizList + .Where(x => x.nSubArea != updRec.nSubArea && x.nIndex == updRec.nIndex) + .ToList(); + else + ElemIndexList = CurrSplit.ElemDimVertList + .Where(x => x.nSubArea == updRec.nSubArea && x.nIndex == updRec.nIndex) + .ToList(); + foreach (var item in ElemIndexList) + { + item.dDimension = updRec.dDimension; + } + } + else + { + if(CurrSplit.bSplitStartVert) + currRec = CurrSplit.ElemDimVertList.FirstOrDefault(x => x.ParentArea == updRec.ParentArea && x.nIndex == updRec.nIndex); + else + currRec = CurrSplit.ElemDimHorizList.FirstOrDefault(x => x.ParentArea == updRec.ParentArea && x.nIndex == updRec.nIndex); + // lo aggiorno + currRec = updRec; + } var args = new DataUpdateSplit() { currSplit = CurrSplit, @@ -331,6 +353,18 @@ namespace WebWindowComplex.Compo }; return EC_UpdateSplit.InvokeAsync(args); } + + private List horizList() + { + int subAreaMin = CurrSplit.ElemDimHorizList.Min(x => x.nSubArea); + return CurrSplit.ElemDimHorizList.Where(x => x.nSubArea == subAreaMin).ToList(); + } + + private List vertList() + { + int subAreaMin = CurrSplit.ElemDimVertList.Min(x => x.nSubArea); + return CurrSplit.ElemDimVertList.Where(x => x.nSubArea == subAreaMin).ToList(); + } } /// diff --git a/WebWindowComplex/Compo/EditElement.razor.cs b/WebWindowComplex/Compo/EditElement.razor.cs index 14fd91c..ba82bbd 100644 --- a/WebWindowComplex/Compo/EditElement.razor.cs +++ b/WebWindowComplex/Compo/EditElement.razor.cs @@ -30,7 +30,7 @@ namespace WebWindowComplex.Compo #region Private Properties /// - /// Metodo per aggiornare element corrente + /// Metodo per aggiornare nome element corrente /// private string name() { diff --git a/WebWindowComplex/Compo/EditSplitElement.razor b/WebWindowComplex/Compo/EditSplitElement.razor index d120612..2b7c6fa 100644 --- a/WebWindowComplex/Compo/EditSplitElement.razor +++ b/WebWindowComplex/Compo/EditSplitElement.razor @@ -1,6 +1,6 @@ @using static WebWindowComplex.LayoutConst
- @name() + @CurrRec.nIndex @if (User) { diff --git a/WebWindowComplex/Compo/EditSplitElement.razor.cs b/WebWindowComplex/Compo/EditSplitElement.razor.cs index 2a94a83..8256c5d 100644 --- a/WebWindowComplex/Compo/EditSplitElement.razor.cs +++ b/WebWindowComplex/Compo/EditSplitElement.razor.cs @@ -8,7 +8,7 @@ namespace WebWindowComplex.Compo #region Public Properties /// - /// Joint corrente + /// Element corrente /// [Parameter] public SplitElementDimension CurrRec { get; set; } = null!; @@ -42,14 +42,15 @@ namespace WebWindowComplex.Compo } } } - private string name() - { - string ans = ""; - if (CurrRec.nSubArea > 0) - ans = ans + "A:" + CurrRec.nSubArea + ", "; - ans = ans + "N:" + CurrRec.nIndex; - return ans; - } + + //private string name() + //{ + // string ans = ""; + // if (CurrRec.nSubArea > 0) + // ans = ans + "A:" + CurrRec.nSubArea + ", "; + // ans = ans + "N:" + CurrRec.nIndex; + // return ans; + //} #endregion Private Properties } diff --git a/WebWindowComplex/Compo/FrameBottomRail.razor.cs b/WebWindowComplex/Compo/FrameBottomRail.razor.cs index bf3abbe..ff50155 100644 --- a/WebWindowComplex/Compo/FrameBottomRail.razor.cs +++ b/WebWindowComplex/Compo/FrameBottomRail.razor.cs @@ -21,7 +21,7 @@ namespace WebWindowComplex.Compo #region Private Properties /// - /// Aggiornamento element + /// Aggiornamento element Bottom Rail /// /// /// diff --git a/WebWindowComplex/Compo/SashBottomRail.razor.cs b/WebWindowComplex/Compo/SashBottomRail.razor.cs index 37a7306..4846335 100644 --- a/WebWindowComplex/Compo/SashBottomRail.razor.cs +++ b/WebWindowComplex/Compo/SashBottomRail.razor.cs @@ -14,7 +14,7 @@ namespace WebWindowComplex.Compo public Sash SashGroup { get; set; } = null!; [Parameter] - public EventCallback EC_UpdateSash { get; set; } + public EventCallback EC_UpdateSash { get; set; } #endregion Public Properties @@ -33,12 +33,7 @@ namespace WebWindowComplex.Compo if (updRec != null) { currRec = updRec; - DataUpdateProfile ans = new DataUpdateProfile - { - sash = SashGroup, - reqProfile = false - }; - await EC_UpdateSash.InvokeAsync(ans); + await EC_UpdateSash.InvokeAsync(SashGroup); } } diff --git a/WebWindowComplex/Json/JsonUtility.cs b/WebWindowComplex/Json/JsonUtility.cs index b8cecc9..32e9ffa 100644 --- a/WebWindowComplex/Json/JsonUtility.cs +++ b/WebWindowComplex/Json/JsonUtility.cs @@ -305,13 +305,23 @@ namespace WebWindowComplex.Json newFrame.SetSelThresholdFromName(m_Threshold); newFrame.SetBottomRail(m_bBottomRail); newFrame.SetBottomRailQty(m_nBottomRailQty); - for (int i = 0; i < m_nBottomRailQty; i++) + if(m_nBottomRailQty > 1) { - newFrame.BottomRailElemDimList.Add(new ElementDimension(newFrame, BottomRailElemDimList[i].Index, BottomRailElemDimList[i].Value)); - newFrame.BottomRailElemDimList.ElementAt(i).SetNameElement("Frame_Rail_Bottom"); + for (int i = 0; i < m_nBottomRailQty-1; i++) + { + newFrame.BottomRailElemDimList.Add(new ElementDimension(newFrame, BottomRailElemDimList[i].Index, BottomRailElemDimList[i].Value)); + newFrame.BottomRailElemDimList.ElementAt(i).SetNameElement("Frame_Rail"); + newFrame.BottomRailElemDimList.ElementAt(i).SetMinDimension(Window.m_ParameterList.GetValueOrDefault(newFrame.BottomRailElemDimList.ElementAt(i).sName + "_DimMin")); + newFrame.BottomRailElemDimList.ElementAt(i).SetMaxDimension(Window.m_ParameterList.GetValueOrDefault(newFrame.BottomRailElemDimList.ElementAt(i).sName + "_DimMax")); + } + } + if (m_nBottomRailQty > 0) + { + newFrame.BottomRailElemDimList.Add(new ElementDimension(newFrame, BottomRailElemDimList.Last().Index, BottomRailElemDimList.Last().Value)); + newFrame.BottomRailElemDimList.Last().SetNameElement("Frame_Fill_Rail"); + newFrame.BottomRailElemDimList.Last().SetMinDimension(Window.m_ParameterList.GetValueOrDefault(newFrame.BottomRailElemDimList.Last().sName + "_DimMin")); + newFrame.BottomRailElemDimList.Last().SetMaxDimension(Window.m_ParameterList.GetValueOrDefault(newFrame.BottomRailElemDimList.Last().sName + "_DimMax")); } - if(m_nBottomRailQty > 0) - newFrame.BottomRailElemDimList.ElementAt(m_nBottomRailQty - 1).SetNameElement("Frame_Fill_Rail"); //if(ArcElement != null) // newFrame.SetFrameArcElem(ArcElement.Deserialize(newFrame, ParentWindow)); //Frame.AppliedDone(); @@ -349,19 +359,19 @@ namespace WebWindowComplex.Json } } - //private bool m_bIsDimensionLight; - //[JsonProperty] - //public bool IsDimensionLight - //{ - // get - // { - // return m_bIsDimensionLight; - // } - // set - // { - // m_bIsDimensionLight = value; - // } - //} + private bool m_bIsDimensionLight; + [JsonProperty] + public bool IsDimensionLight + { + get + { + return m_bIsDimensionLight; + } + set + { + m_bIsDimensionLight = value; + } + } private List m_SashList = new List(); [JsonProperty] @@ -476,10 +486,10 @@ namespace WebWindowComplex.Json { } - public JsonSash(bool IsSashVertical, SashTypes SashType, bool SashBottomRail, int SashBottomRailQty, string Hardware, int GroupId) : base(AreaTypes.SASH) + public JsonSash(bool IsSashVertical, SashTypes SashType, bool SashBottomRail, int SashBottomRailQty, string Hardware, int GroupId, bool IsDimensionLight = false) : base(AreaTypes.SASH) { m_bIsSashVertical = IsSashVertical; - //m_bIsDimensionLight = IsDimensionLight; + m_bIsDimensionLight = IsDimensionLight; m_SashType = SashType; m_bBottomRail = SashBottomRail; m_nBottomRailQty = SashBottomRailQty; @@ -492,18 +502,28 @@ namespace WebWindowComplex.Json Sash newSash = new Sash(ParentArea, ParentWindow); newSash.SetGroupId(GroupId); newSash.SetAreaType(AreaTypes.SASH); - //newSash.SetIsDimensionLight(IsDimensionLight); + newSash.SetIsDimensionLight(IsDimensionLight); newSash.SetSashQty(m_SashList.Count); newSash.SetIsSashVertical(m_bIsSashVertical); newSash.SetSashBottomRail(m_bBottomRail); newSash.SetSashBottomRailQty(m_nBottomRailQty); - for(int i = 0; i < m_nBottomRailQty; i++) + if (m_nBottomRailQty > 1) { - newSash.BottomRailElemDimList.Add(new ElementDimension(newSash, BottomRailElemDimList[i].Index, BottomRailElemDimList[i].Value)); - newSash.BottomRailElemDimList.ElementAt(i).SetNameElement("Sash_Rail_Bottom"); + for (int i = 0; i < m_nBottomRailQty - 1; i++) + { + newSash.BottomRailElemDimList.Add(new ElementDimension(newSash, BottomRailElemDimList[i].Index, BottomRailElemDimList[i].Value)); + newSash.BottomRailElemDimList.ElementAt(i).SetNameElement("Sash_Rail"); + newSash.BottomRailElemDimList.ElementAt(i).SetMinDimension(Window.m_ParameterList.GetValueOrDefault(newSash.BottomRailElemDimList.ElementAt(i).sName + "_DimMin")); + newSash.BottomRailElemDimList.ElementAt(i).SetMaxDimension(Window.m_ParameterList.GetValueOrDefault(newSash.BottomRailElemDimList.ElementAt(i).sName + "_DimMax")); + } } if (m_nBottomRailQty > 0) - newSash.BottomRailElemDimList.ElementAt(m_nBottomRailQty - 1).SetNameElement("Sash_Fill_Rail"); + { + newSash.BottomRailElemDimList.Add(new ElementDimension(newSash, BottomRailElemDimList.Last().Index, BottomRailElemDimList.Last().Value)); + newSash.BottomRailElemDimList.Last().SetNameElement("Sash_Fill_Rail"); + newSash.BottomRailElemDimList.Last().SetMinDimension(Window.m_ParameterList.GetValueOrDefault(newSash.BottomRailElemDimList.Last().sName + "_DimMin")); + newSash.BottomRailElemDimList.Last().SetMaxDimension(Window.m_ParameterList.GetValueOrDefault(newSash.BottomRailElemDimList.Last().sName + "_DimMax")); + } for (var SashIndex = 0; SashIndex <= m_SashList.Count - 1; SashIndex++) { newSash.SashList[SashIndex].SetOpeningType(m_SashList[SashIndex].OpeningType); @@ -641,7 +661,9 @@ namespace WebWindowComplex.Json split.SplitVertList[SplitIndex].SetDimension(m_SplitVertList[SplitIndex].Dimension); split.SplitVertList[SplitIndex].SetMeasureType(m_SplitVertList[SplitIndex].MeasureType); } - for (int index = 0; index < ElementDimVertList.Count; index++) + int subAreaMin = ElementDimVertList.Min(x => x.Area); + List vertList = ElementDimVertList.Where(x => x.Area == subAreaMin).ToList(); + for (int index = 0; index < vertList.Count; index++) { split.ElemDimVertList.ElementAt(index).SetSubArea(m_ElemDimVertList[index].Area); split.ElemDimVertList.ElementAt(index).SetIndex(m_ElemDimVertList[index].Index); @@ -659,7 +681,9 @@ namespace WebWindowComplex.Json split.SplitHorizList[SplitIndex].SetDimension(m_SplitHorizList[SplitIndex].Dimension); split.SplitHorizList[SplitIndex].SetMeasureType(m_SplitHorizList[SplitIndex].MeasureType); } - for (int index = 0; index < ElementDimHorizList.Count; index++) + int subAreaMin = ElementDimHorizList.Min(x => x.Area); + List horizList = ElementDimHorizList.Where(x => x.Area == subAreaMin).ToList(); + for (int index = 0; index < horizList.Count; index++) { split.ElemDimHorizList.ElementAt(index).SetSubArea(m_ElemDimHorizList[index].Area); split.ElemDimHorizList.ElementAt(index).SetIndex(m_ElemDimHorizList[index].Index); diff --git a/WebWindowComplex/Models/Area.cs b/WebWindowComplex/Models/Area.cs index 1b521e9..1b3eeef 100644 --- a/WebWindowComplex/Models/Area.cs +++ b/WebWindowComplex/Models/Area.cs @@ -101,9 +101,14 @@ namespace WebWindowComplex.Models public void AddFirstSash() { // Salvo il parent - Area ParentArea = AreaList[0].ParentArea; + if(this is Frame) + { + Frame f = (Frame)this; + f.BottomRailQty = 0; + f.BottomRailElemDimList.Clear(); + } // Creo area sash di default - Sash SashArea = Sash.CreateSash(ParentArea); + Sash SashArea = Sash.CreateSash(this); // Inserisco famiglia hardware vuota SashArea.SetSelFamilyHardware(""); // Inserisco hardware di default diff --git a/WebWindowComplex/Models/Frame.cs b/WebWindowComplex/Models/Frame.cs index e5fae04..25b8a7f 100644 --- a/WebWindowComplex/Models/Frame.cs +++ b/WebWindowComplex/Models/Frame.cs @@ -97,17 +97,36 @@ namespace WebWindowComplex.Models } set { - if (m_nBottomRailQty >= 0) + if (value >= 0) { if(value > m_nBottomRailQty) { - // Aggiungo un element + // Aggiungo un element in coda BottomRailElemDimList.Add(new ElementDimension(this, BottomRailElemDimList.Count + 1, 78)); + BottomRailElemDimList.Last().SetNameElement("Frame_Fill_Rail"); + BottomRailElemDimList.Last().SetMinDimension(Window.m_ParameterList.GetValueOrDefault(BottomRailElemDimList.Last().sName + "_DimMin")); + BottomRailElemDimList.Last().SetMaxDimension(Window.m_ParameterList.GetValueOrDefault(BottomRailElemDimList.Last().sName + "_DimMax")); + BottomRailElemDimList.Last().SetDimension(Window.m_ParameterList.GetValueOrDefault(BottomRailElemDimList.Last().sName + "_DimStd")); + if (value > 1 && BottomRailElemDimList.Count - 2 >= 0) + { + BottomRailElemDimList.ElementAt(BottomRailElemDimList.Count - 2).SetNameElement("Frame_Rail"); + BottomRailElemDimList.ElementAt(BottomRailElemDimList.Count - 2).SetMinDimension(Window.m_ParameterList.GetValueOrDefault(BottomRailElemDimList.ElementAt(BottomRailElemDimList.Count - 2).sName + "_DimMin")); + BottomRailElemDimList.ElementAt(BottomRailElemDimList.Count - 2).SetMaxDimension(Window.m_ParameterList.GetValueOrDefault(BottomRailElemDimList.ElementAt(BottomRailElemDimList.Count - 2).sName + "_DimMax")); + BottomRailElemDimList.ElementAt(BottomRailElemDimList.Count - 2).SetDimension(BottomRailElemDimList.ElementAt(BottomRailElemDimList.Count - 2).dDimension); + } } else if (value < m_nBottomRailQty) { - // Elimino un element - BottomRailElemDimList.RemoveAt(BottomRailElemDimList.Count - 1); + // Elimino gli element + for(int i = BottomRailElemDimList.Count-1; i == value; i--) + BottomRailElemDimList.RemoveAt(i); + if (value >= 1) + { + BottomRailElemDimList.Last().SetNameElement("Frame_Fill_Rail"); + BottomRailElemDimList.Last().SetMinDimension(Window.m_ParameterList.GetValueOrDefault(BottomRailElemDimList.Last().sName + "_DimMin")); + BottomRailElemDimList.Last().SetMaxDimension(Window.m_ParameterList.GetValueOrDefault(BottomRailElemDimList.Last().sName + "_DimMax")); + BottomRailElemDimList.Last().SetDimension(BottomRailElemDimList.Last().dDimension); + } } m_nBottomRailQty = value; if (value > 0) diff --git a/WebWindowComplex/Models/Sash.cs b/WebWindowComplex/Models/Sash.cs index 0695cf6..f58a2f3 100644 --- a/WebWindowComplex/Models/Sash.cs +++ b/WebWindowComplex/Models/Sash.cs @@ -451,11 +451,30 @@ namespace WebWindowComplex.Models { // Aggiungo un element BottomRailElemDimList.Add(new ElementDimension(this, BottomRailElemDimList.Count + 1, 78)); + BottomRailElemDimList.Last().SetNameElement("Sash_Fill_Rail"); + BottomRailElemDimList.Last().SetMinDimension(Window.m_ParameterList.GetValueOrDefault(BottomRailElemDimList.Last().sName + "_DimMin")); + BottomRailElemDimList.Last().SetMaxDimension(Window.m_ParameterList.GetValueOrDefault(BottomRailElemDimList.Last().sName + "_DimMax")); + BottomRailElemDimList.Last().SetDimension(Window.m_ParameterList.GetValueOrDefault(BottomRailElemDimList.Last().sName + "_DimStd")); + if (value > 1 && BottomRailElemDimList.Count - 2 >= 0) + { + BottomRailElemDimList.ElementAt(BottomRailElemDimList.Count - 2).SetNameElement("Sash_Rail"); + BottomRailElemDimList.ElementAt(BottomRailElemDimList.Count - 2).SetMinDimension(Window.m_ParameterList.GetValueOrDefault(BottomRailElemDimList.ElementAt(BottomRailElemDimList.Count - 2).sName + "_DimMin")); + BottomRailElemDimList.ElementAt(BottomRailElemDimList.Count - 2).SetMaxDimension(Window.m_ParameterList.GetValueOrDefault(BottomRailElemDimList.ElementAt(BottomRailElemDimList.Count - 2).sName + "_DimMax")); + BottomRailElemDimList.ElementAt(BottomRailElemDimList.Count - 2).SetDimension(BottomRailElemDimList.ElementAt(BottomRailElemDimList.Count - 2).dDimension); + } } else if (value < m_nSashBottomRailQty) { - // Elimino un element - BottomRailElemDimList.RemoveAt(BottomRailElemDimList.Count - 1); + // Elimino gli element + for (int i = BottomRailElemDimList.Count - 1; i == value; i--) + BottomRailElemDimList.RemoveAt(i); + if (value >= 1) + { + BottomRailElemDimList.Last().SetNameElement("Sash_Fill_Rail"); + BottomRailElemDimList.Last().SetMinDimension(Window.m_ParameterList.GetValueOrDefault(BottomRailElemDimList.Last().sName + "_DimMin")); + BottomRailElemDimList.Last().SetMaxDimension(Window.m_ParameterList.GetValueOrDefault(BottomRailElemDimList.Last().sName + "_DimMax")); + BottomRailElemDimList.Last().SetDimension(BottomRailElemDimList.Last().dDimension); + } } m_nSashBottomRailQty = value; if (m_nSashBottomRailQty > 0) @@ -835,7 +854,7 @@ namespace WebWindowComplex.Models if (nCounterGroup < GroupId) Area.nCounterGroup = GroupId; string currHwId = hideHw ? CustomHwId : m_SelHardware!.Id; - JsonSash JsonSash = new JsonSash(m_bIsSashVertical, m_SashType, m_bSashBottomRail, m_nSashBottomRailQty, currHwId, GroupId); + JsonSash JsonSash = new JsonSash(m_bIsSashVertical, m_SashType, m_bSashBottomRail, m_nSashBottomRailQty, currHwId, GroupId, bIsDimensionLight); foreach (var SashDimension in SashList) JsonSash.SashList.Add(SashDimension.Serialize()); foreach (var BottomRailDim in BottomRailElemDimList) diff --git a/WebWindowComplex/Models/Split.cs b/WebWindowComplex/Models/Split.cs index 14acccb..ebaa969 100644 --- a/WebWindowComplex/Models/Split.cs +++ b/WebWindowComplex/Models/Split.cs @@ -432,17 +432,6 @@ namespace WebWindowComplex.Models m_ElemDimVertList = value; } } - public List SplitPositionList - { - get - { - return m_SplitPositionList; - } - set - { - m_SplitPositionList = value; - } - } public List SplitShapeList { @@ -531,34 +520,6 @@ namespace WebWindowComplex.Models } } - public bool OnlySashChild() - { - foreach (var areaSplitted in AreaList) - { - if (!(areaSplitted.AreaList.FirstOrDefault()?.AreaType is AreaTypes.SASH)) - return false; - } - return true; - } - public bool MinOneSashChild() - { - foreach (var areaSplitted in AreaList) - { - if (areaSplitted.AreaList.FirstOrDefault()?.AreaType is AreaTypes.SASH) - return true; - } - return false; - } - public bool SashChildSxOrDx() - { - foreach (var areaSplitted in AreaList) - { - if (areaSplitted.AreaList.FirstOrDefault()?.AreaType is AreaTypes.SASH) - return true; - } - return false; - } - #endregion Public Methods #region Internal Properties @@ -597,10 +558,20 @@ namespace WebWindowComplex.Models JsonSplit.SplitVertList.Add(SplitVert.Serialize()); foreach (var SplitHoriz in m_SplitHorizList) JsonSplit.SplitHorizList.Add(SplitHoriz.Serialize()); - foreach (var Elem in m_ElemDimHorizList) - JsonSplit.ElementDimHorizList.Add(Elem.Serialize()); - foreach (var Elem in m_ElemDimVertList) - JsonSplit.ElementDimVertList.Add(Elem.Serialize()); + if(m_ElemDimHorizList != null && m_ElemDimHorizList.Count > 0) + { + int subAreaMinHoriz = m_ElemDimHorizList.Min(x => x.nSubArea); + List horizList = m_ElemDimHorizList.Where(x => x.nSubArea == subAreaMinHoriz).ToList(); + foreach (var Elem in horizList) + JsonSplit.ElementDimHorizList.Add(Elem.Serialize()); + } + if (m_ElemDimVertList != null && m_ElemDimVertList.Count > 0) + { + int subAreaMinVert = m_ElemDimVertList.Min(x => x.nSubArea); + List vertList = m_ElemDimVertList.Where(x => x.nSubArea == subAreaMinVert).ToList(); + foreach (var Elem in vertList.ToList()) + JsonSplit.ElementDimVertList.Add(Elem.Serialize()); + } foreach (var Area in AreaList) JsonSplit.AreaList.Add(Area.Serialize(hideHw)); return JsonSplit; @@ -636,12 +607,19 @@ namespace WebWindowComplex.Models } else { + // Un Elemento per ogni dimensione principale e secondaria + //int subArea = 1; + //if (!bSplitStartVert) + // subArea = 0; + //for (int i = 0; i < QtyHoriz; i++) + // ElemDimHorizList.Add(new SplitElementDimension(this, i + 1, 78, subArea)); + // Un Elemento per ogni dimensione principale e per ogni sotto dimensione if (bSplitStartVert) { - for(int subArea = 0; subArea <= QtyVert; subArea++) + for (int subArea = 0; subArea <= QtyVert; subArea++) { for (int i = 0; i < QtyHoriz; i++) - ElemDimHorizList.Add(new SplitElementDimension(this, i + 1, 78, subArea+1)); + ElemDimHorizList.Add(new SplitElementDimension(this, i + 1, 78, subArea + 1)); } } else @@ -682,6 +660,13 @@ namespace WebWindowComplex.Models } else { + // Un Elemento per ogni dimensione principale e secondaria + //int subArea = 0; + //if (!bSplitStartVert) + // subArea = 1; + //for (int i = 0; i < QtyVert; i++) + // ElemDimVertList.Add(new SplitElementDimension(this, i + 1, 78, subArea)); + // Un Elemento per ogni dimensione principale e per ogni sotto dimensione if (bSplitStartVert) { for (int i = 0; i < QtyVert; i++) @@ -689,12 +674,12 @@ namespace WebWindowComplex.Models } else { - for(int subArea = 0; subArea <= QtyHoriz; subArea++) + for (int subArea = 0; subArea <= QtyHoriz; subArea++) { for (int i = 0; i < QtyVert; i++) - ElemDimVertList.Add(new SplitElementDimension(this, i+1, 78, subArea + 1)); + ElemDimVertList.Add(new SplitElementDimension(this, i + 1, 78, subArea + 1)); } - } + } } } diff --git a/WebWindowComplex/TableComp.razor.cs b/WebWindowComplex/TableComp.razor.cs index 5900a51..1ccc5ba 100644 --- a/WebWindowComplex/TableComp.razor.cs +++ b/WebWindowComplex/TableComp.razor.cs @@ -1171,7 +1171,7 @@ namespace WebWindowComplex ///
/// Lista dei profili /// Id Area che si sta cercando - /// Id dell'anta (se -1 non usare) + /// Id dell'anta o dello split (se -1 non usare) /// private void UpdateProfileElement(List profileNameList, int GroupIdSearch, int EntityIdSearch) { @@ -1615,7 +1615,6 @@ namespace WebWindowComplex return "btn btn-secondary btn-sm"; } - /// /// Metodo per ottenere lista groupId /// @@ -1632,6 +1631,7 @@ namespace WebWindowComplex } } } + #endregion Private Methods } } \ No newline at end of file diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index 9c174f1..0e2e989 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 3.1.2.510 + 3.1.2.617 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -75,6 +75,26 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index aaebafe..3c163ca 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 3.1.2.510 + 3.1.2.617 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -99,5 +99,6 @@ +