Quantcast
Channel: SharpDevelop Community
Viewing all articles
Browse latest Browse all 1764

Efficiently appending text in AvalonEdit

$
0
0

I would like to use AvalonEdit as output tool window view since this allows me to use hyperlinks and highlighting.

My question is, how do I efficiently append text when adding more output?

I use the code below but is there a more efficient way of doing it?

(https://edi.codeplex.com/SourceControl/latest#Tools/BuiltIn/Output/ViewModels/TextViewModel.cs)

///<summary>/// Method removes all text from the current viewmodel.///</summary>publicvoid Clear()
		{
			Application.Current.Dispatcher.BeginInvoke(new Action(delegate
			{this.mDocument.Text = string.Empty;
			}
			));
		}///<summary>/// Method appends a new line of text into the current output.///</summary>publicvoid AppendLine(string text)
		{this.Append(text + Environment.NewLine);
		}///<summary>/// Method appends text into the current output.///</summary>publicvoid Append(string text)
		{
			Application.Current.Dispatcher.BeginInvoke(new Action(delegate
					{if (text != null)this.mDocument.Text += text;
					}
			));
		}

Viewing all articles
Browse latest Browse all 1764

Trending Articles