Beispiel #1
0
        /// <summary>
        /// Called by the FileManager control to execute a command.
        /// </summary>
        /// <param name="sender">The sender of the event.</param>
        /// <param name="e">The <see cref="EPiServer.Templates.Advanced.FileManager.Core.FileManagerCommandEventArgs"/> instance containing the event data.</param>
        protected virtual void ExecuteCommand(object sender, FileManagerCommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case FileManagerCommandName.LoadView:
                // Loading a new view so the state of the old view should be cleared.
                LoadView((string)e.CommandArguments, true);
                break;

            case FileManagerCommandName.SelectFolder:
                CurrentVirtualPath = (string)e.CommandArguments;
                ClearFileVersionSelection();
                break;

            case FileManagerCommandName.CopySelection:
                PasteBuffer.Clear();
                SelectedItems.CopyTo(PasteBuffer);
                PasteMode = PasteMode.Copy;
                break;

            case FileManagerCommandName.CutSelection:
                PasteBuffer.Clear();
                SelectedItems.CopyTo(PasteBuffer);
                PasteMode = PasteMode.Cut;
                break;

            case FileManagerCommandName.PasteItems:
                FileSystemUtility.PasteFiles(PasteBuffer, CurrentVirtualDirectory, PasteMode);
                // Reset the paste buffer
                PasteBuffer.Clear();
                PasteMode = PasteMode.Copy;
                break;

            case FileManagerCommandName.DeleteSelection:
                FileSystemUtility.DeleteItems(SelectedItems);
                SelectedItems.Clear();
                ClearFileVersionSelection();
                break;

            case FileManagerCommandName.DeleteVersion:
                FileSystemUtility.DeleteVersion(SingleSelectedFile as IVersioningFile, SelectedFileVersionId);
                ClearFileVersionSelection();
                break;

            case FileManagerCommandName.RestoreVersion:
                FileSystemUtility.RestoreVersion(SingleSelectedFile as IVersioningFile, SelectedFileVersionId);
                ClearFileVersionSelection();
                break;

            case FileManagerCommandName.CheckoutSelection:
                FileSystemUtility.CheckoutItems(SelectedItems);
                ClearFileVersionSelection();
                break;

            case FileManagerCommandName.UndoCheckoutSelection:
                FileSystemUtility.UndoCheckoutItems(SelectedItems);
                ClearFileVersionSelection();
                break;
            }
        }