MindFusion.Wpf Pack Programmer's Guide
CompositeCommand Class
Remarks See Also
 





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

 Syntax

C#  Copy Code

public sealed class CompositeCommand : DisposableCommand

Visual Basic  Copy Code

Public NotInheritable Class CompositeCommand
    Inherits DisposableCommand

 Remarks

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.

 Example

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())
{
    var worksheet = workbook.Worksheets.Add();
    using (workbook.StartChangeOperation(worksheet))
        worksheet.Name = "My worksheet";
}

Visual Basic  Copy Code

Using workbook.StartCompositeOperation()
    Dim worksheet = workbook.Worksheets.Add()
    Using workbook.StartChangeOperation(worksheet)
        worksheet.Name = "My worksheet"
    End Using
End Using

 Inheritance Hierarchy

System.Object
    MindFusion.Spreadsheet.Wpf.Command
        MindFusion.Spreadsheet.Wpf.DisposableCommand
            MindFusion.Spreadsheet.Wpf.CompositeCommand

 See Also

CompositeCommand Members
MindFusion.Spreadsheet.Wpf Namespace