'Declaration Public Overloads Function AddChange( _ ByVal description As String, _ ByVal detailedDescription As String, _ ByVal undoMethod As Func(Of Boolean), _ ByVal redoMethod As Func(Of Boolean), _ Optional ByVal target As Object _ ) As UndoUnit
public UndoUnit AddChange( string description, string detailedDescription, Func<bool> undoMethod, Func<bool> redoMethod, object target )
Exception | Description |
---|---|
System.ArgumentNullException | The 'undoMethod' and 'redoMethod' parameters cannot be null. |
This overload creates an undo unit that will execute the undoMethod when an Undo operation is being performed and will execute the redoMethod when a Redo operation is being performed. If the operation is successful (i.e. the method returns true) the UndoUnit will add itself back into the history.
Note: Since an explicit description is passed in, the string should be applicable to both undo and redo operatoins. For example one might use "Bold" or "Toggle Bold" instead of "Enable Bold"/"Disable Bold" since the latter might not be correct if the change is being created for the redo stack. If you do want to use a string specific to the context then you might decide which description to provide by evaluating the IsPerformingRedo property.
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2