Files
mapo-core/MP.Prog/Components/ArchiveStatus.razor.cs
T

92 lines
2.2 KiB
C#

using Microsoft.AspNetCore.Components;
using MP.FileData.DTO;
using MP.Prog.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace MP.Prog.Components
{
public partial class ArchiveStatus
{
#region Private Fields
private List<ArchiveStatusDTO> ListRecords;
private int numChecks = 0;
#endregion Private Fields
#region Private Properties
private string lastMessage { get; set; } = "";
private int totalCount
{
get
{
int answ = 0;
if (ListRecords != null)
answ = ListRecords.Count();
return answ;
}
}
#endregion Private Properties
#region Protected Properties
[Inject]
protected FileArchDataService DataService { get; set; }
protected int percLoading { get; set; } = 0;
protected bool showProgress { get; set; } = true;
#endregion Protected Properties
#region Protected Methods
protected async Task ArchiveCheck(int maxHour)
{
numChecks = await DataService.updateAllArchive(maxHour);
lastMessage = $"Effettuata verifica e rilettura di {numChecks} files!";
await Task.Delay(1);
await ReloadData();
}
protected async Task ClearMessage()
{
await Task.Delay(100);
lastMessage = "";
}
protected async Task ForceCheck(int maxHour)
{
lastMessage = "Inizio Analisi Archivio...";
ListRecords = null;
//await Task.Delay(1);
await ArchiveCheck(maxHour);
//await Task.Delay(1);
await ReloadData();
await ClearMessage();
}
protected override async Task OnInitializedAsync()
{
ListRecords = null;
await ReloadData();
}
protected async Task ReloadData()
{
await Task.Delay(10);
numChecks = 0;
ListRecords = await DataService.GetArchiveStatus();
await Task.Delay(100);
lastMessage = "";
}
#endregion Protected Methods
}
}