diff --git a/Components/Pages/Pics.razor b/Components/Pages/Pics.razor
index 256f593..284bf01 100644
--- a/Components/Pages/Pics.razor
+++ b/Components/Pages/Pics.razor
@@ -1,5 +1,7 @@
@page "/pics"
@inject State State
+@inject IJSRuntime JS
+
@@ -19,17 +21,112 @@
+
+
+
+
+
+
+
+
+
@code {
private List pics;
- private async ValueTask> GetPics(ItemsProviderRequest request) {
- // TODO: request.cancellationToken
- RestService api = new RestService();
- if(pics == null || pics.Count == 0) pics = await api.SomePics();
- var numPics = Math.Min(request.Count, pics.Count - request.StartIndex);
- return new ItemsProviderResult(pics.Skip(request.StartIndex).Take(numPics), pics.Count);
+ 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"
+ });
}
}