Fix blink WASM client

This commit is contained in:
Samuele Locatelli
2022-07-12 17:07:10 +02:00
parent e8e3d63d09
commit cbbdc8e8d8
3 changed files with 31 additions and 7 deletions
@@ -18,15 +18,15 @@ namespace MP.WASM.Mon.Client.Components
var pUpd = Task.Run(async () =>
{
await Task.Delay(1);
await InvokeAsync(StateHasChanged);
await InvokeAsync(() => StateHasChanged());
});
pUpd.Wait();
Log.Trace($"Elapsed Timer Footer");
//Log.Trace($"Elapsed Timer Footer");
}
public void StartTimer()
{
int tOutPeriod = 1000;
int tOutPeriod = 5000;
//int.TryParse(Configuration["ReloadStatusTimer"], out tOutPeriod);
aTimer = new System.Timers.Timer(tOutPeriod);
aTimer.Elapsed += ElapsedTimer;
@@ -1,12 +1,12 @@
<div class="px-2">
<img class="logoImg img-fluid" src="images/LogoMapo.png" width="80" />
<img class="logoImg img-fluid" src="images/LogoMapo.png" height="24" />
<span class="mainHead p-3"><b><span style="color: #DEDEDE;">MP MON</span>itor</b></span>
</div>
<div class="px-2">
<span id="text-white text-right">
@($"{DateTime.Now:dddd dd MMMM yyyy}")
</span>
<img class="logoImg img-fluid" src="images/logoCliente.png" width="32" />
<img class="logoImg img-fluid" src="images/logoCliente.png" height="24" />
EgalWare
</div>
@@ -32,6 +32,24 @@ namespace MP.WASM.Mon.Client.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
@@ -74,7 +92,7 @@ namespace MP.WASM.Mon.Client.Components
{
Log.Trace($"Elapsed Timer {CurrRecord?.CodMacchina}");
}
await InvokeAsync(StateHasChanged);
await InvokeAsync(() => StateHasChanged());
}
OldRecord = CurrRecord;
});
@@ -157,7 +175,7 @@ namespace MP.WASM.Mon.Client.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.WASM.Mon.Client.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";
}