using Microsoft.AspNetCore.Components; using MP.AppAuth.Models; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace MP.Land.Components { public partial class HomeLink : IDisposable { #region Public Properties [Parameter] public UpdMan CurrItem { get; set; } #endregion Public Properties #region Public Methods public void Dispose() { GC.Collect(); } #endregion Public Methods #region Protected Properties protected List AKVList { get { return LicServ.AKVList; } set { LicServ.AKVList = value; } } #endregion Protected Properties #region Protected Methods protected bool authOk() { bool allOk = !string.IsNullOrEmpty(CurrItem.LicenseKey); if (allOk) { allOk = LicServ.checkLicenseActive(CurrItem.LicenseKey); if (allOk) { MService.YearAuth = true; } } return allOk; } protected bool hasLic() { bool allOk = !string.IsNullOrEmpty(CurrItem.LicenseKey); return allOk; } protected string fullUrl(string relUrl) { return $"{Configuration["ServerConf:BaseUrl"]}{relUrl}"; } protected AnagKeyValueModel getAKVRec(string nomeVar) { AnagKeyValueModel answ = new AnagKeyValueModel(); if (AKVList != null) { answ = AKVList.FirstOrDefault(x => x.NomeVar == nomeVar); } return answ; } protected string getAKVString(string nomeVar) { string answ = ""; if (AKVList != null) { var currRec = AKVList.FirstOrDefault(x => x.NomeVar == nomeVar); if (currRec != null) { answ = currRec.ValString; } } return answ; } protected override async Task OnInitializedAsync() { // check init AKV if (AKVList == null || AKVList.Count == 0) { AKVList = await DataService.AnagKeyValList(); LicServ.InitAkv(); } } protected MarkupString traduci(string lemma) { MarkupString answ; string rawHtml = DataService.Traduci(lemma, "IT"); answ = new MarkupString(rawHtml); return answ; } #endregion Protected Methods } }