private void executeFileAction(string action, string path)
        {
            switch (action)
            {
            case CustomCommands.DirectoryActions.OpenFolder:
                if (Settings.Instance.EnableDynamicDesktop)
                {
                    _desktopManager.NavigationManager.NavigateTo(path);
                }
                else
                {
                    FolderHelper.OpenLocation(path);
                }
                break;

            case CustomCommands.Actions.Rename:
                file.RequestInteractiveRename(this);
                break;

            case CustomCommands.DirectoryActions.AddStack:
            case CustomCommands.DirectoryActions.RemoveStack:
            case CustomCommands.Actions.OpenWithShell:
                CustomCommands.PerformAction(action, path);
                break;

            default:
                if (action != CustomCommands.Actions.Cut && action != CustomCommands.Actions.Copy && action != CustomCommands.Actions.Link)
                {
                    _desktopManager.IsOverlayOpen = false;
                }

                break;
            }
        }
        private void executeFolderAction(string action, string path)
        {
            switch (action)
            {
            case CustomCommands.DirectoryActions.Paste:
            case CustomCommands.DirectoryActions.New:
                if (desktopManager.DesktopLocation != null)
                {
                    CustomCommands.PerformDirectoryAction(action, desktopManager.DesktopLocation, desktopManager.IsOverlayOpen ? (Window)desktopManager.DesktopOverlayWindow : this);
                }
                break;

            // no need to dismiss overlay for these actions
            case CustomCommands.DirectoryActions.AddStack:
            case CustomCommands.DirectoryActions.RemoveStack:
                CustomCommands.PerformAction(action, path);
                break;

            default:
                if (action != "")
                {
                    CustomCommands.PerformAction(action, path);
                    desktopManager.IsOverlayOpen = false;
                }
                break;
            }
        }
Exemple #3
0
        private void executeFileAction(string action, string path, Button sender)
        {
            SystemFile file = new SystemFile(path);

            if (action == "openFolder")
            {
                if (Settings.Instance.EnableDynamicDesktop)
                {
                    Navigate(path);
                }
                else
                {
                    FolderHelper.OpenLocation(path);
                }
            }
            else if (action == "rename" || action == "addStack" || action == "removeStack" || action == "openWithShell")
            {
                CustomCommands.PerformAction(action, path, sender);
            }
            else if (action != "cut" && action != "copy" && action != "link")
            {
                if (Startup.DesktopWindow != null)
                {
                    Startup.DesktopWindow.IsOverlayOpen = false;
                }
            }
        }
Exemple #4
0
 private void executeFileAction(string action, string path)
 {
     if (action == "openFolder")
     {
         if (Settings.Instance.EnableDynamicDesktop)
         {
             DesktopManager.Instance.NavigationManager.NavigateTo(path);
         }
         else
         {
             FolderHelper.OpenLocation(path);
         }
     }
     else if (action == "rename")
     {
         file.RequestInteractiveRename(this);
     }
     else if (action == "addStack" || action == "removeStack" || action == "openWithShell")
     {
         CustomCommands.PerformAction(action, path);
     }
     else if (action != "cut" && action != "copy" && action != "link")
     {
         DesktopManager.Instance.IsOverlayOpen = false;
     }
 }
Exemple #5
0
        private void HandleFolderAction(uint action, string path)
        {
            // TODO: Use command system
            switch (action)
            {
            case (uint)CommonContextMenuItem.Paste:
                _fileWorker.PasteFromClipboard(path);
                break;

            case (uint)CommonContextMenuItem.Properties:
                _desktopManager.IsOverlayOpen = false;
                CustomCommands.PerformAction(CustomCommands.Actions.Properties, path);
                break;

            case (uint)CairoContextMenuItem.OpenInNewWindow:
                _desktopManager.IsOverlayOpen = false;
                CustomCommands.PerformAction(CustomCommands.Actions.OpenWithShell, path);
                break;

            case (uint)CairoContextMenuItem.DisplaySettings:
                _desktopManager.IsOverlayOpen = false;
                CustomCommands.PerformAction(CustomCommands.Actions.DisplaySettings, path);
                break;

            case (uint)CairoContextMenuItem.Personalize when EnvironmentHelper.IsAppRunningAsShell:
                _desktopManager.IsOverlayOpen = false;
                _settingsUiService?.Show("desktop");
                break;

            case (uint)CairoContextMenuItem.Personalize:
                _desktopManager.IsOverlayOpen = false;
                CustomCommands.PerformAction(CustomCommands.Actions.Personalize, path);
                break;

            case (uint)CairoContextMenuItem.AddToStacks:
                CustomCommands.PerformAction(CustomCommands.Actions.AddStack, path);
                break;

            case (uint)CairoContextMenuItem.RemoveFromStacks:
                CustomCommands.PerformAction(CustomCommands.Actions.RemoveStack, path);
                break;

            default:
                // must be "New" menu
                CairoApplication.Current.Dispatcher.Invoke(() =>
                {
                    if (_desktopManager.IsOverlayOpen)
                    {
                        _desktopManager.DesktopOverlayWindow.Activate();
                    }
                    else
                    {
                        Activate();
                    }
                });
                // watch for new file to be created so we can perform an action
                _desktopManager.DesktopLocation.Files.CollectionChanged += ShellNew_FileCreated;
                break;
            }
        }
