From de2f4ed9e9886e0b34aec9a5cc5f137000707211 Mon Sep 17 00:00:00 2001 From: Annamaria Sassi Date: Wed, 26 Nov 2025 17:07:25 +0100 Subject: [PATCH] Aggiornato modo per sollevare eventi di SashGroup, SashDimension --- README.md | 1 + WebWindowComplex/Compo/AreaHwOption.razor.cs | 28 ++- WebWindowComplex/Compo/AreaSash.razor | 10 +- WebWindowComplex/Compo/AreaSash.razor.cs | 117 +++++---- WebWindowComplex/Compo/CardFrame.razor | 2 +- WebWindowComplex/Compo/CardSashGroup.razor | 22 +- WebWindowComplex/Compo/CardSashGroup.razor.cs | 233 ++++++++++++------ WebWindowComplex/Compo/CardSplit.razor | 4 +- WebWindowComplex/Compo/CardSplit.razor.cs | 38 ++- WebWindowComplex/Models/Area.cs | 5 +- WebWindowComplex/Models/Sash.cs | 42 +--- WebWindowComplex/Models/SashDimension.cs | 1 - WebWindowComplex/Models/Window.cs | 40 +-- WebWindowComplex/TableComp.razor | 33 ++- WebWindowComplex/TableComp.razor.cs | 148 +++-------- WebWindowComplex/WebWindowComplex.csproj | 6 +- .../WebWindowConfigurator.csproj | 10 +- 17 files changed, 368 insertions(+), 372 deletions(-) diff --git a/README.md b/README.md index 2c3d7ea..abf39d1 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,7 @@ La richiesta della forma del gruppo di ante viene trasmessa se si cambiano i seg - Forma del telaio; - Dimensioni del telaio; - Aggiunta di uno split nel frame se già presente un gruppo di ante; + - Se si effettua lo scambio delle aree di uno split e una delle aree contiene una sash - Eliminazione di uno split. La lista degli hardware viene aggiornata se si cambiano i seguenti parametri: diff --git a/WebWindowComplex/Compo/AreaHwOption.razor.cs b/WebWindowComplex/Compo/AreaHwOption.razor.cs index 1b352fc..ae1f6ff 100644 --- a/WebWindowComplex/Compo/AreaHwOption.razor.cs +++ b/WebWindowComplex/Compo/AreaHwOption.razor.cs @@ -14,17 +14,11 @@ namespace WebWindowComplex.Compo [CascadingParameter(Name = "CurrSashGroup")] public Sash CurrSashGroup { get; set; } = null!; - /// - /// Evento per aggiornare gli hardware option di tipo combo - /// - [Parameter] - public EventCallback EC_UpdateHwOptCombo { get; set; } - /// /// Evento per aggiornare gli hardware option di tipo text /// [Parameter] - public EventCallback EC_UpdateHwOptText { get; set; } + public EventCallback EC_UpdateHwOpt { get; set; } /// /// Evento per chiamare la prima volta la lista delle opzioni @@ -50,7 +44,7 @@ namespace WebWindowComplex.Compo hwOptCollapsed = !hwOptCollapsed; if (CurrSashGroup.HwOptionList.Count == 0) { - await EC_FirstHwOptionList.InvokeAsync(CurrSashGroup.GroupId); + await EC_FirstHwOptionList.InvokeAsync(); } } @@ -66,7 +60,11 @@ namespace WebWindowComplex.Compo /// private async Task RaiseOptCombo(AGBOptionCombo updRec) { - await EC_UpdateHwOptCombo.InvokeAsync(updRec); + var args = new DataUpdateHwOption + { + AGBOptCombo = updRec + }; + await EC_UpdateHwOpt.InvokeAsync(args); } /// @@ -76,11 +74,21 @@ namespace WebWindowComplex.Compo /// private async Task RaiseOptText(AGBOptionText updRec) { - await EC_UpdateHwOptText.InvokeAsync(updRec); + var args = new DataUpdateHwOption + { + AGBOptText = updRec + }; + await EC_UpdateHwOpt.InvokeAsync(args); } private bool IsLoadingHwOpt { get => IsLoading != null && IsLoading.Count > 0 && IsLoading.Contains("LoadHwOpt"); } } + + public class DataUpdateHwOption + { + public AGBOptionText AGBOptText { get; set; } = null; + public AGBOptionCombo AGBOptCombo { get; set; } = null; + } } \ No newline at end of file diff --git a/WebWindowComplex/Compo/AreaSash.razor b/WebWindowComplex/Compo/AreaSash.razor index f116fcc..5961b19 100644 --- a/WebWindowComplex/Compo/AreaSash.razor +++ b/WebWindowComplex/Compo/AreaSash.razor @@ -16,8 +16,8 @@ int IndexCopy = k; int IndexModify = IndexSash;
  • -
  • } @@ -67,7 +67,7 @@
    - +
    @@ -153,7 +153,7 @@ else @if (!(CurrAnta.AreaList[0] is Split)) {
    - +
    @@ -203,7 +203,7 @@ else
    - +
    diff --git a/WebWindowComplex/Compo/AreaSash.razor.cs b/WebWindowComplex/Compo/AreaSash.razor.cs index 08d955e..85a5381 100644 --- a/WebWindowComplex/Compo/AreaSash.razor.cs +++ b/WebWindowComplex/Compo/AreaSash.razor.cs @@ -21,6 +21,12 @@ namespace WebWindowComplex.Compo [Parameter] public SashDimension CurrSashDim { get; set; } = null!; + /// + /// Sash group corrente + /// + [CascadingParameter(Name = "SashList")] + public List SashList { get; set; } = null!; + /// /// Sash dimension corrente /// @@ -33,26 +39,21 @@ namespace WebWindowComplex.Compo [Parameter] public int IndexSash { get; set; } = 0; - /// - /// Evento per cambiare l'anta su cui � presente la maniglia - /// - [Parameter] - public EventCallback EC_ChangeHandle { get; set; } - /// /// Evento per aggiornare sash dimension /// [Parameter] public EventCallback EC_UpdateSashDim { get; set; } - /// - /// Evento per cambiare l'anta su cui � presente la maniglia - /// - [Parameter] - public EventCallback EC_CopyContentSash { get; set; } /// - /// Evento per cambiare modalit� di visualizzazione + /// Evento per aggiornare sash + /// + [Parameter] + public EventCallback EC_UpdateSash { get; set; } + + /// + /// Evento per cambiare modalità di visualizzazione /// [Parameter] public EventCallback EC_EditView { get; set; } @@ -131,30 +132,76 @@ namespace WebWindowComplex.Compo /// Sollevo evento per cambiare l'anta su cui � presente la maniglia ///
    /// - private async Task RaiseChangeHandle(SashDimension sashDim, Sash currSash) + private async Task ChangeHandle() { - var Args = new DataChangeHandle + // Cerco la Sash che si sta considerando nella lista Sash + var s = SashList.Where(x => x.GroupId == CurrSashGroup.GroupId).FirstOrDefault(); + if (s != null) { - currSashDimension = sashDim, - currItem = currSash, - }; - await EC_ChangeHandle.InvokeAsync(Args); + // Setto la presenza o meno della maniglia per ogni anta + foreach (SashDimension item in s.SashList) + { + if (item.Equals(CurrSashDim)) + { + item.bHasHandle = true; + } + else + { + if (item.bHasHandle) + { + switch (item.SelOpeningType) + { + case Openings.TILTTURN_LEFT: + { + item.SetOpeningType(Openings.TURNONLY_LEFT); + break; + } + case Openings.TILTTURN_RIGHT: + { + item.SetOpeningType(Openings.TURNONLY_RIGHT); + break; + } + default: + { + break; + } + } + } + item.bHasHandle = false; + } + } + } + CurrSashGroup.RefreshHardwareList(); + CurrSashGroup.SetFirstHardware(); + await EC_UpdateSash.InvokeAsync(CurrSashGroup); } /// - /// Sollevo evento per cambiare l'anta su cui � presente la maniglia + /// Copio contenuto anta da indexCopy a IndexModify /// /// - private async Task RaiseCopyContentSash(int indexC, int indexM) + private async Task CopyContentSash(int IndexCopy, int IndexModify) { isOpen = !isOpen; - var Args = new DataCopyContentSash - { - currItem = CurrSashGroup, - indexCopy = indexC, - indexModify = indexM, - }; - await EC_CopyContentSash.InvokeAsync(Args); + // Anta selezionata + Area sashSplitted = CurrSashGroup.AreaList[IndexModify]; + // Rimuovo riempimento da anta selezionata + sashSplitted.AreaList.RemoveAt(0); + // Creo la copia dell'anta scelta + Area a = CurrSashGroup.AreaList[IndexCopy].AreaList.First().Copy(sashSplitted); + // Aggiungo copia all'anta selezionata + CurrSashGroup.AreaList[IndexModify].AreaList.Add(a); + await EC_UpdateSash.InvokeAsync(CurrSashGroup); + } + + /// + /// Metodo per aggiungere lo split nella singola anta + /// + /// + private async Task AddSplitToSash() + { + CurrAnta.AddSplit(); + await EC_UpdateSash.InvokeAsync(CurrSashGroup); } private bool isOpen = false; @@ -215,20 +262,4 @@ namespace WebWindowComplex.Compo public int IndexSashClose { get; set; } } - public class DataChangeHandle - { - public SashDimension currSashDimension { get; set; } = null!; - public Sash currItem { get; set; } = null!; - - } - - public class DataCopyContentSash - { - public Sash currItem { get; set; } = null!; - - public int indexCopy { get; set; } = 0; - - public int indexModify { get; set; } = 0; - - } } \ No newline at end of file diff --git a/WebWindowComplex/Compo/CardFrame.razor b/WebWindowComplex/Compo/CardFrame.razor index a80562e..2fda835 100644 --- a/WebWindowComplex/Compo/CardFrame.razor +++ b/WebWindowComplex/Compo/CardFrame.razor @@ -33,7 +33,7 @@ @foreach (FrameDimension dimension in CurrFrameWindow.DimensionList) { - + }
    diff --git a/WebWindowComplex/Compo/CardSashGroup.razor b/WebWindowComplex/Compo/CardSashGroup.razor index 5c48d4b..0ade146 100644 --- a/WebWindowComplex/Compo/CardSashGroup.razor +++ b/WebWindowComplex/Compo/CardSashGroup.razor @@ -1,10 +1,11 @@ -@using static WebWindowComplex.Json.WindowConst +@using WebWindowComplex.Models +@using static WebWindowComplex.Json.WindowConst
    -
    Sash group @(SashList.Count > 1 ? (CurrIndex + 1) : "")
    +
    Sash group @(SashList.Count > 1 ? (SashList.IndexOf(CurrSashGroup) + 1) : "")
    @@ -21,7 +22,7 @@
    Qty sash - +
    @@ -29,7 +30,7 @@
    - @foreach (var orientationSash in CurrSashGroup.OrientationSashTypeList) { @@ -40,7 +41,7 @@
    Qty bottom rail - +
    @@ -54,7 +55,7 @@
    - @if (Sash.s_FamilyHardwareList == null || Sash.s_FamilyHardwareList.Count == 0) { @@ -92,8 +93,7 @@ }
    -
    @@ -136,9 +136,8 @@
    @@ -148,9 +147,8 @@ } diff --git a/WebWindowComplex/Compo/CardSashGroup.razor.cs b/WebWindowComplex/Compo/CardSashGroup.razor.cs index 3dd1e47..5e4b316 100644 --- a/WebWindowComplex/Compo/CardSashGroup.razor.cs +++ b/WebWindowComplex/Compo/CardSashGroup.razor.cs @@ -8,30 +8,12 @@ namespace WebWindowComplex.Compo { #region Public Properties - /// - /// Indice della sash corrente rispetto alla lista sash - /// - [Parameter] - public int CurrIndex { get; set; } = 0; - /// /// Sash corrente rispetto alla lista Sash /// [CascadingParameter(Name = "CurrSashGroup")] public Sash CurrSashGroup { get; set; } = null!; - /// - /// Evento per cambiare l'anta su cui è presente la maniglia - /// - [Parameter] - public EventCallback EC_ChangeHandle { get; set; } - - /// - /// Evento per cambiare l'anta su cui è presente la maniglia - /// - [Parameter] - public EventCallback EC_CopyContentSash { get; set; } - /// /// Evento per cambiare tutti i fill /// @@ -50,28 +32,16 @@ namespace WebWindowComplex.Compo [Parameter] public EventCallback EC_ReqResetDictShape { get; set; } - /// - /// Evento per cambiare tutti i Joints - /// - [Parameter] - public EventCallback EC_UpdateSash { get; set; } - /// /// Evento per segnalare cambio hw e richiesta calcolo /// [Parameter] - public EventCallback EC_UpdateSashHardware { get; set; } - - /// - /// Evento per richiedere la prima volta le opzioni hardware - /// - [Parameter] - public EventCallback EC_CallFirstHwOpt { get; set; } + public EventCallback EC_UpdatePreview { get; set; } /// /// Lista di sash /// - [Parameter] + [CascadingParameter(Name = "SashList")] public List SashList { get; set; } = null!; #endregion Public Properties @@ -89,7 +59,88 @@ namespace WebWindowComplex.Compo if (CurrSashGroup.SelHardwareFromId != value) { CurrSashGroup.SelHardwareFromId = value; - _ = EC_UpdateSashHardware.InvokeAsync(CurrSashGroup); + var args = new DataUpdateSash + { + currSash = CurrSashGroup, + reqHwOption = true + }; + _ = EC_UpdatePreview.InvokeAsync(args); + } + } + } + + protected int SashBottomRailQty + { + get => CurrSashGroup.SashBottomRailQty; + set + { + if (CurrSashGroup.SashBottomRailQty != value) + { + CurrSashGroup.SashBottomRailQty = value; + if (CurrSashGroup.SashBottomRailQty > 0) + CurrSashGroup.SetSashBottomRail(true); + else + 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 + }; + _ = EC_UpdatePreview.InvokeAsync(args); + } + } + } + + protected int OrientationSashTypeIndex + { + get => CurrSashGroup.SelOrientationSashTypeIndex; + set + { + if (CurrSashGroup.SelOrientationSashTypeIndex != value) + { + CurrSashGroup.SelOrientationSashTypeIndex = value; + var args = new DataUpdateSash() + { + currSash = CurrSashGroup, + reqHwOption = false + }; + _ = EC_UpdatePreview.InvokeAsync(args); + } + } + } + + protected string FamilyHardware + { + get => CurrSashGroup.SelFamilyHardware; + set + { + if (CurrSashGroup.SelFamilyHardware != value) + { + CurrSashGroup.SelFamilyHardware = value; + var args = new DataUpdateSash() + { + currSash = CurrSashGroup, + reqHwOption = false + }; + _ = EC_UpdatePreview.InvokeAsync(args); } } } @@ -117,16 +168,40 @@ namespace WebWindowComplex.Compo { item.SetSelMeasureType(type); } - await EC_UpdateSash.InvokeAsync(CurrSashGroup); + var args = new DataUpdateSash + { + currSash = CurrSashGroup, + reqHwOption = false + }; + await EC_UpdatePreview.InvokeAsync(args); } protected async Task UpdateSashDimension(SashDimension updateSD) { - var currRec = CurrSashGroup.SashList.Where(x => x.nSashId == updateSD.nSashId).FirstOrDefault(); + var currRec = CurrSashGroup.SashList.First(x => x.nSashId == updateSD.nSashId); if(currRec != null) { currRec = updateSD; - await EC_UpdateSash.InvokeAsync(CurrSashGroup); + var args = new DataUpdateSash + { + currSash = CurrSashGroup, + reqHwOption = false + }; + await EC_UpdatePreview.InvokeAsync(args); + } + } + + protected async Task UpdateSash(Sash updateS) + { + if (updateS != null) + { + CurrSashGroup = updateS; + var args = new DataUpdateSash + { + currSash = CurrSashGroup, + reqHwOption = false + }; + await EC_UpdatePreview.InvokeAsync(args); } } @@ -134,24 +209,6 @@ namespace WebWindowComplex.Compo #region Private Methods - /// - /// Sollevo evento per cambiare l'anta su cui è presente la maniglia - /// - /// - private async Task ChangeHandle(DataChangeHandle Args) - { - await EC_ChangeHandle.InvokeAsync(Args); - } - - /// - /// Sollevo evento per cambiare l'anta su cui è presente la maniglia - /// - /// - private async Task CopyContentSash(DataCopyContentSash Args) - { - await EC_CopyContentSash.InvokeAsync(Args); - } - private bool editMode = false; private List currSashDimEdit = new List(); private void EditView(DataChangeMode args) @@ -176,32 +233,41 @@ namespace WebWindowComplex.Compo ///
    /// /// - private async Task UpdateOptCombo(AGBOptionCombo updRec) + private async Task UpdateOpt(DataUpdateHwOption argsHw) { - // cerco il record - var currRec = CurrSashGroup.HwOptionList.FirstOrDefault(x => x.sName == updRec.sName && x.sDescription == updRec.sDescription); - // lo aggiorno - if (updRec != null) + AGBOptionCombo AGBOptCombo = argsHw.AGBOptCombo; + AGBOptionText AGBOptText = argsHw.AGBOptText; + if (AGBOptCombo != null) { - currRec = updRec; - await EC_UpdateSashHardware.InvokeAsync(CurrSashGroup); + // 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, + reqHwOption = true + }; + await EC_UpdatePreview.InvokeAsync(args); + } } - } - - /// - /// Report aggiornamento Option Text - /// - /// - /// - private async Task UpdateOptText(AGBOptionText updRec) - { - // cerco il record - var currRec = CurrSashGroup.HwOptionList.FirstOrDefault(x => x.sName == updRec.sName && x.sDescription == updRec.sDescription); - // lo aggiorno - if (updRec != null) + else { - currRec = updRec; - await EC_UpdateSashHardware.InvokeAsync(CurrSashGroup); + // cerco il record + var currRec = CurrSashGroup.HwOptionList.FirstOrDefault(x => x.sName == AGBOptText.sName && x.sDescription == AGBOptText.sDescription); + // lo aggiorno + if (AGBOptText != null) + { + currRec = AGBOptText; + var args = new DataUpdateSash + { + currSash = CurrSashGroup, + reqHwOption = true + }; + await EC_UpdatePreview.InvokeAsync(args); + } } } @@ -210,9 +276,14 @@ namespace WebWindowComplex.Compo /// /// /// - private async Task FirstHwOptionList(int groupId) + private async Task FirstHwOptionList() { - await EC_CallFirstHwOpt.InvokeAsync(groupId); + var args = new DataUpdateSash + { + currSash = CurrSashGroup, + reqHwOption = true + }; + await EC_UpdatePreview.InvokeAsync(args); } private string ButtonMeasureCss(MeasureTypes type) @@ -232,4 +303,10 @@ namespace WebWindowComplex.Compo } #endregion Private Methods } + + public class DataUpdateSash + { + public Sash currSash { get; set; } = null!; + public bool reqHwOption { get; set; } = false; + } } \ No newline at end of file diff --git a/WebWindowComplex/Compo/CardSplit.razor b/WebWindowComplex/Compo/CardSplit.razor index 1e3b240..883cae9 100644 --- a/WebWindowComplex/Compo/CardSplit.razor +++ b/WebWindowComplex/Compo/CardSplit.razor @@ -4,7 +4,7 @@
    -
    @(descParentSplit(CurrSplit))
    +
    @(descParentSplit())
    @@ -21,7 +21,7 @@
    }
    - +