Ejemplo n.º 1
0
        private void _loadAvalon()
        {
            DispatcherTimer foldingUpdateTimer = new DispatcherTimer();

            foldingUpdateTimer.Interval = TimeSpan.FromSeconds(2);
            foldingUpdateTimer.Start();

            _textEditor.Dispatch(p => p.TextArea.SelectionCornerRadius = 0);
            _textEditor.Dispatch(p => p.TextArea.SelectionBorder       = new Pen(_textEditor.TextArea.SelectionBrush, 0));
            _textEditor.TextArea.SelectionBrush      = new SolidColorBrush(Color.FromArgb(160, 172, 213, 254));
            _textEditor.TextArea.SelectionBorder     = new Pen(_textEditor.TextArea.SelectionBrush, 1);
            _textEditor.TextArea.SelectionForeground = new SolidColorBrush(Colors.Black);
            SearchPanel panel = new SearchPanel();

            panel.Attach(_textEditor.TextArea, _textEditor);

            FontFamily oldFamily = _textEditor.FontFamily;
            double     oldSize   = _textEditor.FontSize;

            _renderer = new SearchPanel.SearchResultBackgroundRenderer {
                MarkerBrush = new SolidColorBrush(Color.FromArgb(255, 143, 255, 143))
            };
            _textEditor.TextArea.Caret.PositionChanged += _caret_PositionChanged;

            try {
                _textEditor.FontFamily = new FontFamily("Consolas");
                _textEditor.FontSize   = 12;

                if (_textEditor.FontFamily == null)
                {
                    _textEditor.FontFamily = oldFamily;
                    _textEditor.FontSize   = oldSize;
                }
            }
            catch {
                _textEditor.FontFamily = oldFamily;
                _textEditor.FontSize   = oldSize;
            }

            _textEditor.TextArea.TextView.BackgroundRenderers.Add(_renderer);
            _textEditor.TextArea.KeyDown += new KeyEventHandler(_textArea_KeyDown);
            _textArea = _textEditor.TextArea;
        }
Ejemplo n.º 2
0
		private void _loadAvalon() {
			DispatcherTimer foldingUpdateTimer = new DispatcherTimer();
			foldingUpdateTimer.Interval = TimeSpan.FromSeconds(2);
			foldingUpdateTimer.Start();

			_textEditor.Dispatch(p => p.TextArea.SelectionCornerRadius = 0);
			_textEditor.Dispatch(p => p.TextArea.SelectionBorder = new Pen(_textEditor.TextArea.SelectionBrush, 0));
			_textEditor.TextArea.SelectionBrush = new SolidColorBrush(Color.FromArgb(160, 172, 213, 254));
			_textEditor.TextArea.SelectionBorder = new Pen(_textEditor.TextArea.SelectionBrush, 1);
			_textEditor.TextArea.SelectionForeground = new SolidColorBrush(Colors.Black);
			SearchPanel panel = new SearchPanel();
			panel.Attach(_textEditor.TextArea, _textEditor);

			FontFamily oldFamily = _textEditor.FontFamily;
			double oldSize = _textEditor.FontSize;

			_renderer = new SearchPanel.SearchResultBackgroundRenderer { MarkerBrush = new SolidColorBrush(Color.FromArgb(255, 143, 255, 143)) };
			_textEditor.TextArea.Caret.PositionChanged += _caret_PositionChanged;

			try {
				_textEditor.FontFamily = new FontFamily("Consolas");
				_textEditor.FontSize = 12;

				if (_textEditor.FontFamily == null) {
					_textEditor.FontFamily = oldFamily;
					_textEditor.FontSize = oldSize;
				}
			}
			catch {
				_textEditor.FontFamily = oldFamily;
				_textEditor.FontSize = oldSize;
			}

			_textEditor.TextArea.TextView.BackgroundRenderers.Add(_renderer);
			_textEditor.TextArea.KeyDown += new KeyEventHandler(_textArea_KeyDown);
			_textArea = _textEditor.TextArea;
		}