本文整理汇总了C#中ICSharpCode.AvalonEdit.Document.TextDocument.CreateSnapshot方法的典型用法代码示例。如果您正苦于以下问题:C# TextDocument.CreateSnapshot方法的具体用法?C# TextDocument.CreateSnapshot怎么用?C# TextDocument.CreateSnapshot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICSharpCode.AvalonEdit.Document.TextDocument
的用法示例。
在下文中一共展示了TextDocument.CreateSnapshot方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NoChanges
public void NoChanges()
{
TextDocument document = new TextDocument("initial text");
ITextSource snapshot1 = document.CreateSnapshot();
ITextSource snapshot2 = document.CreateSnapshot();
Assert.AreEqual(0, snapshot1.Version.CompareAge(snapshot2.Version));
Assert.AreEqual(0, snapshot1.Version.GetChangesTo(snapshot2.Version).Count());
Assert.AreEqual(document.Text, snapshot1.Text);
Assert.AreEqual(document.Text, snapshot2.Text);
}
示例2: NoChanges
public void NoChanges()
{
TextDocument document = new TextDocument("initial text");
ChangeTrackingCheckpoint checkpoint1, checkpoint2;
ITextSource snapshot1 = document.CreateSnapshot(out checkpoint1);
ITextSource snapshot2 = document.CreateSnapshot(out checkpoint2);
Assert.AreEqual(0, checkpoint1.CompareAge(checkpoint2));
Assert.AreEqual(0, checkpoint1.GetChangesTo(checkpoint2).Count());
Assert.AreEqual(document.Text, snapshot1.Text);
Assert.AreEqual(document.Text, snapshot2.Text);
}
示例3: BackwardChanges
public void BackwardChanges()
{
TextDocument document = new TextDocument("initial text");
ITextSource snapshot1 = document.CreateSnapshot();
document.Replace(0, 7, "nw");
document.Insert(1, "e");
ITextSource snapshot2 = document.CreateSnapshot();
Assert.AreEqual(1, snapshot2.Version.CompareAge(snapshot1.Version));
TextChangeEventArgs[] arr = snapshot2.Version.GetChangesTo(snapshot1.Version).ToArray();
Assert.AreEqual(2, arr.Length);
Assert.AreEqual("", arr[0].InsertedText.Text);
Assert.AreEqual("initial", arr[1].InsertedText.Text);
Assert.AreEqual("initial text", snapshot1.Text);
Assert.AreEqual("new text", snapshot2.Text);
}
示例4: BackwardChanges
public void BackwardChanges()
{
TextDocument document = new TextDocument("initial text");
ChangeTrackingCheckpoint checkpoint1, checkpoint2;
ITextSource snapshot1 = document.CreateSnapshot(out checkpoint1);
document.Replace(0, 7, "nw");
document.Insert(1, "e");
ITextSource snapshot2 = document.CreateSnapshot(out checkpoint2);
Assert.AreEqual(1, checkpoint2.CompareAge(checkpoint1));
DocumentChangeEventArgs[] arr = checkpoint2.GetChangesTo(checkpoint1).ToArray();
Assert.AreEqual(2, arr.Length);
Assert.AreEqual("", arr[0].InsertedText);
Assert.AreEqual("initial", arr[1].InsertedText);
Assert.AreEqual("initial text", snapshot1.Text);
Assert.AreEqual("new text", snapshot2.Text);
}