Represents a set of Command instances as a single operation. Undoing or redoing the composite action, respectively undoes or redoes all its constituent subactions at the same time.
Namespace: MindFusion.Spreadsheet.Wpf
Assembly: MindFusion.Spreadsheet.Wpf
C# Copy Code |
---|
public sealed class CompositeCommand : DisposableCommand |
Visual Basic Copy Code |
---|
Public NotInheritable Class CompositeCommand |
The CompositeCommand can be used to wrap up a sequence of commands into a single undoable operation. The CompositeCommand class cannot be instantiated directly. To create a CompositeCommand object, call the StartCompositeOperation method of the Workbook class. After a composite command has been started, executing other commands will register them as children of this CompositeCommand, rather than directly in the undo history. To complete the composite action, either call the CommitCompositeOperation method of the Workbook class or the Dispose method of the command itself. To cancel an active composite command (and revert all of its subactions), call the CancelCompositeOperation method of the Workbook class or the Cancel method of the command.
The following example creates a new worksheet in an existing workbook and changes the name of this new worksheet, both as a single composite operation. Note, that due to the disposable pattern, the composite command is automatically executed at the end of the using block.
C# Copy Code |
---|
using (workbook.StartCompositeOperation()) |
Visual Basic Copy Code |
---|
Using workbook.StartCompositeOperation() |
System.Object
MindFusion.Spreadsheet.Wpf.Command
MindFusion.Spreadsheet.Wpf.DisposableCommand
MindFusion.Spreadsheet.Wpf.CompositeCommand