update secondi che pulsano
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user