public static void ApplyThemeResource(this Form window, string themeName = null) { ThemeStyle[] styles = ThemeParser.ParseResource("Paradoxlost.UX.WinForms.Theme.Sample.theme"); foreach (ThemeStyle style in styles) { System.Diagnostics.Debug.Print(style.Target.Name); if (style.Target.IsAssignableFrom(window.GetType())) { style.Apply(window); } } }
private void ParseTheme() { string themePath = Name; if (!IsResource) { if (!Path.IsPathRooted(themePath)) { themePath = Path.Combine(Application.StartupPath, themePath); } using (FileStream fs = File.OpenRead(themePath)) { Styles = ThemeParser.Parse(fs); } } else { Styles = ThemeParser.ParseResource(Name); } }