Ejemplo n.º 1
0
        public ConsoleControl()
        {
            this.ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = new GridLength(1, GridUnitType.Star)
            });
            this.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(1, GridUnitType.Star)
            });

            object tmp;

            this.editorAdapter = EditorControlService.CreateEditor(out tmp);

            this.editor = (AvalonEdit.TextEditor)tmp;
            this.editor.SetValue(Grid.ColumnProperty, 0);
            this.editor.SetValue(Grid.RowProperty, 0);
            this.editor.ShowLineNumbers = false;

            if (consoleOptions == null)
            {
                consoleOptions = new TextEditorOptions(editor.Options);
                consoleOptions.AllowScrollBelowDocument = false;
            }

            this.editor.Options = consoleOptions;

            this.Children.Add(editor);

            editor.TextArea.ReadOnlySectionProvider = readOnlyRegion = new BeginReadOnlySectionProvider();

            editor.TextArea.TextEntered    += new TextCompositionEventHandler(editor_TextArea_TextEntered);
            editor.TextArea.PreviewKeyDown += new KeyEventHandler(editor_TextArea_PreviewKeyDown);
        }
Ejemplo n.º 2
0
        AvalonEdit.TextEditor CreateTextEditor()
        {
            object textEditor;

            EditorControlService.CreateEditor(out textEditor);
            return((AvalonEdit.TextEditor)textEditor);
        }
Ejemplo n.º 3
0
        public static TextEditor CreateAvalonEditInstance()
        {
            object editor;

            EditorControlService.CreateEditor(out editor);
            if (!(editor is TextEditor))
            {
                throw new NotSupportedException("Expected text editor to be AvalonEdit");
            }
            return((TextEditor)editor);
        }
Ejemplo n.º 4
0
        public static TextEditor CreateTextEditor()
        {
            object control;

            EditorControlService.CreateEditor(out control);
            var textEditor = (TextEditor)control;

            textEditor.Options = new TextEditorOptions();
            textEditor.Options.AllowScrollBelowDocument = false;
            textEditor.FontFamily = new FontFamily(WinFormsResourceService.DefaultMonospacedFont.Name);
            textEditor.FontSize   = 13.0;

            return(textEditor);
        }