| Name | Message | Date |
|---|---|---|
| 📄 Error.razor | 11 hours ago | |
| 📄 Home.razor | 11 hours ago | |
| 📄 NotFound.razor | 11 hours ago |
📄
Home.razor
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
@page "/"
@using Grpc.Core
@using Microsoft.Extensions.Logging
@using Receipt.Web.Services
@inject ReceiptPrinterService receiptPrinter
<PageTitle>Receipt Printer</PageTitle>
<h1>Print a receipt!</h1>
<EditForm Model="Model" OnValidSubmit="OnSubmit" FormName="PrintForm">
<p>
<label>
<span>Content:</span><br/>
<InputTextArea rows="10" cols="50" @bind-value="Model!.Content" />
</label>
</p>
<p>
<button type="submit">Print!</button>
</p>
</EditForm>
@if (Status is not null)
{
<p>@Status</p>
}
@code {
[SupplyParameterFromForm]
public PrintForm? Model { get; set; }
public string? Status { get; set; }
protected override void OnInitialized() => Model ??= new();
private async Task OnSubmit()
{
Status = await receiptPrinter.Print(Model!.Content);
if (Status is null)
{
Model = new();
}
}
public sealed record PrintForm
{
public string Content { get; set; } = string.Empty;
}
}