? DotNetRef { get; set; }
+ protected override void OnAfterRender(bool firstRender) {
+ base.OnAfterRender(firstRender);
+ if (firstRender) {
+ // See warning about memory above in the article
+ DotNetRef = DotNetObjectReference.Create(State);
+ JS.InvokeVoidAsync("injectCSharp", DotNetRef);
+ }
+ }
+
protected override void OnInitialized() {
base.OnInitialized();
NavigatorService.NavigationManager = NavigationManager;
@@ -25,11 +95,12 @@
}
else if (!string.IsNullOrEmpty(State.SharePhoto)) {
NavigationManager.NavigateTo($"/sharepic/{State.SharePhoto}");
- State.ShareString = null;
+ State.SharePhoto = null;
}
}
void IDisposable.Dispose() {
State.IntentReceived -= IntentRecieved;
+ DotNetRef?.Dispose();
}
}
diff --git a/Components/Pages/Person.razor b/Components/Pages/Person.razor
index 9c46b7f..d39e021 100644
--- a/Components/Pages/Person.razor
+++ b/Components/Pages/Person.razor
@@ -3,6 +3,7 @@
@inject IJSRuntime JS
@inject NavigationManager Nav
+
@Address
@@ -51,7 +52,7 @@
}
-
+
@if(Address == State.SelectedAddressName) {