This commit is contained in:
Lightczx
2023-09-21 15:03:11 +08:00
parent 2a757dce51
commit 22393b612c

View File

@@ -74,6 +74,9 @@ internal partial class WebViewer : UserControl, IRecipient<UserChangedMessage>
return;
}
// TODO: replace with .NET 8 UnsafeAccessor
try
{
CoreWebView2 coreWebView2 = WebView.CoreWebView2;
if (SourceProvider is not null)
@@ -92,10 +95,8 @@ internal partial class WebViewer : UserControl, IRecipient<UserChangedMessage>
jsInterface = serviceProvider.CreateInstance<MiHoYoJSInterface>(coreWebView2, userAndUid);
CoreWebView2Navigator navigator = new(coreWebView2);
await navigator.NavigateAsync("about:blank");
Debug.WriteLine($"Before {source}");
await navigator.NavigateAsync(source);
Debug.WriteLine($"After {WebView.Source}");
await navigator.NavigateAsync("about:blank").ConfigureAwait(true);
await navigator.NavigateAsync(source).ConfigureAwait(true);
}
}
else
@@ -104,4 +105,8 @@ internal partial class WebViewer : UserControl, IRecipient<UserChangedMessage>
}
}
}
catch (ObjectDisposedException)
{
}
}
}