示例#1
0
        //--------------------//

        #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);
        }
示例#2
0
        /// <summary>
        /// Called to redo the last undone change
        /// </summary>
        protected override void OnRedo()
        {
            // Remove the last backup from the redo list, then add the current backup to the undo list
            ICloneable toRestore = RedoBackups.Pop();

            UndoBackups.Push(_currentBackup);

            // Restore the backup and update the current backup
            Content        = (ICloneable)toRestore.Clone();
            _currentBackup = (ICloneable)Content.Clone();
        }