Example #1
0
 public static StyleSheetBuilder WithStyle(
     this StyleSheetBuilder @this,
     [RegexPattern] string pattern,
     Color color,
     MatchFoundLite matchTransformer)
 {
     @this._styleSheet.AddStyle(pattern, color, matchTransformer);
     return(@this);
 }
Example #2
0
        /// <summary>
        ///	Adds a style classification to the StyleSheet.
        /// </summary>
        /// <param name="pattern">
        ///	The string to be styled.</param>
        /// <param name="color">
        ///	The color to be applied to the target.
        ///	</param>
        /// <param name="matchHandler">
        ///	A delegate describing a simple transformation that will be applied to the target.
        /// </param
        public void AddStyle(
            [RegexPattern] string pattern,
            Color color,
            MatchFoundLite matchHandler)
        {
            string Wrapper(string s, TextMatchDescriptor l, string m)
            {
                return(matchHandler.Invoke(m));
            }

            var stylizer = new Stylizer(pattern, color, Wrapper);

            Styles.Add(stylizer);
        }