Exemple #1
0
        /// <summary>
        /// Undoes the last command
        /// </summary>
        public void Undo()
        {
            RunCommandTillEndWith(() =>
            {
                CurrentTransaction = this.UndoStack.Pop();

                if (this.CurrentTransaction.ExecutionConfiguration != null && this.CurrentTransaction.ExecutionConfiguration.RunInBackground)
                {
                    UnExecuteInSpawnedThread(CurrentTransaction);
                }
                else
                {
                    CurrentTransaction.UnExecute();
                }

                RedoStack.Push(CurrentTransaction);

                if (autocommit)
                {
                    this.CommitTransaction();
                }

                RaiseCanUndoRedoChanged(this, EventArgs.Empty);
            });
        }
Exemple #2
0
        /// <summary>
        /// Performs a rollback of the topmost transaction from the stack
        /// </summary>
        public void RollBackTransaction()
        {
            this.unboundedTransactionRunning = false;

            if (this.CurrentTransaction != null)
            {
                if (this.UndoStack.Count > 0)
                {
                    this.UndoStack.Pop();
                }
                else
                {
                    // this should not happen!
                }

                CurrentTransaction.UnExecute();
            }
        }