using Microsoft.AspNetCore.Components; using WebWindowComplex.DTO; using WebWindowComplex.Models; namespace WebWindowComplex.Compo { public partial class General { #region Public Properties /// /// Finestra corrente /// [Parameter] public Window CurrWindow { get; set; } = null!; [Parameter] public bool User { get; set; } = false!; [Parameter] public EventCallback EC_UpdateGeneral { get; set; } [Parameter] public EventCallback EC_ReqClose { get; set; } /// /// Elenco anagrafiche di base /// [Parameter] public BaseListPayload ListPayload { get; set; } = null!; /// /// Elenco Warnings attivi /// [Parameter] public Dictionary ListWarnings { get; set; } = new Dictionary(); /// /// Elenco domande pendenti /// [Parameter] public Dictionary DictPendReq { get; set; } = new Dictionary(); #endregion Public Properties #region Protected Properties /// /// Colore corrente /// protected string CurrColor { get => currColor; set { currColor = value; var args = new DataUpdateGeneral { Color = value, }; _ = EC_UpdateGeneral.InvokeAsync(args); } } /// /// Vetro corrente /// protected string CurrGlass { get => currGlass; set { currGlass = value; var args = new DataUpdateGeneral { Glass = value, }; _ = EC_UpdateGeneral.InvokeAsync(args); } } /// /// Materiale corrente /// protected string CurrWood { get => currWood; set { currWood = value; var args = new DataUpdateGeneral { Wood = value, }; _ = EC_UpdateGeneral.InvokeAsync(args); } } /// /// Profilo corrente /// protected string CurrProfile { get => currProfile; set { currProfile = value; var args = new DataUpdateGeneral { Profile = value, }; _ = EC_UpdateGeneral.InvokeAsync(args); } } #endregion Protected Properties #region Protected Methods /// /// Calcola CSS warning /// /// /// protected string cssValid(string fKey) { string ans = ""; if (ListWarnings != null && DictPendReq != null && (ListWarnings.ContainsKey(fKey) || DictPendReq.ContainsKey(fKey))) ans = "border border-danger"; else ans = ""; return ans; } protected override void OnParametersSet() { currColor = CurrWindow.sColorMaterial; currGlass = CurrWindow.sGlass; currWood = CurrWindow.sWood; currProfile = CurrWindow.sProfilePath; } #endregion Protected Methods #region Private Fields private string currColor = ""; private string currGlass = ""; private string currWood = ""; private string currProfile = ""; #endregion Private Fields private void ReqClose() { _ = EC_ReqClose.InvokeAsync(true); } } /// /// Classe per aggiornamento dati general /// public class DataUpdateGeneral { public string Color { get; set; } = ""; public string Glass { get; set; } = ""; public string Wood { get; set; } = ""; public string Profile { get; set; } = ""; } }