static void registerStyles(ICollection <ThemingInstruction> styleArray) { var document = HTMLPage.Document; var head = document.GetElementsByTagName("head")[0]; var styleElement = document.CreateElement <HTMLStyleElement>(); (string styleString, bool themable) = resolveThemableArray(styleArray); styleElement.Type = "text/css"; styleElement.AppendChild(document.CreateTextNode(styleString)); themeState.Performance.Count++; head.AppendChild(styleElement); var record = new StyleRecord() { StyleElement = styleElement, ThemableStyle = styleArray, }; if (themable) { themeState.RegisteredThemableStyles.Add(record); } else { themeState.RegisteredStyles.Add(record); } }
private static void applyThemableStyles(ICollection <ThemingInstruction> styles, StyleRecord styleRecord = null) { if (themeState.LoadStyle(resolveThemableArray(styles).styleString, styles)) { registerStyles(styles); } }