1
0

Add refresh button and automatic refreshing timer to update state.

As effect, this keeps updating the amount of people online.
This commit is contained in:
Kevin Matsubara 2025-03-29 18:10:07 +01:00
parent b041d7d244
commit 2da0063331

View File

@ -1,3 +1,5 @@
@using System.Threading;
<table class="table table-striped">
<RepeaterComponent Items="this.servers">
<Header>
@ -21,8 +23,11 @@
</RepeaterComponent>
</table>
<button type="button" class="btn btn-primary" onclick=@(() => {base.InvokeAsync(StateHasChanged);})"">Refresh</button>
@code {
private List<Server>? servers;
private Timer? Timer;
[Parameter]
public string? CityName { get; set; }
@ -80,6 +85,10 @@
}
// Render the component again by letting it know the state changed.
StateHasChanged();
Timer = new Timer(_ => {
base.InvokeAsync(StateHasChanged);
}, null, 4000, 4000);
}
}
}