private void CoreWebView2_WebMessageReceived(object sender, Microsoft.Web.WebView2.Core.CoreWebView2WebMessageReceivedEventArgs e)
        {
            var text = e.TryGetWebMessageAsString();

            var callbackJson = JsonSerializationUtils.Deserialize(text, typeof(JsonCallbackObject)) as JsonCallbackObject;

            if (callbackJson.Method == "showMessage")
            {
                MessageBox.Show(callbackJson.Parameters[0] + "\r\n" + text, "WPF Window");
            }
        }
Ejemplo n.º 2
0
 private void WebView21_WebMessageReceived(object sender, Microsoft.Web.WebView2.Core.CoreWebView2WebMessageReceivedEventArgs e)
 {
     Console.WriteLine($"NewWindow:Msg: {e.WebMessageAsJson}");
 }