Esempio n. 1
0
        public void Load(Stream stream, TextViewerTextType textType)
        {
            var format = textType.ToWpf();

            if (format == SW.DataFormats.UnicodeText)
            {
                var reader = new StreamReader(stream, textType == TextViewerTextType.UnicodePlainText ? Encoding.Unicode : Encoding.ASCII);
                var text   = reader.ReadToEnd();
                TextBox.Document.Blocks.Clear();
                TextBox.Document.Blocks.Add(new Paragraph(new Run(text)));
            }
            else
            {
                new TextRange(TextBox.Document.ContentStart, TextBox.Document.ContentEnd)
                .Load(stream, format);
            }

            Modified = false;
            TextBox.Selection.Select(TextBox.Document.ContentStart, TextBox.Document.ContentStart);
        }
Esempio n. 2
0
 public void Save(Stream stream, TextViewerTextType textType)
 {
     TextBox.Selection.Save(stream, textType.ToWpf());
 }