bozza spostamento timer in pagina al posto del componente

This commit is contained in:
Samuele Locatelli
2022-12-12 13:27:00 +01:00
parent e26ed56c42
commit 0613d9a296
7 changed files with 71 additions and 13 deletions
+15 -6
View File
@@ -53,20 +53,22 @@ namespace MP.SPEC.Components
}
}
public SelectFluxParams? LastFilter = null;
public void Dispose()
{
#if false
aTimer.Elapsed -= ElapsedTimer;
aTimer.Stop();
aTimer.Dispose();
aTimer.Dispose();
#endif
currRecord = null;
SearchRecords = null;
ListRecords = null;
GC.Collect();
}
#if false
public void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e)
{
if (!isLoading && LiveUpdate)
@@ -88,7 +90,8 @@ namespace MP.SPEC.Components
aTimer.Interval = deltaTime > 100 ? deltaTime : 100;
aTimer.Start();
}
}
}
#endif
public async Task reloadData(bool setChanged)
{
@@ -115,13 +118,15 @@ 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
@@ -142,10 +147,12 @@ namespace MP.SPEC.Components
#region Protected Methods
#if false
protected override void OnInitialized()
{
StartTimer();
}
}
#endif
//protected int RefreshPeriod { get; set; } = 5000;
@@ -196,7 +203,9 @@ namespace MP.SPEC.Components
#region Private Fields
private static System.Timers.Timer aTimer = null!;
#if false
private static System.Timers.Timer aTimer = null!;
#endif
private int _totalCount = 0;
private FluxLog? currRecord = null;
+9 -2
View File
@@ -16,27 +16,30 @@
#region Public Properties
public string CodFlux { get; set; } = "*";
public int CurrCount { get; set; } = 0;
public int CurrPage { get; set; } = 1;
public DateTime? dtRif { get; set; } = null;
public DateTime? dtMax { get; set; } = null;
public DateTime? dtMin { get; set; } = null;
public DateTime? dtRif { get; set; } = null;
public DateTime? dtSnapMin { get; set; } = null;
public string IdxMacchina { get; set; } = "*";
public string lastUpdate { get; set; } = "-";
public bool LiveUpdate { get; set; } = true;
public int NumRec { get; set; } = 10;
public int MaxRecord { get; set; } = 100;
public int NumRec { get; set; } = 10;
public int TempoAgg { get; set; } = 10000;
public int TotCount { get; set; } = 0;
#endregion Public Properties
#region Public Methods
public SelectFluxParams clone()
{
SelectFluxParams clonedData = new SelectFluxParams()
{
CodFlux = this.CodFlux,
CurrCount = this.CurrCount,
CurrPage = this.CurrPage,
dtRif = this.dtRif,
dtMax = this.dtMax,
@@ -52,11 +55,15 @@
};
return clonedData;
}
public override bool Equals(object obj)
{
if (!(obj is SelectFluxParams item))
return false;
if (CurrCount != item.CurrCount)
return false;
if (IdxMacchina != item.IdxMacchina)
return false;
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.SPEC</RootNamespace>
<Version>6.16.2212.1212</Version>
<Version>6.16.2212.1213</Version>
</PropertyGroup>
<ItemGroup>
+43 -1
View File
@@ -2,11 +2,52 @@
using MP.Data.DatabaseModels;
using MP.SPEC.Components;
using MP.SPEC.Data;
using System.Diagnostics;
namespace MP.SPEC.Pages
{
public partial class PARAMS
public partial class PARAMS : IDisposable
{
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 DataPager? pagerODL = null!;
@@ -48,6 +89,7 @@ namespace MP.SPEC.Pages
modFilter.CurrPage = 1;
modFilter.LiveUpdate = (currPage == 1);
currFilter = modFilter;
StartTimer();
await Task.Delay(1);
isFiltering = false;
}
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2212.1212</h4>
<h4>Versione: 6.16.2212.1213</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2212.1212
6.16.2212.1213
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2212.1212</version>
<version>6.16.2212.1213</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>