Files
mapo-core/MP.Land/Pages/UserQr.razor.cs
T
2021-09-20 16:39:07 +02:00

101 lines
2.6 KiB
C#

using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Configuration;
using MP.AppAuth.Models;
using MP.Land.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace MP.Land.Pages
{
public partial class UserQr
{
#region Private Fields
private List<AnagraficaOperatori> ListRecords;
#endregion Private Fields
#region Protected Fields
protected string CardMessage = "User Card";
protected int totalCount = 0;
#endregion Protected Fields
#region Private Properties
[Inject]
private IConfiguration Configuration { get; set; }
private bool isLoading { get; set; } = false;
#endregion Private Properties
#region Protected Properties
[Inject]
protected MessageService AppMService { get; set; }
protected string BaseUrl
{
get => Configuration["BaseUrl"];
}
[Inject]
protected AppAuthService DataService { get; set; }
protected string Environment
{
get => Configuration["Environment"];
}
#endregion Protected Properties
#region Protected Methods
protected override void OnInitialized()
{
AppMService.ShowSearch = false;
AppMService.PageName = "User Card";
AppMService.PageIcon = "fas fa-qrcode pr-2";
//AppMService.EA_SearchUpdated += OnSeachUpdated;
//AppMService.EA_FilterUpdated += OnFilterUpdated;
}
protected override async Task OnInitializedAsync()
{
await ReloadAllData();
}
protected async Task ReloadAllData()
{
isLoading = true;
//MacList = await DataService.MacchineGetAll();
await ReloadData();
}
protected async Task ReloadData()
{
isLoading = true;
// importante altrimenti NON mostra update UI
await Task.Delay(1);
ListRecords = await DataService.AnagOperList();
totalCount = ListRecords.Count();
await Task.Delay(1);
}
protected MarkupString traduci(string lemma)
{
MarkupString answ;
//string rawHtml = "<li>primo</li><li>secondo</li>";
string rawHtml = DataService.Traduci(lemma, "IT");
answ = new MarkupString(rawHtml);
// cerco nella cache Redis
return answ;
}
#endregion Protected Methods
}
}