Esempio n. 1
0
        public void SynchronizeTo(int from, TextRangeList <T> list)
        {
            //list.Document.Dispatcher.Invoke(() =>
            //{
            //    string s = "";
            //    for (int i = 0; i < list.Count; i++)
            //    {
            //        s += list[i].Text;
            //    }
            //    Console.WriteLine("IN UI {0}", s);
            //});
            MainList.Clear();//RemoveRange(from, MainList.Count - from);
            new TextRange(/*from > 0 ? MainList[from - 1].End :*/ Document.ContentStart, Document.ContentEnd).Text = "";
            //if (!MainList.Any())
            //{
            //    MainList.RemoveRange(from, MainList.Count - from);
            //      new TextRange(MainList[from].End, Document.ContentEnd).Text = "";
            //}
            // Document.ContentEnd = Document.ContentStart;
            //  new TextRange(Document.ContentStart, Document.ContentEnd) =
            int count = list.Count;

            for (int i = 0; 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));
            }
        }
Esempio n. 2
0
        public void DoStart(string filePath, TextRangeList <TextRange> mainList)
        {
            FilePath = filePath;
            Document = new FlowDocument();
            Style style = new Style(typeof(Paragraph));

            style.Setters.Add(new Setter(Block.MarginProperty, new Thickness(0)));
            Document.Resources.Add(typeof(Paragraph), style);
            List     = new TextRangeList <TextRange>(Document);
            MainList = mainList;
            AttachEventHandler();
        }