private string RenderResources()
        {
            StringBuilder sb        = new StringBuilder();
            var           resources = SampleUtils.GetDynamicResources(UriHelper, SampleService);

            foreach (var resource in resources)
            {
                sb.Append(Environment.NewLine);
                if (resource.EndsWith(".css"))
                {
                    sb.Append($"    <link");
                    sb.Append($" href=\"" + resource + "\"");
                    sb.Append($" rel=\"stylesheet\"");
                    sb.Append(" />");
                }
                else
                {
                    sb.Append($"    <script");
                    sb.Append($" src=\"" + resource + "\"");
                    sb.Append($" async");
                    sb.Append(" ></script>");
                }
            }
            sb.Append(Environment.NewLine);
            return(sb.ToString());
        }
        private string RenderStyles()
        {
            var           themeName = SampleUtils.GetThemeName(UriHelper.Uri);
            StringBuilder sb        = new StringBuilder();

            sb.Append(Environment.NewLine);
            sb.Append($"    <link");
            sb.Append($" href=\"{ stylePath + themeName + ".css"}\"");
            sb.Append($" rel=\"stylesheet\"");
            sb.Append(" />");
            sb.Append(Environment.NewLine);
            return(sb.ToString());
        }
        /// <summary>
        /// Returns list of resources need to be loaded.
        /// </summary>
        /// <returns></returns>
        public static List <string> GetDynamicResources(NavigationManager uriHelper, SampleService sampleService)
        {
            var resourceList = new List <string>();

            if (!sampleService.IsHomeLoaded && SampleUtils.IsHomePage(uriHelper))
            {
                sampleService.IsHomeLoaded = true;
#if DEBUG
                resourceList = new List <string> {
                    "styles/common/home.css"
                };
#else
                resourceList = new List <string> {
                    "styles/common/home.min.css"
                };
#endif
            }
            else if (!sampleService.IsDemoLoaded)
            {
                sampleService.IsDemoLoaded = true;
#if DEBUG
                resourceList = new List <string>
                {
                    "styles/common/roboto.css",
                    "styles/common/highlight.css",
                    "styles/common/demos.css",
                    "scripts/common/lodash.min.js",
                    "scripts/common/highlight.min.js"
                };
                if (uriHelper.Uri.Contains("theme=highcontrast"))
                {
                    resourceList.Add("styles/common/highcontrast.css");
                }
#else
                resourceList = new List <string>
                {
                    "styles/common/demos.min.css",
                    "scripts/common/demos.min.js"
                };
                if (uriHelper.Uri.Contains("theme=highcontrast"))
                {
                    resourceList.Add("styles/common/highcontrast.min.css");
                }
#endif
            }
            return(resourceList);
        }