Blog/Components/Pages/BrpTestData.razor.cs 852 B · 31 lines · raw · history

1 using Blog.Models;
2 using Blog.Services;
3 using System.Linq;
4 using Microsoft.AspNetCore.Components;
5
6 namespace Blog.Components.Pages;
7
8 public partial class BrpTestData : ComponentBase, IDisposable
9 {
10 public void Dispose()
11 {
12 CancellationTokenSource.Cancel();
13 CancellationTokenSource.Dispose();
14 }
15
16 [Inject]
17 public BrpService Service { get; set; }
18
19 private CancellationTokenSource CancellationTokenSource { get; set; } = new CancellationTokenSource();
20
21 protected override async Task OnInitializedAsync()
22 {
23 this.Entries = (await Service.GetBrpEntriesAsync(CancellationTokenSource.Token)
24 .ConfigureAwait(true))
25 .Where(entry => entry.bsn[0] != '1')
26 .ToArray();
27 await base.OnInitializedAsync();
28 }
29
30 private BRPEntry[] Entries { get; set; } = [];
31 }