Files
gpw_next/GPW.CORE.SMART/Components/Pages/About.razor.cs
T
2024-08-23 13:10:21 +02:00

87 lines
2.5 KiB
C#

using GPW.CORE.Smart.Data;
using MailKit.Net.Imap;
using Microsoft.AspNetCore.Components;
using System.Reflection;
using System.Runtime.Versioning;
namespace GPW.CORE.Smart.Components.Pages
{
public partial class About : IDisposable
{
#region Public Methods
public void Dispose()
{
GC.Collect();
}
#endregion Public Methods
#region Protected Fields
protected string Messaggio = "";
protected string Titolo = "";
#endregion Protected Fields
#region Protected Methods
protected string framework = "???";
protected override async Task OnInitializedAsync()
{
await LicServ.RefreshApplic();
Titolo = Configuration.GetValue<string>("Application:Name")!;
Messaggio = Configuration.GetValue<string>("Application:ContactText")!;
var tgtFrmwrkAtt = Assembly.GetExecutingAssembly()
.GetCustomAttributes(typeof(TargetFrameworkAttribute), false)
.FirstOrDefault();
if (tgtFrmwrkAtt != null)
{
try
{
framework = ((TargetFrameworkAttribute)tgtFrmwrkAtt).FrameworkName;
}
catch { }
}
}
#endregion Protected Methods
private int numLicAvail
{
get
{
int answ = 0;
if (LicServ.HasActivData)
{
var licRec = LicServ.AKVList.Where(x => x.NomeVar == LicServ.Installazione).FirstOrDefault();
if (licRec != null)
{
answ = licRec.ValInt ?? 0;
}
}
return answ;
}
}
private string licStatus
{
get => LicServ.HasActivData ? $"{LicServ.ActivList.Count}/{numLicAvail}" : "N.A.";
}
private string licExpiry
{
get => LicServ.HasActivData ? $"{LicServ.AppLicense.Scadenza:yyyy-MM-dd}" : "N.A.";
}
#region Private Properties
[Inject]
private IConfiguration Configuration { get; set; } = null!;
#endregion Private Properties
[Inject]
protected LicenseService LicServ { get; set; } = null!;
protected Version? version = typeof(Program).Assembly.GetName().Version;
}
}