void NavigationFailed(WWebView sender, Web.WebView2.Core.CoreWebView2NavigationCompletedEventArgs e) { Uri uri = sender.Source; if (uri != null) { SendNavigated(new UrlWebViewSource { Url = uri.AbsoluteUri }, _eventState, WebNavigationResult.Failure); } }
void OnNavigationCompleted(WWebView sender, Web.WebView2.Core.CoreWebView2NavigationCompletedEventArgs e) { if (e.IsSuccess) { NavigationSucceeded(sender, e); } else { NavigationFailed(sender, e); } }
async void NavigationSucceeded(WWebView sender, Web.WebView2.Core.CoreWebView2NavigationCompletedEventArgs e) { // TODO WINUI3 //if (e.Uri != null) // SendNavigated(new UrlWebViewSource { Url = e.Uri.AbsoluteUri }, _eventState, WebNavigationResult.Success); Uri uri = sender.Source; if (uri != null) { SendNavigated(new UrlWebViewSource { Url = uri.AbsoluteUri }, _eventState, WebNavigationResult.Success); } UpdateCanGoBackForward(); if (Element.OnThisPlatform().IsJavaScriptAlertEnabled()) { await Control.ExecuteScriptAsync("window.alert = function(message){ window.external.notify(message); };"); } }