using Microsoft.AspNetCore.Components; using MP.Core.DTO; namespace MP.SPEC.Components.Fermate { public partial class ProdStopMan { #region Public Properties [Parameter] public EventCallback E_EventSelected { get; set; } [Parameter] public int IdxEvento { get; set; } = 0; [Parameter] public string objCss { get; set; } = ""; [Parameter] public string objIcon { get; set; } = ""; [Parameter] public string objTxt { get; set; } = ""; #endregion Public Properties #region Protected Properties [Inject] protected IConfiguration config { get; set; } = null!; #endregion Protected Properties #region Protected Methods protected override void OnInitialized() { maxChar4Scroll = config.GetValue("ServerConf:maxChar4Scroll"); } protected async Task ReportSelected() { await E_EventSelected.InvokeAsync(new SelEventDTO(IdxEvento, objTxt)); } /// /// CSS class x testo (se descr lunga scorre...) /// protected string textCss(string currText) { string answ = " text-nowrap text-truncate w-100"; if (currText.Length > maxChar4Scroll) { // calcolo delta... a-b-c con 5-10-oltre int delta = currText.Length - maxChar4Scroll; if (delta < 5) { answ = " scroll-left-a"; } else if (delta < 10) { answ = " scroll-left-b"; } else { answ = " scroll-left-c"; } } return answ; } #endregion Protected Methods #region Private Fields private int maxChar4Scroll = 20; #endregion Private Fields } }