Exemple #6
0
        private void executeFolderAction(string action, string path)
        {
            if (action == "paste")
            {
                Icons.Location.PasteFromClipboard();
            }
            else if (action == "openWithShell")
            {
                FolderHelper.OpenWithShell(path);
            }
            else if (action == "addStack" || action == "removeStack")
            {
                CustomCommands.PerformAction(action, path);
                // no need to dismiss overlay for this action
            }
            else if (action != "")
            {
                CustomCommands.PerformAction(action, path);

                if (Startup.DesktopWindow != null)
                {
                    Startup.DesktopWindow.IsOverlayOpen = false;
                }
            }
        }
 private void executeFileAction(string action, string path, FrameworkElement sender)
 {
     if (action == "openFolder")
     {
         if (Settings.Instance.EnableDynamicDesktop)
         {
             WindowManager.Instance.DesktopWindow.NavigationManager.NavigateTo(path);
         }
         else
         {
             FolderHelper.OpenLocation(path);
         }
     }
     else if (action == "rename")
     {
         enterRename();
     }
     else if (action == "addStack" || action == "removeStack" || action == "openWithShell")
     {
         CustomCommands.PerformAction(action, path);
     }
     else if (action != "cut" && action != "copy" && action != "link")
     {
         WindowManager.Instance.DesktopWindow.IsOverlayOpen = false;
     }
 }
Exemple #8
0
        private void UserControl_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
        {
            if (IsRenaming)
            {
                return;
            }

            switch (e.Key)
            {
            // [Ctrl] + [C] => Copy
            case Key.C when Keyboard.Modifiers.HasFlag(ModifierKeys.Control):
                CustomCommands.PerformAction(CustomCommands.Actions.Copy, file.Path);

                break;

            // [Ctrl] + [X] => Cut
            case Key.X when Keyboard.Modifiers.HasFlag(ModifierKeys.Control):
                // TODO: Not yet implemented
                //CustomCommands.PerformAction(CustomCommands.Actions.Cut, file.Path);
                break;

            // [Ctrl] + [V] => Paste
            case Key.V when Keyboard.Modifiers.HasFlag(ModifierKeys.Control):
                if (file.IsFolder)
                {
                    // TODO: Paste item into folder?
                }

                break;

            // TODO: [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.Path);

                break;

            // [Delete] => Delete an item and place it into the Recycle Bin
            case Key.Delete:
                CustomCommands.PerformAction(CustomCommands.Actions.Delete, file.Path);
                break;

            // TODO: [Alt] + [Enter] => Open file properties
            case Key.Enter when Keyboard.Modifiers.HasFlag(ModifierKeys.Alt):
                CustomCommands.PerformAction(CustomCommands.Actions.Properties, file.Path);

                break;

            // [Enter] => Open file
            case Key.Enter:
                CustomCommands.PerformAction(CustomCommands.Actions.Open, file.Path);
                break;

            // TODO: [F2] => Rename Item. Select name excluding file extension
            case Key.F2:
                CustomCommands.PerformAction(CustomCommands.Actions.Rename, file.Path);
                break;
            }
        }
        private void miVerb_Click(object sender, RoutedEventArgs e)
        {
            MenuItem item = sender as MenuItem;
            string   verb = item.Tag as string;

            if (verb == CustomCommands.Actions.Rename)
            {
                enterRename();
            }
            else
            {
                CustomCommands.PerformAction(verb, file.FullName);
            }

            _desktopManager.IsOverlayOpen = false;
        }
Exemple #10
0
        private void executeCustomAction(string action, string path)
        {
            if (action == "paste")
            {
                Icons.Location.PasteFromClipboard();
            }
            else if (action != "")
            {
                CustomCommands.PerformAction(action, path);

                if (Startup.DesktopWindow != null)
                {
                    Startup.DesktopWindow.IsOverlayOpen = false;
                }
            }
        }
        private void executeFolderAction(string action, string path)
        {
            if (action == "paste")
            {
                Icons.Location.PasteFromClipboard();
            }
            else if (action == "addStack" || action == "removeStack")
            {
                // no need to dismiss overlay for these actions
                CustomCommands.PerformAction(action, path);
            }
            else if (action != "")
            {
                CustomCommands.PerformAction(action, path);

                IsOverlayOpen = false;
            }
        }
Exemple #12
0
        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();
                return(true);    // don't reset LastIconSelected yet so that we can tell that it entered rename mode

            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:
                        FolderHelper.OpenLocation(items[0].Path);
                        handled = true;
                        break;
                    }
                }
                break;
            }

            LastIconSelected = null;
            return(handled);
        }
        private void miVerb_Click(object sender, RoutedEventArgs e)
        {
            MenuItem item = sender as MenuItem;
            string   verb = item.Tag as string;

            if (verb == "rename")
            {
                enterRename();
            }
            else
            {
                CustomCommands.PerformAction(verb, file.FullName);
            }

            if (WindowManager.Instance.DesktopWindow != null)
            {
                WindowManager.Instance.DesktopWindow.IsOverlayOpen = false;
            }
        }
Exemple #14
0
        private void executeFolderAction(string action, string path)
        {
            if (action == "paste" || action == "new")
            {
                if (desktopManager.DesktopLocation != null)
                {
                    CustomCommands.PerformDirectoryAction(action, desktopManager.DesktopLocation, desktopManager.IsOverlayOpen ? (Window)desktopManager.DesktopOverlayWindow : this);
                }
            }
            else if (action == "addStack" || action == "removeStack")
            {
                // no need to dismiss overlay for these actions
                CustomCommands.PerformAction(action, path);
            }
            else if (action != "")
            {
                CustomCommands.PerformAction(action, path);

                desktopManager.IsOverlayOpen = false;
            }
        }
Exemple #15
0
        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 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;
            }
        }