@@ -83,10 +83,6 @@ public partial class MainWindow : Window
8383 public static RoutedCommand ExtensionsCommand = new RoutedCommand ( ) ;
8484 public static RoutedCommand TrackingPreventionLevelCommand = new RoutedCommand ( ) ;
8585 public static RoutedCommand EnhancedSecurityModeLevelCommand = new RoutedCommand ( ) ;
86- public static RoutedCommand EnhancedSecurityModeGetBypassListCommand = new RoutedCommand ( ) ;
87- public static RoutedCommand EnhancedSecurityModeSetBypassListCommand = new RoutedCommand ( ) ;
88- public static RoutedCommand EnhancedSecurityModeGetEnforceListCommand = new RoutedCommand ( ) ;
89- public static RoutedCommand EnhancedSecurityModeSetEnforceListCommand = new RoutedCommand ( ) ;
9086 public static RoutedCommand WebRtcUdpPortConfigCommand = new RoutedCommand ( ) ;
9187 public static RoutedCommand PrintDialogCommand = new RoutedCommand ( ) ;
9288 public static RoutedCommand PrintToDefaultPrinterCommand = new RoutedCommand ( ) ;
@@ -1022,22 +1018,31 @@ void SetTrackingPreventionLevel(CoreWebView2TrackingPreventionLevel value)
10221018 }
10231019 // <SetTrackingPreventionLevel>
10241020
1025-
10261021 void EnhancedSecurityModeLevelCommandExecuted ( object target , ExecutedRoutedEventArgs e )
10271022 {
1023+ #if USE_WEBVIEW2_EXPERIMENTAL
1024+ string level = e . Parameter . ToString ( ) ;
1025+ if ( level == "Off" )
1026+ {
1027+ SetEnhancedSecurityModeLevel ( CoreWebView2EnhancedSecurityModeLevel . Off ) ;
1028+ }
1029+ else
1030+ {
1031+ SetEnhancedSecurityModeLevel ( CoreWebView2EnhancedSecurityModeLevel . Strict ) ;
1032+ }
1033+ #endif
10281034 }
1029- void EnhancedSecurityModeGetBypassListCommandExecuted ( object target , ExecutedRoutedEventArgs e )
1030- {
1031- }
1032- void EnhancedSecurityModeSetBypassListCommandExecuted ( object target , ExecutedRoutedEventArgs e )
1033- {
1034- }
1035- void EnhancedSecurityModeGetEnforceListCommandExecuted ( object target , ExecutedRoutedEventArgs e )
1036- {
1037- }
1038- void EnhancedSecurityModeSetEnforceListCommandExecuted ( object target , ExecutedRoutedEventArgs e )
1035+
1036+ #if USE_WEBVIEW2_EXPERIMENTAL
1037+ // <SetEnhancedSecurityModeLevel>
1038+ void SetEnhancedSecurityModeLevel ( CoreWebView2EnhancedSecurityModeLevel value )
10391039 {
1040+ WebViewProfile . EnhancedSecurityModeLevel = value ;
1041+ MessageBox . Show ( this , "Enhanced security mode level is set successfully" , "Enhanced Security Mode Level" ) ;
10401042 }
1043+ // <SetEnhancedSecurityModeLevel>
1044+ #endif
1045+
10411046 void WebRtcUdpPortConfigCommandExecuted ( object target , ExecutedRoutedEventArgs e )
10421047 {
10431048#if USE_WEBVIEW2_EXPERIMENTAL
0 commit comments