update secondi che pulsano

This commit is contained in:
Samuele Locatelli
2023-01-13 11:36:05 +01:00
parent 9c089aad42
commit e39e62e4cc
2 changed files with 24 additions and 3 deletions
+9 -1
View File
@@ -3,7 +3,15 @@
<span>@($"{dtCurr:dddd dd MMMM}")</span>
</div>
<div class="ora">
<span>@($"{dtCurr:HH}:{dtCurr:mm}")</span>
<div class="d-flex justify-content-center">
<div>
@($"{dtCurr:HH}")
</div>
<div class="@cssSec">:</div>
<div>
@($"{dtCurr:mm}")
</div>
</div>
</div>
@if (showAction)
{
+15 -2
View File
@@ -52,11 +52,13 @@ namespace GPW.CORE.Smart.Components
});
pUpd.Wait();
}
public void ElapsedTimerUi(object? source, System.Timers.ElapsedEventArgs e)
{
var pUpd = Task.Run(async () =>
{
dtCurr = DateTime.Now;
cssSec = (dtCurr.Second % 2 == 0) ? "text-light" : "text-dark";
await Task.Delay(1);
await InvokeAsync(() => StateHasChanged());
});
@@ -71,23 +73,34 @@ namespace GPW.CORE.Smart.Components
timbTimer.Enabled = true;
timbTimer.Start();
}
public void StartTimerUI()
{
// timer che scatta dopo 3sec
uiTimer = new System.Timers.Timer(2000);
uiTimer = new System.Timers.Timer(1000);
uiTimer.Elapsed += ElapsedTimerUi;
uiTimer.Enabled = true;
uiTimer.AutoReset = true;
uiTimer.Start();
}
#endregion Public Methods
#region Protected Properties
protected string cssSec { get; set; } = "text-light";
#endregion Protected Properties
#region Protected Methods
protected override void OnInitialized()
{
base.OnInitialized();
StartTimerUI();
}
#endregion Public Methods
#endregion Protected Methods
#region Private Fields