public static HtmlString StyleLibrary(this WebViewPage page, StyleLibrary library)
        {
            if (page.IsAjax)
            {
                return(new HtmlString(string.Empty));
            }

            GetContextStyles(page).AddLibrary(library);

            return(new HtmlString(string.Empty));
        }
        public void AddLibrary(StyleLibrary library)
        {
            if (Libraries == null)
            {
                Libraries = new HashSet <StyleLibrary>();
            }

            if (LibraryOrder == null)
            {
                LibraryOrder = new List <StyleLibrary>();
            }

            AddLibraryInternal(library);
        }
        private void AddLibraryInternal(StyleLibrary library)
        {
            if (Libraries.Contains(library))
            {
                return;
            }

            if (library.Dependencies != null)
            {
                foreach (var dependentLibrary in library.Dependencies)
                {
                    AddLibraryInternal(dependentLibrary);
                }
            }

            Libraries.Add(library);
            LibraryOrder.Add(library);
        }