107 lines
3.5 KiB
C#
107 lines
3.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Components;
|
|
using System.Net.Http;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Components.Authorization;
|
|
using Microsoft.AspNetCore.Components.Forms;
|
|
using Microsoft.AspNetCore.Components.Routing;
|
|
using Microsoft.AspNetCore.Components.Web;
|
|
using Microsoft.AspNetCore.Components.Web.Virtualization;
|
|
using Microsoft.JSInterop;
|
|
using SMGen;
|
|
using SMGen.Shared;
|
|
using SMGen.Components;
|
|
using SMGen.Data;
|
|
using SMGen.Data.Data;
|
|
using SMGen.Data.Services;
|
|
using SMGen.Data.DbModels;
|
|
|
|
namespace SMGen.Components
|
|
{
|
|
public partial class FilesList
|
|
{
|
|
//[Parameter]
|
|
//public Dictionary<string, bool> FilesStatus { get; set; } = new Dictionary<string, bool>();
|
|
public Dictionary<string, bool> FilesStatusTemp { get; set; } = new Dictionary<string, bool>();
|
|
//[Parameter]
|
|
//public Dictionary<string, string> Files2Download { get; set; } = new Dictionary<string, string>();
|
|
[Parameter]
|
|
public EventCallback<bool> PagerResetReq { get; set; }
|
|
|
|
[Parameter]
|
|
public EventCallback<int> updateRecordCount { get; set; }
|
|
[Parameter]
|
|
public SelectSMIn2EvParams currFilter { get; set; } = null!;
|
|
[Parameter]
|
|
public bool hasBit { get; set; } = false;
|
|
|
|
[Inject]
|
|
protected SMGDataService SMGDService { get; set; } = null!;
|
|
|
|
private int currPage
|
|
{
|
|
get => currFilter.CurrPage;
|
|
set => currFilter.CurrPage = value;
|
|
}
|
|
private int numRecord
|
|
{
|
|
get => currFilter.NumRec;
|
|
set => currFilter.NumRec = value;
|
|
}
|
|
private int _totalCount { get; set; } = 0;
|
|
private int totalCount
|
|
{
|
|
get => _totalCount;
|
|
set
|
|
{
|
|
if (_totalCount != value)
|
|
{
|
|
_totalCount = value;
|
|
updateRecordCount.InvokeAsync(value);
|
|
}
|
|
}
|
|
}
|
|
|
|
protected override async Task OnParametersSetAsync()
|
|
{
|
|
await ReloadData();
|
|
}
|
|
|
|
protected Dictionary<string, FilesClass> Files { get; set; } = new Dictionary<string, FilesClass>();
|
|
protected Dictionary<string, FilesClass> FilesTemp { get; set; } = new Dictionary<string, FilesClass>();
|
|
protected async Task ReloadData()
|
|
{
|
|
await Task.Delay(1);
|
|
FilesTemp = await SMGDService.FilesGetAll();
|
|
totalCount = FilesTemp.Count;
|
|
Files = FilesTemp.Skip(numRecord * (currPage - 1)).Take(numRecord).ToDictionary(x => x.Key, y => y.Value);
|
|
await InvokeAsync(() => StateHasChanged());
|
|
}
|
|
|
|
|
|
protected async Task Read_rule_file_transitions()
|
|
{
|
|
Files = await SMGDService.FilesGetAll();
|
|
foreach (var item in Files)
|
|
{
|
|
item.Value.calcRunning = true;
|
|
await InvokeAsync(() => StateHasChanged());
|
|
await Task.Delay(1);
|
|
// chiamo esecuzione 1:1...
|
|
if (hasBit)
|
|
{
|
|
await SMGDService.EvalIn2EvRuleFile(item.Value, true);
|
|
}
|
|
else
|
|
{
|
|
await SMGDService.EvalIn2StateRuleFile(item.Value, false);
|
|
}
|
|
item.Value.calcRunning = false;
|
|
await InvokeAsync(() => StateHasChanged());
|
|
}
|
|
}
|
|
}
|
|
} |