Selector/Selector.MAUI/Pages/Index.razor

24 lines
536 B
Plaintext

@page "/app"
@using Selector.SignalR
@inject NowHubClient nowClient
@inject NowHubCache nowCache
@inject ILogger<Index> logger
<h1>run that</h1>
@code {
protected async override Task OnInitializedAsync()
{
if (nowClient.State == Microsoft.AspNetCore.SignalR.Client.HubConnectionState.Disconnected)
{
logger.LogInformation("Starting now hub connection");
await nowClient.StartAsync();
nowCache.BindClient();
await nowClient.OnConnected();
}
}
}