/// <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; } }
/// <summary> /// Loads the previous view. /// </summary> /// <param name="sender">The sender requesting the view change.</param> /// <returns>The <see cref="FileManagerCommandEventArgs"/> object used when loading the view.</returns> public virtual FileManagerCommandEventArgs LoadPreviousView(object sender) { FileManagerCommandEventArgs e = new FileManagerCommandEventArgs(FileManagerCommandName.LoadView, PreviousView); RaiseCommand(sender, e); return(e); }
/// <summary> /// Handles the CommandExecuted event raised by the FileManager control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EPiServer.Templates.Advanced.FileManager.Core.FileManagerCommandEventArgs"/> instance containing the event data.</param> void FileManager_CommandExecuted(object sender, FileManagerCommandEventArgs e) { // If the current folder changes we update the cookie crumbs if (e.CommandName == FileManagerCommandName.SelectFolder) { CreateChildControls(); } }
/// <summary> /// Handles the CommandExecuted event of the FileManager control to update button state when file checkin state changes. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EPiServer.Templates.Advanced.FileManager.Core.FileManagerCommandEventArgs"/> instance containing the event data.</param> private void FileManager_CommandExecuted(object sender, FileManagerCommandEventArgs e) { if (e.CommandName == "CheckOutSelection" || e.CommandName == "CheckInFile" || e.CommandName == "UndoCheckOutSelection") { EnableButtons(); } }
/// <summary> /// Handles the CommandExecute event of the FileManager control to update the file list when a change occur. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EPiServer.Templates.Advanced.FileManager.Core.FileManagerCommandEventArgs"/> instance containing the event data.</param> private void FileManager_CommandExecute(object sender, FileManagerCommandEventArgs e) { if (sender == this) { return; } if (e.CommandName == FileManagerCommandName.SelectFolder) { // Repopulate the file list if the current folder changed. DataBindFileList(); } }
/// <summary> /// Raises a file manager command event. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">An <see cref="EPiServer.Templates.Advanced.FileManager.Core.FileManagerCommandEventArgs"/> object that contains the event data.</param> public virtual void RaiseCommand(object sender, FileManagerCommandEventArgs e) { if (_commandExecuting != null) { _commandExecuting(sender, e); } if (e.CancelCommand) { return; } ExecuteCommand(sender, e); if (_commandExecute != null) { _commandExecute(sender, e); } if (_commandExecuted != null) { _commandExecuted(sender, e); } }