ICSharpCode.AvalonEdit.Document.TextDocument.EndUpdate C# (CSharp) Method

EndUpdate() public method

Ends a group of document changes.
public EndUpdate ( ) : void
return void
        public void EndUpdate()
        {
            VerifyAccess();
            if (inDocumentChanging)
                throw new InvalidOperationException("Cannot end update within document change.");
            if (beginUpdateCount == 0)
                throw new InvalidOperationException("No update is active.");
            if (beginUpdateCount == 1) {
                // fire change events inside the change group - event handlers might add additional
                // document changes to the change group
                FireChangeEvents();
                undoStack.EndUndoGroup();
                beginUpdateCount = 0;
                if (UpdateFinished != null)
                    UpdateFinished(this, EventArgs.Empty);
            } else {
                beginUpdateCount -= 1;
            }
        }

Usage Example

Esempio n. 1
0
        public void RawlyIndentLine(string indentString, ICSharpCode.AvalonEdit.Document.TextDocument document, DocumentLine line)
        {
            if (!_doBeginUpdateManually)
            {
                document.BeginUpdate();
            }

            // 1)
            int prevInd = 0;
            int curOff  = line.Offset;

            if (curOff < document.TextLength)
            {
                char curChar = '\0';
                while (curOff < document.TextLength && ((curChar = document.GetCharAt(curOff)) == ' ' || curChar == '\t'))
                {
                    prevInd++;
                    curOff++;
                }

                document.Remove(line.Offset, prevInd);
            }

            document.Insert(line.Offset, indentString);
            if (!_doBeginUpdateManually)
            {
                document.EndUpdate();
            }
        }
All Usage Examples Of ICSharpCode.AvalonEdit.Document.TextDocument::EndUpdate