Update refresh parametri
This commit is contained in:
@@ -3,12 +3,17 @@ using Microsoft.JSInterop;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.SPEC.Data;
|
||||
using System.Diagnostics;
|
||||
using MP.Data;
|
||||
|
||||
namespace MP.SPEC.Components
|
||||
{
|
||||
public partial class ListPARAMS : IDisposable
|
||||
{
|
||||
#region Public Fields
|
||||
|
||||
public SelectFluxParams? LastFilter = null;
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
@@ -26,7 +31,7 @@ namespace MP.SPEC.Components
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
private SelectFluxParams lastFilter { get; set; } = new SelectFluxParams() { CurrPage = -1 };
|
||||
|
||||
public string checkSelect(FluxLog selRecord)
|
||||
{
|
||||
string answ = "";
|
||||
@@ -42,33 +47,17 @@ namespace MP.SPEC.Components
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
// se sono cambiati --> rileggo...
|
||||
if (!lastFilter.Equals(SelFilter))
|
||||
{
|
||||
lastFilter = SelFilter.clone();
|
||||
await reloadData(true);
|
||||
}
|
||||
}
|
||||
|
||||
public SelectFluxParams? LastFilter = null;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
#if false
|
||||
aTimer.Elapsed -= ElapsedTimer;
|
||||
aTimer.Stop();
|
||||
aTimer.Dispose();
|
||||
#endif
|
||||
aTimer.Dispose();
|
||||
currRecord = null;
|
||||
SearchRecords = null;
|
||||
ListRecords = null;
|
||||
GC.Collect();
|
||||
}
|
||||
|
||||
#if false
|
||||
public void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
if (!isLoading && LiveUpdate)
|
||||
@@ -90,12 +79,13 @@ namespace MP.SPEC.Components
|
||||
aTimer.Interval = deltaTime > 100 ? deltaTime : 100;
|
||||
aTimer.Start();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public async Task reloadData(bool setChanged)
|
||||
{
|
||||
isLoading = true;
|
||||
SearchRecords = null;
|
||||
ListRecords = null;
|
||||
DateTime dataFrom = DateTime.Today.AddMonths(-1);
|
||||
DateTime dataTo = DateTime.Now.AddMinutes(5);
|
||||
if (SelFilter != null && SelFilter.dtMin != null)
|
||||
@@ -107,7 +97,7 @@ namespace MP.SPEC.Components
|
||||
dataTo = (DateTime)SelDtMax;
|
||||
}
|
||||
|
||||
SearchRecords = await MDService.FluxLogGetLastFilt(dataTo, dataFrom, SelMacchina, SelFlux, MaxRecord, RefreshPeriod/1000);
|
||||
SearchRecords = await MDService.FluxLogGetLastFilt(dataTo, dataFrom, SelMacchina, SelFlux, MaxRecord, RefreshPeriod / 1000);
|
||||
totalCount = SearchRecords.Count;
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
await Task.Delay(1);
|
||||
@@ -118,18 +108,20 @@ namespace MP.SPEC.Components
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
#if false
|
||||
public void StartTimer()
|
||||
{
|
||||
aTimer = new System.Timers.Timer(RefreshPeriod);
|
||||
aTimer.Elapsed += ElapsedTimer;
|
||||
aTimer.Enabled = true;
|
||||
aTimer.Start();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
@@ -147,15 +139,22 @@ namespace MP.SPEC.Components
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
#if false
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
StartTimer();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
// se sono cambiati --> rileggo...
|
||||
if (!lastFilter.Equals(SelFilter))
|
||||
{
|
||||
lastFilter = SelFilter.clone();
|
||||
await reloadData(true);
|
||||
}
|
||||
}
|
||||
|
||||
//protected int RefreshPeriod { get; set; } = 5000;
|
||||
protected async void OnSeachUpdated()
|
||||
{
|
||||
await InvokeAsync(() =>
|
||||
@@ -194,22 +193,16 @@ namespace MP.SPEC.Components
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
|
||||
private string traduci(string lemma)
|
||||
{
|
||||
var answ = MDService.Traduci(lemma, "IT");
|
||||
return answ;
|
||||
}
|
||||
|
||||
#region Private Fields
|
||||
|
||||
#if false
|
||||
private static System.Timers.Timer aTimer = null!;
|
||||
#endif
|
||||
private static System.Timers.Timer aTimer = null!;
|
||||
|
||||
private int _totalCount = 0;
|
||||
|
||||
private FluxLog? currRecord = null;
|
||||
|
||||
private List<FluxLog>? ListRecords;
|
||||
|
||||
private List<FluxLog>? SearchRecords;
|
||||
|
||||
#endregion Private Fields
|
||||
@@ -224,6 +217,8 @@ namespace MP.SPEC.Components
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private SelectFluxParams lastFilter { get; set; } = new SelectFluxParams() { CurrPage = -1 };
|
||||
|
||||
private bool LiveUpdate
|
||||
{
|
||||
get => SelFilter.LiveUpdate;
|
||||
@@ -234,12 +229,21 @@ namespace MP.SPEC.Components
|
||||
get => SelFilter.MaxRecord;
|
||||
}
|
||||
|
||||
[Inject]
|
||||
private NavigationManager NavManager { get; set; } = null!;
|
||||
|
||||
private int numRecord
|
||||
{
|
||||
get => SelFilter.NumRec;
|
||||
set => SelFilter.NumRec = value;
|
||||
}
|
||||
|
||||
private DateTime? SelDtMax
|
||||
{
|
||||
get => SelFilter.dtMax;
|
||||
set => SelFilter.dtMax = value;
|
||||
}
|
||||
|
||||
private string SelFlux
|
||||
{
|
||||
get => SelFilter.CodFlux;
|
||||
@@ -249,11 +253,6 @@ namespace MP.SPEC.Components
|
||||
{
|
||||
get => SelFilter.IdxMacchina;
|
||||
}
|
||||
private DateTime? SelDtMax
|
||||
{
|
||||
get => SelFilter.dtMax;
|
||||
set => SelFilter.dtMax = value;
|
||||
}
|
||||
|
||||
private int totalCount
|
||||
{
|
||||
@@ -272,6 +271,12 @@ namespace MP.SPEC.Components
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private string traduci(string lemma)
|
||||
{
|
||||
var answ = MDService.Traduci(lemma, "IT");
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,6 @@
|
||||
#region Public Properties
|
||||
|
||||
public string CodFlux { get; set; } = "*";
|
||||
public int CurrCount { get; set; } = 0;
|
||||
public int CurrPage { get; set; } = 1;
|
||||
public DateTime? dtMax { get; set; } = null;
|
||||
public DateTime? dtMin { get; set; } = null;
|
||||
@@ -39,7 +38,6 @@
|
||||
SelectFluxParams clonedData = new SelectFluxParams()
|
||||
{
|
||||
CodFlux = this.CodFlux,
|
||||
CurrCount = this.CurrCount,
|
||||
CurrPage = this.CurrPage,
|
||||
dtRif = this.dtRif,
|
||||
dtMax = this.dtMax,
|
||||
@@ -61,9 +59,6 @@
|
||||
if (!(obj is SelectFluxParams item))
|
||||
return false;
|
||||
|
||||
if (CurrCount != item.CurrCount)
|
||||
return false;
|
||||
|
||||
if (IdxMacchina != item.IdxMacchina)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP.SPEC</RootNamespace>
|
||||
<Version>6.16.2212.1213</Version>
|
||||
<Version>6.16.2212.1214</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,66 +1,43 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.SPEC.Components;
|
||||
using MP.SPEC.Data;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace MP.SPEC.Pages
|
||||
{
|
||||
public partial class PARAMS : IDisposable
|
||||
public partial class PARAMS
|
||||
{
|
||||
public void Dispose()
|
||||
{
|
||||
aTimer.Elapsed -= ElapsedTimer;
|
||||
aTimer.Stop();
|
||||
aTimer.Dispose();
|
||||
GC.Collect();
|
||||
}
|
||||
public void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
if (LiveUpdate)
|
||||
{
|
||||
aTimer.Stop();
|
||||
currFilter.CurrCount++;
|
||||
currFilter.dtMax = DateTime.Now.AddSeconds(5);
|
||||
aTimer.Interval = RefreshPeriod;
|
||||
aTimer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
public void StartTimer()
|
||||
{
|
||||
aTimer = new System.Timers.Timer(RefreshPeriod);
|
||||
aTimer.Elapsed += ElapsedTimer;
|
||||
aTimer.Enabled = true;
|
||||
aTimer.AutoReset = true;
|
||||
aTimer.Start();
|
||||
}
|
||||
protected int RefreshPeriod
|
||||
{
|
||||
get => currFilter.TempoAgg;
|
||||
}
|
||||
protected bool LiveUpdate
|
||||
{
|
||||
get => currFilter.LiveUpdate;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static System.Timers.Timer aTimer = null!;
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected int CurrCounter = 0;
|
||||
|
||||
protected DataPager? pagerODL = null!;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected async Task detailSel(FluxLog newRec)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
var updFilter = currFilter;
|
||||
DateTime adesso = DateTime.Now.AddSeconds(1);
|
||||
updFilter.LiveUpdate = (newRec == null);
|
||||
// sistemo la data di riferimento x eventuale snapshot nel passato
|
||||
updFilter.dtRif = newRec != null ? newRec.dtEvento : null;
|
||||
if (newRec != null)
|
||||
{
|
||||
updFilter.lastUpdate = updFilter.lastUpdate == "-" ? $"{adesso:yyyy/MM/dd HH:mm:ss}" : updFilter.lastUpdate;
|
||||
updFilter.IdxMacchina = newRec.IdxMacchina;
|
||||
//updFilter.CodFlux = newRec.CodFlux;
|
||||
}
|
||||
else
|
||||
{
|
||||
updFilter.lastUpdate = "-";
|
||||
}
|
||||
// salvo filtro
|
||||
currFilter = updFilter;
|
||||
}
|
||||
|
||||
protected void ForceReload(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
@@ -89,7 +66,6 @@ namespace MP.SPEC.Pages
|
||||
modFilter.CurrPage = 1;
|
||||
modFilter.LiveUpdate = (currPage == 1);
|
||||
currFilter = modFilter;
|
||||
StartTimer();
|
||||
await Task.Delay(1);
|
||||
isFiltering = false;
|
||||
}
|
||||
@@ -111,27 +87,9 @@ namespace MP.SPEC.Pages
|
||||
totalCount = newTotCount;
|
||||
}
|
||||
|
||||
|
||||
protected async Task detailSel(FluxLog newRec)
|
||||
protected void UpdateTotCount(int newTotCount)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
var updFilter = currFilter;
|
||||
DateTime adesso = DateTime.Now.AddSeconds(1);
|
||||
updFilter.LiveUpdate = (newRec == null);
|
||||
// sistemo la data di riferimento x eventuale snapshot nel passato
|
||||
updFilter.dtRif = newRec != null ? newRec.dtEvento : null;
|
||||
if (newRec != null)
|
||||
{
|
||||
updFilter.lastUpdate = updFilter.lastUpdate == "-" ? $"{adesso:yyyy/MM/dd HH:mm:ss}" : updFilter.lastUpdate;
|
||||
updFilter.IdxMacchina = newRec.IdxMacchina;
|
||||
//updFilter.CodFlux = newRec.CodFlux;
|
||||
}
|
||||
else
|
||||
{
|
||||
updFilter.lastUpdate = "-";
|
||||
}
|
||||
// salvo filtro
|
||||
currFilter = updFilter;
|
||||
totalCount = newTotCount;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
@@ -181,10 +139,7 @@ namespace MP.SPEC.Pages
|
||||
currFilter = newParams;
|
||||
isLoading = false;
|
||||
}
|
||||
protected void UpdateTotCount(int newTotCount)
|
||||
{
|
||||
totalCount = newTotCount;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 6.16.2212.1213</h4>
|
||||
<h4>Versione: 6.16.2212.1214</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2212.1213
|
||||
6.16.2212.1214
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2212.1213</version>
|
||||
<version>6.16.2212.1214</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
Reference in New Issue
Block a user