Class HistoryManager
This class allows the user to simply implement Undo\Redo engine. To achieve this, class that supports Undo\Redo must implement ISuppportHistory interface and ICommand interface, which will actually execute specified actions for each undo\redo step. HistoryManager supports executing more undo\redo actions as one block. Use BeginBlock(), CloseBlock() for this.
Implements
Inherited Members
Namespace: Syncfusion.Windows.Forms
Assembly: Syncfusion.Tools.Windows.dll
Syntax
public class HistoryManager : IHistoryManager
Constructors
HistoryManager()
Initializes a new instance of the HistoryManager class.
Declaration
public HistoryManager()
Properties
CanRedo
Gets a value indicating whether Redo Command list is not empty. Returns true if not empty; false otherwise.
Declaration
public bool CanRedo { get; }
Property Value
Type |
---|
System.Boolean |
CanUndo
Gets a value indicating whether Undo Commands list is not empty. Returns true if not empty; false otherwise.
Declaration
public bool CanUndo { get; }
Property Value
Type |
---|
System.Boolean |
IsBlockOpened
Gets a value indicating whether the block of commands is opened.
Declaration
protected bool IsBlockOpened { get; }
Property Value
Type |
---|
System.Boolean |
Methods
BeginBlock()
Begins block of commands. User may add more than one command to Undo\Redo list and unite them into one command, e.g. : Each Opened block must be closed. Block of commands may be opened multiple times, but IT MUST BE CLOSED that many times as it was opened.
Declaration
public void BeginBlock()
Remarks
BeginBlock();
// add action1
// .....
BeginBlock();
//......
EndBlock();
// add actionN
CloseBlock();
CloseBlock()
Closes block of commands.
Declaration
public void CloseBlock()
Remarks
See BeginBlock() for more details.
Do(ICommand)
Adds command to history list.
Declaration
public void Do(ICommand cmd)
Parameters
Type | Name | Description |
---|---|---|
ICommand | cmd | Command to add. |
Redo()
Performs Redo operation.
Declaration
public bool Redo()
Returns
Type | Description |
---|---|
System.Boolean | True if successful; false otherwise. |
Reset()
Resets history.
Declaration
public void Reset()
ResetRedoStack()
Resets the Redo Stack
Declaration
public void ResetRedoStack()
ResetUndoStack()
Resets the Undo Stack
Declaration
public void ResetUndoStack()
RollBack()
Rolls back non-closed block.
Declaration
public void RollBack()
Undo()
Performs UnDo operation.
Declaration
public bool Undo()
Returns
Type | Description |
---|---|
System.Boolean | True if successful; false otherwise. |