@@ -205,15 +205,16 @@ public void UpdateProgressFlyout(InteractionOperationType operationType, int amo
205205 }
206206 }
207207
208- private async void ModernShellPage_KeyUp ( object sender , KeyRoutedEventArgs e )
208+ private async void KeyboardAccelerator_Invoked ( KeyboardAccelerator sender , KeyboardAcceleratorInvokedEventArgs args )
209209 {
210- var ctrl = Window . Current . CoreWindow . GetKeyState ( VirtualKey . Control ) . HasFlag ( CoreVirtualKeyStates . Down ) ;
211- var alt = Window . Current . CoreWindow . GetKeyState ( VirtualKey . Menu ) . HasFlag ( CoreVirtualKeyStates . Down ) ;
212- var shift = Window . Current . CoreWindow . GetKeyState ( VirtualKey . Shift ) . HasFlag ( CoreVirtualKeyStates . Down ) ;
210+ args . Handled = true ;
211+ var ctrl = args . KeyboardAccelerator . Modifiers . HasFlag ( VirtualKeyModifiers . Control ) ;
212+ var alt = args . KeyboardAccelerator . Modifiers . HasFlag ( VirtualKeyModifiers . Menu ) ;
213+ var shift = args . KeyboardAccelerator . Modifiers . HasFlag ( VirtualKeyModifiers . Shift ) ;
213214 var tabInstance = App . CurrentInstance . CurrentPageType == typeof ( GenericFileBrowser )
214215 || App . CurrentInstance . CurrentPageType == typeof ( GridViewBrowser ) ;
215216
216- switch ( c : ctrl , s : shift , a : alt , t : tabInstance , k : e . Key )
217+ switch ( c : ctrl , s : shift , a : alt , t : tabInstance , k : args . KeyboardAccelerator . Key )
217218 {
218219 case ( true , true , false , true , VirtualKey . N ) : // ctrl + shift + n, new item
219220 await App . AddItemDialogDisplay . ShowAsync ( ) ;
@@ -257,6 +258,18 @@ private async void ModernShellPage_KeyUp(object sender, KeyRoutedEventArgs e)
257258 App . CurrentInstance . InteractionOperations . CloseTab ( ) ;
258259 break ;
259260
261+ case ( true , false , false , true , VirtualKey . N ) : // ctrl + n, new window from layout mode
262+ App . CurrentInstance . InteractionOperations . LaunchNewWindow ( ) ;
263+ break ;
264+
265+ case ( true , false , false , true , VirtualKey . W ) : // ctrl + w, close tab from layout mode
266+ App . CurrentInstance . InteractionOperations . CloseTab ( ) ;
267+ break ;
268+
269+ case ( true , false , false , true , VirtualKey . F4 ) : // ctrl + F4, close tab from layout mode
270+ App . CurrentInstance . InteractionOperations . CloseTab ( ) ;
271+ break ;
272+
260273 case ( false , false , false , true , VirtualKey . Delete ) : // delete, delete item
261274 if ( App . CurrentInstance . ContentPage . IsItemSelected && ! App . CurrentInstance . ContentPage . isRenamingItem )
262275 App . CurrentInstance . InteractionOperations . DeleteItem_Click ( null , null ) ;
@@ -287,7 +300,7 @@ private async void ModernShellPage_KeyUp(object sender, KeyRoutedEventArgs e)
287300
288301 if ( App . CurrentInstance . CurrentPageType == typeof ( GridViewBrowser ) )
289302 {
290- switch ( e . Key )
303+ switch ( args . KeyboardAccelerator . Key )
291304 {
292305 case VirtualKey . F2 : //F2, rename
293306 if ( App . CurrentInstance . ContentPage . IsItemSelected )
0 commit comments