Exemplo n.º 1
0
        private void Selector_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            editor.Document.Selection.Clear();

            var search       = new DocumentTextSearch(editor.Document);
            var lastPosition = new DocumentPosition(editor.Document);

            bool endOfDocument   = false;
            bool theFirstFinding = true;

            while (!endOfDocument)
            {
                TextRange range;

                range = search.Find("#break#", theFirstFinding ? new DocumentPosition(editor.Document) : lastPosition);

                if (range != null)
                {
                    theFirstFinding = false;
                    lastPosition    = range.EndPosition;

                    editor.Document.Selection.AddSelectionStart(range.StartPosition);
                    editor.Document.Selection.AddSelectionEnd(range.EndPosition);

                    var documentEditor = new RadDocumentEditor(editor.Document);
                    documentEditor.InsertLineBreak();
                }
                else
                {
                    endOfDocument = true;
                }
            }
        }
Exemplo n.º 2
0
        private void Selector_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            editor.Document.Selection.Clear();

            var search = new DocumentTextSearch(editor.Document);
            var lastPosition = new DocumentPosition(editor.Document);

            bool endOfDocument = false;
            bool theFirstFinding = true;

            while (!endOfDocument)
            {
                TextRange range;

                range = search.Find("#break#", theFirstFinding ? new DocumentPosition(editor.Document) : lastPosition);

                if (range != null)
                {
                    theFirstFinding = false;
                    lastPosition = range.EndPosition;

                    editor.Document.Selection.AddSelectionStart(range.StartPosition);
                    editor.Document.Selection.AddSelectionEnd(range.EndPosition);

                    var documentEditor = new RadDocumentEditor(editor.Document);
                    documentEditor.InsertLineBreak();
                }
                else
                {
                    endOfDocument = true;
                }
            }
        }