Update refresh sincronizzato

This commit is contained in:
Samuele Locatelli
2022-07-09 10:30:08 +02:00
parent 8f2afd8ab5
commit f2973cb0be
8 changed files with 52 additions and 20 deletions
+1 -1
View File
@@ -26,7 +26,7 @@ namespace MP.Mon.Components
public void StartTimer()
{
int tOutPeriod = 1000;
int tOutPeriod = 5000;
//int.TryParse(Configuration["ReloadStatusTimer"], out tOutPeriod);
aTimer = new System.Timers.Timer(tOutPeriod);
aTimer.Elapsed += ElapsedTimer;
+25 -1
View File
@@ -32,6 +32,24 @@ namespace MP.Mon.Components
[Parameter]
public string showArt { get; set; } = "";
[Parameter]
public bool doBlink { get; set; } = false;
//{
// set
// {
// // se true --> ricarica
// if (value)
// {
// var pUpd = Task.Run(async () =>
// {
// await InvokeAsync(() => StateHasChanged());
// });
// pUpd.Wait();
// }
// }
//}
#endregion Public Properties
#region Public Methods
@@ -157,7 +175,7 @@ namespace MP.Mon.Components
protected override async Task OnInitializedAsync()
{
StartTimer();
//StartTimer();
Random rnd = new Random();
await Task.Delay(rnd.Next(5));
setupConf();
@@ -228,11 +246,17 @@ namespace MP.Mon.Components
string answ = $"{baseCss}{codColore}";
if (doAnimate && codColore != "Ve")
{
#if false
// blink se secondo pari...
DateTime adesso = DateTime.Now;
int resto = 0;
Math.DivRem(adesso.Second, 2, out resto);
if (resto == 0)
{
answ += "_b";
}
#endif
if (doBlink)
{
answ += "_b";
}
+1 -1
View File
@@ -4,7 +4,7 @@
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>6.15.2207.909</Version>
<Version>6.15.2207.910</Version>
</PropertyGroup>
<ItemGroup>
+2 -3
View File
@@ -26,7 +26,7 @@
int currIdx = 0;
foreach (var recordIob in ListMSE)
{
<DetailMSE CurrRecord="@recordIob" currTagConf="@getIobTag(recordIob.IdxMacchina)" currTagVal="@getTagVal(recordIob.IdxMacchina)" doAnimate="@doAnimate" keepAliveMin="@keepAliveMin" showArt="@showArt"></DetailMSE>
<DetailMSE CurrRecord="@recordIob" currTagConf="@getIobTag(recordIob.IdxMacchina)" currTagVal="@getTagVal(recordIob.IdxMacchina)" doAnimate="@doAnimate" keepAliveMin="@keepAliveMin" showArt="@showArt" doBlink="@doBlink"></DetailMSE>
currIdx++;
if (currIdx >= maxCol)
{
@@ -38,8 +38,7 @@
int currNum = (currIdx % maxCol);
while (currNum < (maxCol))
{
@((MarkupString)"<div class=\"col machBlock\">&nbsp;</div>")
;
@((MarkupString)"<div class=\"col machBlock\">&nbsp;</div>");
currNum++;
}
+20 -11
View File
@@ -12,21 +12,34 @@ namespace MP.Mon.Pages
public void Dispose()
{
//fastTimer.Elapsed -= ElapsedFastTimer;
fastTimer.Stop();
fastTimer.Dispose();
//slowTimer.Elapsed -= ElapsedSlowTimer;
slowTimer.Stop();
slowTimer.Dispose();
}
private bool doBlink = false;
public void ElapsedFastTimer(object? source, System.Timers.ElapsedEventArgs e)
{
var pUpd = Task.Run(async () =>
{
await ReloadData();
// secondi pari --> blink, secondi dispari --> ricarica
DateTime adesso = DateTime.Now;
int resto = 0;
Math.DivRem(adesso.Second, 2, out resto);
if (resto == 0)
{
doBlink = true;
Log.Trace("Elapsed Fast Timer Blink");
}
else
{
doBlink = false;
await ReloadData();
Log.Trace("Elapsed Fast Timer reload");
}
await Task.Delay(1);
Log.Trace("Elapsed Fast Timer");
await InvokeAsync(StateHasChanged);
});
pUpd.Wait();
@@ -36,7 +49,7 @@ namespace MP.Mon.Pages
{
ListMSE = null;
await Task.Delay(1);
Log.Trace("Elapsed Slow Timer");
Log.Info("Elapsed Slow Timer --> full page reload");
NavManager.NavigateTo(NavManager.Uri);
}
@@ -59,7 +72,6 @@ namespace MP.Mon.Pages
#region Protected Fields
protected bool doAnimate = true;
protected int fastRefreshSec = 10;
protected int keepAliveMin = 1;
protected List<MappaStatoExpl>? ListMSE = null;
protected int maxCol = 4;
@@ -70,11 +82,8 @@ namespace MP.Mon.Pages
#region Protected Properties
protected int fastRefreshMs
{
get => 1000 * fastRefreshSec;
}
protected int fastRefreshMs= 1000;
[Inject]
protected MpDataService MMDataService { get; set; } = null!;
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MON MAPO</i>
<h4>Versione: 6.15.2207.909</h4>
<h4>Versione: 6.15.2207.910</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.15.2207.909
6.15.2207.910
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.15.2207.909</version>
<version>6.15.2207.910</version>
<url>https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/MP.Mon.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>