@@ -205,15 +205,16 @@ public void UpdateProgressFlyout(InteractionOperationType operationType, int amo
205
205
}
206
206
}
207
207
208
- private async void ModernShellPage_KeyUp ( object sender , KeyRoutedEventArgs e )
208
+ private async void KeyboardAccelerator_Invoked ( KeyboardAccelerator sender , KeyboardAcceleratorInvokedEventArgs args )
209
209
{
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 ) ;
213
214
var tabInstance = App . CurrentInstance . CurrentPageType == typeof ( GenericFileBrowser )
214
215
|| App . CurrentInstance . CurrentPageType == typeof ( GridViewBrowser ) ;
215
216
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 )
217
218
{
218
219
case ( true , true , false , true , VirtualKey . N ) : // ctrl + shift + n, new item
219
220
await App . AddItemDialogDisplay . ShowAsync ( ) ;
@@ -257,6 +258,18 @@ private async void ModernShellPage_KeyUp(object sender, KeyRoutedEventArgs e)
257
258
App . CurrentInstance . InteractionOperations . CloseTab ( ) ;
258
259
break ;
259
260
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
+
260
273
case ( false , false , false , true , VirtualKey . Delete ) : // delete, delete item
261
274
if ( App . CurrentInstance . ContentPage . IsItemSelected && ! App . CurrentInstance . ContentPage . isRenamingItem )
262
275
App . CurrentInstance . InteractionOperations . DeleteItem_Click ( null , null ) ;
@@ -287,7 +300,7 @@ private async void ModernShellPage_KeyUp(object sender, KeyRoutedEventArgs e)
287
300
288
301
if ( App . CurrentInstance . CurrentPageType == typeof ( GridViewBrowser ) )
289
302
{
290
- switch ( e . Key )
303
+ switch ( args . KeyboardAccelerator . Key )
291
304
{
292
305
case VirtualKey . F2 : //F2, rename
293
306
if ( App . CurrentInstance . ContentPage . IsItemSelected )
0 commit comments