/// <summary> /// Apply the color change specified if the predicate returns true. /// </summary> /// <param name="predicate"></param> /// <param name="colorChange"></param> public static void AddColorChange(Func <Control, bool> predicate, ColorChange colorChange) { ColorPredicates.Add(predicate, colorChange); }
/// <summary> /// Will apply the color changes specified to the control name specified. /// </summary> /// <param name="name"></param> /// <param name="colorChange"></param> public static void AddColorChange(string name, ColorChange colorChange) { ColorPredicates.Add(control => control.Name == name, colorChange); }
/// <summary> /// Will apply the color changes specified to the control name matching the regex specified. /// Should be used as a last resort - not very performant. /// </summary> /// <param name="regex"></param> /// <param name="colorChange"></param> public static void AddColorChange(Regex regex, ColorChange colorChange) { ColorPredicates.Add(control => regex.IsMatch(control.Name), colorChange); }
/// <summary> /// Will apply the color changes specified to the type specified. /// </summary> /// <param name="type"></param> /// <param name="colorChange"></param> public static void AddColorChange(Type type, ColorChange colorChange) { ColorPredicates.Add(control => control.GetType() == type, colorChange); }