Files
mapo-core/MP.Land/Shared/MainLayout.razor.cs
T
Samuele Locatelli 9690e26194 LAND:
- fix auth annuale x home e footer
2023-10-16 10:59:47 +02:00

77 lines
1.8 KiB
C#

using Microsoft.AspNetCore.Components;
using MP.Land.Data;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace MP.Land.Shared
{
public partial class MainLayout
{
#region Public Methods
public void Dispose()
{
AppMService.EA_ShowSearch -= OnShowSearch;
AppMService.EA_ShowSearch -= OnHideSearch;
GC.Collect();
}
public void OnHideSearch()
{
ShowSearch = false;
InvokeAsync(() =>
{
StateHasChanged();
});
}
public void OnShowSearch()
{
ShowSearch = true;
InvokeAsync(() =>
{
StateHasChanged();
});
}
#endregion Public Methods
[Inject]
protected AppAuthService DataService { get; set; }
#region Protected Methods
protected override async Task OnInitializedAsync()
{
AppMService.EA_ShowSearch += OnShowSearch;
AppMService.EA_HideSearch += OnHideSearch;
AppMService.EA_UpdateLic += SetYrAuth;
await Task.Delay(1);
}
protected void SetYrAuth()
{
annualAuthOk = AppMService.YearAuth;
cssRow = annualAuthOk ? "bottom-row" : "bottom-row bg-danger";
InvokeAsync(() =>
{
StateHasChanged();
});
}
#endregion Protected Methods
#region Private Properties
private bool ShowSearch { get; set; } = false;
protected string cssRow { get; set; } = "bottom-row bg-primary";
protected bool annualAuthOk { get; set; } = false;
private List<MP.AppAuth.Models.UpdMan> ListRecords;
#endregion Private Properties
}
}