/// <summary> /// Adds a style classification to the StyleSheet. /// </summary> /// <param name="target"> /// The string to be styled. /// </param> /// <param name="color"> /// The color to be applied to the target. /// </param> /// <param name="matchHandler"> /// A delegate instance which describes a transformation that can be applied to the target. /// </param> public void AddStyle( string target, Color color, MatchFound matchHandler) { var styler = new Stylizer(target, color, matchHandler); Styles.Add(styler); }
/// <summary> /// Adds a style classification to the StyleSheet. /// </summary> /// <param name="target"> /// The string to be styled. /// </param> /// <param name="color"> /// The color to be applied to the target. /// </param> public void AddStyle( [RegexPattern] string target, Color color) { string Handler(string s, TextMatchDescriptor l, string m) => m; var stylizer = new Stylizer(target, color, Handler); Styles.Add(stylizer); }
public bool Equals(Stylizer other) { if (other == null) { return(false); } return(base.Equals(other) && MatchFoundHandler == other.MatchFoundHandler); }
/// <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); }