private async void CoreWindow_KeyDown(CoreWindow sender, KeyEventArgs args) { var ctrl = Window.Current.CoreWindow.GetKeyState(VirtualKey.Control); var shift = Window.Current.CoreWindow.GetKeyState(VirtualKey.Shift); var alt = Window.Current.CoreWindow.GetKeyState(VirtualKey.Menu); if (App.OccupiedInstance != null) { if (ctrl.HasFlag(CoreVirtualKeyStates.Down)) { if (shift.HasFlag(CoreVirtualKeyStates.Down)) { if ((App.OccupiedInstance.ItemDisplayFrame.Content as BaseLayout) != null) { switch (args.VirtualKey) { case VirtualKey.N: Window.Current.CoreWindow.KeyDown -= CoreWindow_KeyDown; await App.addItemDialog.ShowAsync(); Window.Current.CoreWindow.KeyDown += CoreWindow_KeyDown; break; } } } else { if ((App.OccupiedInstance.ItemDisplayFrame.Content as BaseLayout) != null) { switch (args.VirtualKey) { case VirtualKey.C: App.OccupiedInstance.instanceInteraction.CopyItem_ClickAsync(null, null); break; case VirtualKey.X: App.OccupiedInstance.instanceInteraction.CutItem_Click(null, null); break; case VirtualKey.V: App.OccupiedInstance.instanceInteraction.PasteItem_ClickAsync(null, null); break; case VirtualKey.A: App.OccupiedInstance.instanceInteraction.SelectAllItems(); break; } } switch (args.VirtualKey) { case VirtualKey.N: var filesUWPUri = new Uri("files-uwp:"); await Launcher.LaunchUriAsync(filesUWPUri); break; case VirtualKey.W: if (((Window.Current.Content as Frame).Content as InstanceTabsView).TabStrip.TabItems.Count == 1) { Application.Current.Exit(); } else if (((Window.Current.Content as Frame).Content as InstanceTabsView).TabStrip.TabItems.Count > 1) { ((Window.Current.Content as Frame).Content as InstanceTabsView).TabStrip.TabItems.RemoveAt(((Window.Current.Content as Frame).Content as InstanceTabsView).TabStrip.SelectedIndex); } break; } } } else if (ctrl.HasFlag(CoreVirtualKeyStates.None) && alt.HasFlag(CoreVirtualKeyStates.None)) { if ((App.OccupiedInstance.ItemDisplayFrame.Content as BaseLayout) != null) { switch (args.VirtualKey) { case VirtualKey.Delete: App.OccupiedInstance.instanceInteraction.DeleteItem_Click(null, null); break; case VirtualKey.Enter: if ((App.OccupiedInstance.ItemDisplayFrame.Content as BaseLayout).IsQuickLookEnabled) { App.OccupiedInstance.instanceInteraction.ToggleQuickLook(); } else { App.OccupiedInstance.instanceInteraction.List_ItemClick(null, null); } break; } if (App.OccupiedInstance.ItemDisplayFrame.SourcePageType == typeof(PhotoAlbum)) { switch (args.VirtualKey) { case VirtualKey.F2: if ((App.OccupiedInstance.ItemDisplayFrame.Content as BaseLayout).SelectedItems.Count > 0) { App.OccupiedInstance.instanceInteraction.RenameItem_Click(null, null); } break; } } } } } }
// Report issue private async void Button_Click_1(object sender, RoutedEventArgs e) { await Launcher.LaunchUriAsync(new Uri(@"https://github.com/duke7553/files-uwp/issues/new")); }