cs11dotnet7/vscode/PracticalApps/Northwind.BlazorServer/Pages/Index.razor
2022-03-13 16:17:01 +00:00

40 lines
852 B
Plaintext

@page "/"
<PageTitle>Index</PageTitle>
<h1>Hello, world!</h1>
Welcome to your new app.
<SurveyPrompt Title="How is Blazor working for you?" />
<button type="button" class="btn btn-info" @onclick="AlertBrowser">
Poke the browser</button>
<hr />
<input id="colorBox" />
<button type="button" class="btn btn-info" @onclick="SetColor">
Set Color</button>
<button type="button" class="btn btn-info" @onclick="GetColor">
Get Color</button>
@code {
[Inject]
public IJSRuntime JSRuntime { get; set; } = null!;
public async Task AlertBrowser()
{
await JSRuntime.InvokeVoidAsync(
"messageBox", "Blazor poking the browser");
}
public async Task SetColor()
{
await JSRuntime.InvokeVoidAsync("setColorInStorage");
}
public async Task GetColor()
{
await JSRuntime.InvokeVoidAsync("getColorFromStorage");
}
}