/// <summary> /// Wrapper around AuroraButtons dictionary so that we can easily fix all patches /// that rely on Lib if the button names change in the future. /// </summary> /// <param name="button"></param> /// <returns></returns> public string GetButtonName(AuroraButton button) { string buttonName; AuroraButtons.TryGetValue(button, out buttonName); return(buttonName); }
private static void ChangeButtonStyle(AuroraButton button, Bitmap image, Color textColor, Color?backgroundColor = null) { Bitmap colorizedImage = ColorizeImage(image, textColor); ThemeCreator.ThemeCreator.AddImageChange(button, colorizedImage); if (backgroundColor != null) { ThemeCreator.ThemeCreator.AddColorChange( (Control control) => { return(control.GetType() == typeof(Button) && control.Name == lib.KnowledgeBase.GetButtonName(button)); }, new ThemeCreator.ColorChange { BackgroundColor = backgroundColor } ); } }
/// <summary> /// Helper method to set a background image for a specific AuroraButton. /// </summary> /// <param name="auroraButton"></param> public static void AddImageChange(AuroraButton auroraButton, string imagePath) { AddImageChange(auroraButton, Image.FromFile(imagePath)); }
/// <summary> /// Helper method to set a background image for a specific AuroraButton. /// </summary> /// <param name="auroraButton"></param> public static void AddImageChange(AuroraButton auroraButton, Image image) { ImagePredicates.Add(control => control.Name == lib.KnowledgeBase.GetButtonName(auroraButton), image); }