Beispiel #1
0
        public CodeEditor()
        {
            _keystrokeTimer          = new System.Timers.Timer(2000);
            _keystrokeTimer.Elapsed += KeystrokeTimeElapsed;

            _languageContext = new LanguageContext();

            FontFamily      = new FontFamily("Consolas");
            FontSize        = 12;
            ShowLineNumbers = true;
            Options         = new TextEditorOptions
            {
                ConvertTabsToSpaces      = true,
                HighlightCurrentLine     = true,
                IndentationSize          = 4,
                AllowScrollBelowDocument = true
            };

            MouseHover        += OnMouseHover;
            MouseHoverStopped += OnMouseHoverStopped;
            TextArea.Caret.PositionChanged += HighlightBrackets;

            _foldingStrategy = new PowershellFoldingStrategy();

            var foldingUpdateTimer = new DispatcherTimer {
                Interval = TimeSpan.FromSeconds(4)
            };

            foldingUpdateTimer.Tick += delegate { UpdateFoldings(); };
            foldingUpdateTimer.Start();

            _bracketRenderer = new BracketHighlightRenderer(this.TextArea.TextView, _languageContext);
            TextArea.TextView.BackgroundRenderers.Add(_bracketRenderer);

            _inlineScriptTransformer = new InlineScriptDocumentTransformer(this.TextArea.TextView, _languageContext);
            TextArea.TextView.BackgroundRenderers.Add(_inlineScriptTransformer);

            InitializeColorizer();
        }
Beispiel #2
0
        public CodeEditor()
        {
            _keystrokeTimer = new System.Timers.Timer(2000);
            _keystrokeTimer.Elapsed += KeystrokeTimeElapsed;

            _languageContext = new LanguageContext();

            FontFamily = new FontFamily("Consolas");
            FontSize = 12;
            ShowLineNumbers = true;
            Options = new TextEditorOptions
            {
                ConvertTabsToSpaces = true,
                HighlightCurrentLine = true,
                IndentationSize = 4,
                AllowScrollBelowDocument = true
            };

            MouseHover += OnMouseHover;
            MouseHoverStopped += OnMouseHoverStopped;
            TextArea.Caret.PositionChanged += HighlightBrackets;

            _foldingStrategy = new PowershellFoldingStrategy();

            var foldingUpdateTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(4) };
            foldingUpdateTimer.Tick += delegate { UpdateFoldings(); };
            foldingUpdateTimer.Start();

            _bracketRenderer = new BracketHighlightRenderer(this.TextArea.TextView, _languageContext);
            TextArea.TextView.BackgroundRenderers.Add(_bracketRenderer);

            _inlineScriptTransformer = new InlineScriptDocumentTransformer(this.TextArea.TextView, _languageContext);
            TextArea.TextView.BackgroundRenderers.Add(_inlineScriptTransformer);

            InitializeColorizer();
        }