using Microsoft.AspNetCore.Components; using WebWindowComplex.Models; using static WebWindowComplex.Json.WindowConst; namespace WebWindowComplex.Compo { public partial class CardSashGroup { #region Public Properties /// /// Indice della sash corrente rispetto alla lista sash /// [Parameter] public int CurrIndex { get; set; } = 0; /// /// Sash corrente rispetto alla lista Sash /// [Parameter] public Sash CurrItem { get; set; } = null!; /// /// Evento per cambiare tutti i Joints /// [Parameter] public EventCallback EC_ChangeAllJoints { get; set; } /// /// 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 /// [Parameter] public EventCallback EC_RemoveArea { get; set; } /// /// Evento per tornare nella pagine Tree /// [Parameter] public EventCallback EC_ReqClose { get; set; } /// /// Evento per richiedere reset dizionario Shape /// [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; } /// /// Lista di sash /// [Parameter] public List SashList { get; set; } = null!; [Parameter] public bool isLoadingHwOpt { get; set; } = false; #endregion Public Properties #region Protected Properties /// /// Selezione hardware /// protected string SelHwType { get => CurrItem.SelHardwareFromId; set { if (CurrItem.SelHardwareFromId != value) { CurrItem.SelHardwareFromId = value; _ = EC_UpdateSashHardware.InvokeAsync(CurrItem); } } } #endregion Protected Properties #region Protected Methods /// /// Sollevo evento per rimuovere area /// /// area da rimuovere /// protected async Task RemoveArea(Area currArea) { // richiesta reset dict shape await EC_ReqResetDictShape.InvokeAsync(true); await EC_RemoveArea.InvokeAsync(currArea); } #endregion Protected Methods #region Private Methods /// /// Sollevo evento richiesta per cambiare tutti i Joint /// /// private async Task ChangeAllJoints(Json.WindowConst.Joints JointType, Area a) { var Args = new DataChangeJoints { currJointType = JointType, currArea = a, }; await EC_ChangeAllJoints.InvokeAsync(Args); } /// /// 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); } /// /// Sollevo evento per tornare alla pagina Tree /// private void ReqClose() { _ = EC_ReqClose.InvokeAsync(true); } /// /// Report aggiornamento joint /// /// /// private async Task UpdateJoint(Joint updRec) { // cerco il record var currRec = CurrItem.JointList.FirstOrDefault(x => x.ParentArea == updRec.ParentArea && x.nIndex == updRec.nIndex); // lo aggiorno if (updRec != null) { currRec = updRec; await EC_UpdateSash.InvokeAsync(CurrItem); } } /// /// Report aggiornamento Option Combo /// /// /// private async Task UpdateOptCombo(AGBOptionCombo updRec) { // cerco il record var currRec = CurrItem.HwOptionList.FirstOrDefault(x => x.sName == updRec.sName && x.sDescription == updRec.sDescription); // lo aggiorno if (updRec != null) { currRec = updRec; await EC_UpdateSashHardware.InvokeAsync(CurrItem); } } /// /// Report aggiornamento Option Text /// /// /// private async Task UpdateOptText(AGBOptionText updRec) { // cerco il record var currRec = CurrItem.HwOptionList.FirstOrDefault(x => x.sName == updRec.sName && x.sDescription == updRec.sDescription); // lo aggiorno if (updRec != null) { currRec = updRec; await EC_UpdateSashHardware.InvokeAsync(CurrItem); } } /// /// Prima chiamata hw option list /// /// /// private async Task FirstHwOptionList(int groupId) { await EC_CallFirstHwOpt.InvokeAsync(groupId); } #endregion Private Methods } }