コード例 #1
0
        private void Colorize()
        {
            var range = _range;
            var data  = _data;

            if (data != null)
            {
                TokenList tokensToColor;
                lock (this) {
                    tokensToColor = ExtractTokensInRange(data.NotColoredTokens, range.Min, range.Max);
                }
                if (ColorizeTokens != null && tokensToColor != null && tokensToColor.Count > 0)
                {
                    data.ColoredTokens.AddRange(tokensToColor);
                    ColorizeEventArgs args = new ColorizeEventArgs(tokensToColor);
                    ColorizeTokens(this, args);
                }
            }//if data != null ...
            _wantsColorize = false;
            _colorizing    = 0;
        }
コード例 #2
0
 void Adapter_ColorizeTokens(object sender, ColorizeEventArgs args)
 {
     if (_disposed)
     {
         return;
     }
     _colorizing = true;
     TextBox.BeginUpdate();
     try {
         foreach (Token tkn in args.Tokens)
         {
             var tokenRange = TextBox.GetRange(tkn.Location.Position, tkn.Location.Position + tkn.Length);
             var tokenStyle = GetTokenStyle(tkn);
             tokenRange.ClearStyle(StyleIndex.All);
             tokenRange.SetStyle(tokenStyle);
         }
     } finally {
         TextBox.EndUpdate();
         _colorizing = false;
     }
 }