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 frame) return frame; else return null; } private Sash? CurrSash() { if (CurrArea is Sash sash) return sash; else return null; } #endregion Private Properties } public class DataBottomRail { public Sash? sash { get; set; } public Frame? frame { get; set; } } }