private void ctxFile_Loaded(object sender, RoutedEventArgs e) { CustomCommands.Icon_ContextMenu_Loaded(sender, e); }
private bool HandleFileAction(string action, ShellItem[] items, bool allFolders) { // TODO: Use command system if (items.Length < 1) { return(false); } bool handled = false; switch (action) { case CustomCommands.Actions.Rename: LastIconSelected?.BeginRename(); handled = true; break; default: // handle Cairo actions if (uint.TryParse(action, out uint cairoAction)) { switch ((CairoContextMenuItem)cairoAction) { case CairoContextMenuItem.AddToStacks: CustomCommands.PerformAction(CustomCommands.Actions.AddStack, items[0].Path); handled = true; break; case CairoContextMenuItem.RemoveFromStacks: CustomCommands.PerformAction(CustomCommands.Actions.RemoveStack, items[0].Path); handled = true; break; case CairoContextMenuItem.OpenOnDesktop: if (Settings.Instance.EnableDynamicDesktop) { _desktopManager.NavigationManager.NavigateTo(items[0].Path); } else { FolderHelper.OpenLocation(items[0].Path); } handled = true; break; default: // these actions are handled for us, but we should hide the desktop overlay _desktopManager.IsOverlayOpen = false; break; } } else if (action != CustomCommands.Actions.Cut && action != CustomCommands.Actions.Copy && action != CustomCommands.Actions.Delete) { // these actions are handled for us, but we should hide the desktop overlay _desktopManager.IsOverlayOpen = false; } break; } LastIconSelected = null; return(handled); }
private void miVerb_Click(object sender, RoutedEventArgs e) { CustomCommands.Icon_MenuItem_Click(sender, e); }
private void UserControl_KeyUp(object sender, System.Windows.Input.KeyEventArgs e) { switch (e.Key) { // [Ctrl] + [C] => Copy case Key.C when Keyboard.Modifiers.HasFlag(ModifierKeys.Control): CustomCommands.PerformAction(CustomCommands.Actions.Copy, file.FullName); break; // [Ctrl] + [X] => Cut case Key.X when Keyboard.Modifiers.HasFlag(ModifierKeys.Control): CustomCommands.PerformAction(CustomCommands.Actions.Cut, file.FullName); break; // [Ctrl] + [V] => Paste case Key.V when Keyboard.Modifiers.HasFlag(ModifierKeys.Control): if (file.IsDirectory) { // Paste item into folder? } break; // [Ctrl] + [Z] => Undo an action case Key.Z when Keyboard.Modifiers.HasFlag(ModifierKeys.Control): break; // [Ctrl] + [Y] => Redo an action case Key.Y when Keyboard.Modifiers.HasFlag(ModifierKeys.Control): break; // [Shift] + [Delete] => Delete an item permanently without placing it into the Recycle Bin case Key.Delete when Keyboard.Modifiers.HasFlag(ModifierKeys.Shift): CustomCommands.PerformAction(CustomCommands.Actions.Delete, file.FullName); break; // [Delete] => Delete an item and place it into the Recycle Bin case Key.Delete: CustomCommands.PerformAction(CustomCommands.Actions.Delete, file.FullName); break; // [Enter] => Open file properties case Key.Enter when Keyboard.Modifiers.HasFlag(ModifierKeys.Alt): CustomCommands.PerformAction(CustomCommands.Actions.Properties, file.FullName); break; // [Enter] => Open file case Key.Enter: CustomCommands.PerformAction(CustomCommands.Actions.Open, file.FullName); break; // [F2] => Rename Item. Select name excluding file extension case Key.F2: CustomCommands.PerformAction(CustomCommands.Actions.Rename, file.FullName); break; } }