diff --git a/SampleApps/WV2CDPExtensionWPFSample/MainWindow.xaml b/SampleApps/WV2CDPExtensionWPFSample/MainWindow.xaml
index 0d5757d6..97c1e5b0 100644
--- a/SampleApps/WV2CDPExtensionWPFSample/MainWindow.xaml
+++ b/SampleApps/WV2CDPExtensionWPFSample/MainWindow.xaml
@@ -54,6 +54,10 @@
+
diff --git a/SampleApps/WV2CDPExtensionWPFSample/MainWindow.xaml.cs b/SampleApps/WV2CDPExtensionWPFSample/MainWindow.xaml.cs
index de469c9d..c35ab41b 100644
--- a/SampleApps/WV2CDPExtensionWPFSample/MainWindow.xaml.cs
+++ b/SampleApps/WV2CDPExtensionWPFSample/MainWindow.xaml.cs
@@ -7,6 +7,7 @@
using Microsoft.Web.WebView2.Core.DevToolsProtocolExtension;
using System.Text;
using System.Linq;
+using System.Text.Json;
namespace WV2CDPExtensionSample
{
@@ -194,6 +195,30 @@ void PrintDownloadWillBegin(object sender, Page.DownloadWillBeginEventArgs args)
{
Trace.WriteLine(String.Format("DownloadWillBegin Event Args - FrameId: {0} Guid: {1} URL: {2}", args.FrameId, args.Guid, args.Url));
}
+
+ async void SubscribeToNetworkBasics(object sender, RoutedEventArgs e)
+ {
+ await cdpHelper.Network.EnableAsync();
+ cdpHelper.Network.ResponseReceived += PrintResponseInfo;
+ cdpHelper.Network.RequestWillBeSent += PrintRequestInfo;
+ }
+
+ void PrintResponseInfo(object sender, Network.ResponseReceivedEventArgs args)
+ {
+ Trace.WriteLine(JsonSerializer.Serialize(args));
+ }
+
+ void PrintRequestInfo(object sender, Network.RequestWillBeSentEventArgs args)
+ {
+ Trace.WriteLine(JsonSerializer.Serialize(args));
+ }
+
+ async void UnsubscribeFromNetworkBasics(object sender, RoutedEventArgs e)
+ {
+ cdpHelper.Network.ResponseReceived -= PrintResponseInfo;
+ cdpHelper.Network.RequestWillBeSent -= PrintRequestInfo;
+ await cdpHelper.Network.DisableAsync();
+ }
#endregion
}
}