//--------------------// #region Undo /// <inheritdoc/> protected override void OnUndo() { // Remove last command from the undo list, execute it and add it to the redo list IUndoCommand lastCommand = UndoBackups.Pop(); lastCommand.Undo(); RedoBackups.Push(lastCommand); }
//--------------------// #region Undo /// <summary> /// Called to undo the last change /// </summary> protected override void OnUndo() { // Remove the last backup from the undo list, then add the current backup to the redo list ICloneable toRestore = UndoBackups.Pop(); RedoBackups.Push(_currentBackup); // Restore the backup and update the current backup Content = (ICloneable)toRestore.Clone(); _currentBackup = (ICloneable)Content.Clone(); }