/// <summary> /// Undo the last operation added. /// </summary> public void Undo() { if (this.undoStack.Count > 0) { UndoableCommand command = this.undoStack.Pop(); command.UnExecute(); this.redoStack.Push(command); } }
/// <summary> /// Undo the last operation added. /// </summary> public void Undo() { if (this.undoStack.Count > 0) { UndoableCommand command = this.undoStack.Pop(); command.UnExecute(); this.redoStack.Push(command); this.eventManager.GetEvent <OperationUndoneInTimelineEvent>().Publish(null); } }
/// <summary> /// Executes the <see cref="UndoableCommand"/> passed. /// </summary> /// <param name="command">The command beign executed.</param> public void ExecuteCommand(UndoableCommand command) { command.Execute(); if (this.undoStack.Count == this.currentUndoLevel) { this.undoStack = new Stack <UndoableCommand>(this.undoStack.Take(this.undoStack.Count - 1)); } this.undoStack.Push(command); this.redoStack.Clear(); }
/// <summary> /// Executes the <see cref="UndoableCommand"/> passed. /// </summary> /// <param name="command">The command beign executed.</param> public void ExecuteCommand(UndoableCommand command) { command.Execute(); if (this.undoStack.Count == this.currentUndoLevel) { this.undoStack = new Stack <UndoableCommand>(this.undoStack.Take(this.undoStack.Count - 1)); } this.undoStack.Push(command); this.eventManager.GetEvent <OperationExecutedInTimelineEvent>().Publish(null); this.redoStack.Clear(); }