AvalonStudio.TextEditor.Document.TextDocument.BeginUpdate C# (CSharp) Method

BeginUpdate() public method

Begins a group of document changes.

Some events are suspended until EndUpdate is called, and the UndoStack will group all changes into a single action.

Calling BeginUpdate several times increments a counter, only after the appropriate number of EndUpdate calls the events resume their work.

public BeginUpdate ( ) : void
return void
		public void BeginUpdate()
		{
			VerifyAccess();
			if (inDocumentChanging)
				throw new InvalidOperationException("Cannot change document within another document change.");
			beginUpdateCount++;
			if (beginUpdateCount == 1)
			{
				undoStack.StartUndoGroup();
				if (UpdateStarted != null)
					UpdateStarted(this, EventArgs.Empty);
			}
		}

Usage Example

Example #1
0
 internal void RegisterAffectedDocument(TextDocument document)
 {
     if (affectedDocuments == null)
     {
         affectedDocuments = new List <TextDocument>();
     }
     if (!affectedDocuments.Contains(document))
     {
         affectedDocuments.Add(document);
         document.BeginUpdate();
     }
 }
All Usage Examples Of AvalonStudio.TextEditor.Document.TextDocument::BeginUpdate