diff --git a/MP.SPEC/Components/ListPARAMS.razor.cs b/MP.SPEC/Components/ListPARAMS.razor.cs index 0f840796..654ca456 100644 --- a/MP.SPEC/Components/ListPARAMS.razor.cs +++ b/MP.SPEC/Components/ListPARAMS.razor.cs @@ -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; diff --git a/MP.SPEC/Data/SelectFluxParams.cs b/MP.SPEC/Data/SelectFluxParams.cs index f6aab1b8..35836776 100644 --- a/MP.SPEC/Data/SelectFluxParams.cs +++ b/MP.SPEC/Data/SelectFluxParams.cs @@ -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; diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj index 36b1e18a..e6fa79e9 100644 --- a/MP.SPEC/MP.SPEC.csproj +++ b/MP.SPEC/MP.SPEC.csproj @@ -5,7 +5,7 @@ enable enable MP.SPEC - 6.16.2212.1212 + 6.16.2212.1213 diff --git a/MP.SPEC/Pages/PARAMS.razor.cs b/MP.SPEC/Pages/PARAMS.razor.cs index e0598d34..1e1daf48 100644 --- a/MP.SPEC/Pages/PARAMS.razor.cs +++ b/MP.SPEC/Pages/PARAMS.razor.cs @@ -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; } diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html index 4ffc3cea..661c3025 100644 --- a/MP.SPEC/Resources/ChangeLog.html +++ b/MP.SPEC/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2212.1212

+

Versione: 6.16.2212.1213


Note di rilascio: