using Microsoft.Web.WebView2.Core; using Microsoft.Web.WebView2.WinForms; using System; using System.Linq; namespace AIProofread.core { public class WebView2EventHandler { public static void WebView2NavigationCompleted(object sender, CoreWebView2NavigationCompletedEventArgs e) { if (e.IsSuccess) { return; } string errorPageHtml = @" 加载失败

页面加载失败

请检查您的网络连接或稍后再试。

"; if (e.NavigationId == 0) { (sender as WebView2).CoreWebView2.NavigateToString(errorPageHtml); } } } }