15 private readonly Guid identifier = Guid.NewGuid();
16 private bool undoRedoInProgress;
17 private bool isDone =
true;
36 public Guid Identifier {
get {
return identifier; } }
39 public string Name {
get; set; }
42 public virtual bool IsSaved {
get; set; }
45 public virtual bool IsDone {
get {
return isDone; }
protected set { isDone = value; } }
48 public bool IsFrozen {
get;
private set; }
63 if (undoRedoInProgress)
throw new InvalidOperationException(
string.Format(Properties.ExceptionMessages.InvokingUndoRedoWhileAlreadyInProgress,
"Undo"));
64 if (IsFrozen)
throw new InvalidOperationException(
string.Format(Properties.ExceptionMessages.UndoRedoOnFrozenItem,
"Undo"));
65 undoRedoInProgress =
true;
68 undoRedoInProgress =
false;
74 if (undoRedoInProgress)
throw new InvalidOperationException(
string.Format(Properties.ExceptionMessages.UndoRedoOnFrozenItem,
"Redo"));
75 if (IsFrozen)
throw new InvalidOperationException(
"Unable to invoke Undo on a frozen ActionItem.");
76 undoRedoInProgress =
true;
79 undoRedoInProgress =
false;
86 protected abstract void FreezeMembers();
91 protected abstract void UndoAction();
96 protected abstract void RedoAction();
void Undo()
Undo the action.
ActionItem()
Initializes a new instance of the ActionItem class.
Base class for action items.
void Freeze()
Freezes this ActionItem. A frozen action item can't be undone anymore and should have freed the resou...
Base interface for action items.
ActionItem(string name)
Initializes a new instance of the ActionItem class with the given name.
void Redo()
Redo the action.
This class represents a thread-safe stack of action items that can be undone/redone.