Skip to content

Commit

Permalink
Fixed crash when using keyboard shortcuts the home page (#802)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsvietOK committed May 18, 2020
1 parent 2740832 commit 8cb3fd5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Files/Views/Pages/ModernShellPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ private async void ModernShellPage_KeyUp(object sender, KeyRoutedEventArgs e)
var ctrl = Window.Current.CoreWindow.GetKeyState(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down);
var alt = Window.Current.CoreWindow.GetKeyState(VirtualKey.Menu).HasFlag(CoreVirtualKeyStates.Down);
var shift = Window.Current.CoreWindow.GetKeyState(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down);
var tabInstance = App.CurrentInstance != null;
var tabInstance = App.CurrentInstance.CurrentPageType == typeof(GenericFileBrowser)
|| App.CurrentInstance.CurrentPageType == typeof(PhotoAlbum);

switch (c: ctrl, s: shift, a: alt, t: tabInstance, k: e.Key)
{
Expand Down Expand Up @@ -265,15 +266,15 @@ private async void ModernShellPage_KeyUp(object sender, KeyRoutedEventArgs e)
App.CurrentInstance.InteractionOperations.SelectAllItems();
break;

case (true, false, false, true, VirtualKey.N): //ctrl + n, new window
case (true, false, false, false, VirtualKey.N): //ctrl + n, new window
App.CurrentInstance.InteractionOperations.LaunchNewWindow();
break;

case (true, false, false, true, VirtualKey.W): //ctrl + w, close tab
case (true, false, false, false, VirtualKey.W): //ctrl + w, close tab
App.CurrentInstance.InteractionOperations.CloseTab();
break;

case (true, false, false, true, VirtualKey.F4): //ctrl + F4, close tab
case (true, false, false, false, VirtualKey.F4): //ctrl + F4, close tab
App.CurrentInstance.InteractionOperations.CloseTab();
break;

Expand Down

0 comments on commit 8cb3fd5

Please sign in to comment.