private void CreateSaveManager(string filePath) { RangeList = new TextRangeList <TextRange>(Document); SaveManager = new SaveManager(); Thread = new Thread(() => SaveManager.DoStart(filePath, RangeList)); Thread.SetApartmentState(ApartmentState.STA); Thread.Start(); }
//private int PreviousCarrentPositionOffset; //private int SelectionEndPosition; // private byte[] Buffer; public void DoStart(string filePath, TextRangeList <TextRange> mainList) { FilePath = filePath; Document = new FlowDocument(); List = new TextRangeList <TextRange>(Document); MainList = mainList; AttachEventHandler(); }
public void SynchronizeTo(int from, TextRangeList <T> list) { int count = list.Count; for (int i = from; i < count; i++) { if (Count > i && IsEquals(list[i], this[i], list.Document.Dispatcher)) { continue; } if (Count <= i) { MainList.Add((T)LoadTextRange(new TextRange(Document.ContentEnd, Document.ContentEnd), list.SereaLize(i))); continue; } LoadTextRange(this[i], list.SereaLize(i)); } }