using Microsoft.AspNetCore.Components; using WebWindowComplex.Models; namespace WebWindowComplex.Compo { public partial class EditSplitElement { #region Public Properties /// /// Element corrente /// [Parameter] public SplitElementDimension CurrRec { get; set; } = null!; /// /// Tipo dello split element corrente /// [Parameter] public string Type { get; set; } = null!; /// /// Aggiornamento element /// [Parameter] public EventCallback EC_Update { get; set; } /// /// Livello di accesso (utente base) /// [CascadingParameter(Name = "User")] public bool BaseUser { get; set; } = false!; /// /// Vocabolario con traduzione lingua corrente /// [CascadingParameter(Name = "Vocabulary")] public Dictionary Vocabulary { get; set; } = null!; #endregion Public Properties #region Protected Properties protected override void OnParametersSet() { SplitElemDict = Vocabulary.Where(x => x.Key.Contains("CWSplitElem_")).ToDictionary(x => x.Key, y => y.Value); } #endregion Protected Properties #region Private Fields private Dictionary SplitElemDict = new(); #endregion Private Fields #region Private Properties /// /// Metodo per aggiornare element corrente /// private double updateVal { get => CurrRec.dDimension; set { if (CurrRec.dDimension != value) { CurrRec.dDimension = value; _ = EC_Update.InvokeAsync(CurrRec); } } } #endregion Private Properties #region Private Methods private string GetImageElemPath() => $"_content/Egw.Lux.WebWindowComplex/icone/split/element/{Type}.svg"; private string Title() { return "Min: " + CurrRec.dMinDim + ", Max: " + CurrRec.dMaxDim; } /// /// Metodo per traduzione in lingua corrente /// /// /// private string Traduci(string lemma) { string ans = ""; string totalLemma = "CWSplitElem_Height"; if (lemma.Equals("Vertical")) { totalLemma = "CWSplitElem_Width"; } if (SplitElemDict != null && SplitElemDict.ContainsKey(totalLemma)) { ans = SplitElemDict.GetValueOrDefault(totalLemma) ?? ""; } return ans; } #endregion Private Methods } }