Esempio n. 1
0
        /// <summary>
        /// Clears and updates the contents.
        /// </summary>
        private void HighlightContents()
        {
            if (_textBox != null)
            {
                _textBox.Blocks.Clear();
                _textBox.Blocks.Add(new Paragraph());

                XamlInlineFormatterEx xif = new XamlInlineFormatterEx(_textBox);

                CodeColorizer cc;
                if (_colorizer != null && _colorizer.IsAlive)
                {
                    cc = (CodeColorizer)_colorizer.Target;
                }
                else
                {
                    cc         = new CodeColorizer();
                    _colorizer = new WeakReference(cc);
                }

                ILanguage language = CreateLanguageInstance(SourceLanguage);

                cc.Colorize(SourceCode, language, xif, DefaultStyleSheet);
            }
        }
Esempio n. 2
0
    /// <summary>
    /// Clears and updates the contents.
    /// </summary>
    private void HighlightContents()
    {
      if (_textBox != null)
      {
        _textBox.Blocks.Clear();
        _textBox.Blocks.Add(new Paragraph());

        XamlInlineFormatterEx xif = new XamlInlineFormatterEx(_textBox);

        CodeColorizer cc;
        if (_colorizer != null && _colorizer.IsAlive)
        {
          cc = (CodeColorizer)_colorizer.Target;
        }
        else
        {
          cc = new CodeColorizer();
          _colorizer = new WeakReference(cc);
        }

        ILanguage language = CreateLanguageInstance(SourceLanguage);

        cc.Colorize(SourceCode, language, xif, DefaultStyleSheet);
      }
    }