Beispiel #1
0
        internal void OnTransactionClosed(TextUndoTransaction transaction, bool didComplete)
        {
            if (_openTransactionStack.Count == 0 || transaction != _openTransactionStack.Peek())
            {
                // Happens in dispose after complete / cancel
                return;
            }

            _openTransactionStack.Pop();
            if (!didComplete)
            {
                return;
            }

            if (_openTransactionStack.Count == 0)
            {
                _undoStack.Push(transaction);
                var list = UndoTransactionCompleted;
                if (list != null)
                {
                    list(this, new TextUndoTransactionCompletedEventArgs(null, TextUndoTransactionCompletionResult.TransactionAdded));
                }
            }
            else
            {
                foreach (var cur in transaction.UndoPrimitives)
                {
                    _openTransactionStack.Peek().UndoPrimitives.Add(cur);
                }
            }
        }
Beispiel #2
0
        internal void OnTransactionClosed(TextUndoTransaction transaction, bool didComplete)
        {
            if (_openTransactionStack.Count == 0 || transaction != _openTransactionStack.Peek())
            {
                // Happens in dispose after complete / cancel
                return;
            }

            _openTransactionStack.Pop();
            if (!didComplete)
            {
                return;
            }

            if (_openTransactionStack.Count == 0)
            {
                _undoStack.Push(transaction);
                var list = UndoTransactionCompleted;
                if (list != null)
                {
                    list(this, new TextUndoTransactionCompletedEventArgs(null, TextUndoTransactionCompletionResult.TransactionAdded));
                }
            }
            else
            {
                foreach (var cur in transaction.UndoPrimitives)
                {
                    _openTransactionStack.Peek().UndoPrimitives.Add(cur);
                }
            }
        }