@page "/pics" @inject State State @inject IJSRuntime JS

Some.pics

Sit back, relax, and look at some.pics

@* *@
@code { private List pics; private DotNetObjectReference? objRef; protected override void OnInitialized() { objRef = DotNetObjectReference.Create(this); } protected override async Task OnAfterRenderAsync(bool firstRender) { await base.OnAfterRenderAsync(firstRender); if (firstRender) { await JS.InvokeVoidAsync("setDotNetHelper", objRef); RestService api = new RestService(); if (pics == null || pics.Count == 0) pics = await api.SomePics(); int page_size = 1; for(int i = 0; i < pics.Count; i += page_size) { await JS.InvokeVoidAsync("renderPics", pics.Skip(i * page_size).Take(page_size)); } await JS.InvokeVoidAsync("clearLoading"); } } [JSInvokable] public async Task ShareClick(string? url, string? description) { await Share.Default.RequestAsync(new ShareTextRequest { Uri = url, Text = description, Title = "I saw this on some.pics", Subject = "I saw this on some.pics" }); } }