/// <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"); } if (new Regex(@"theme=.*-dark").IsMatch(uriHelper.Uri)) { resourceList.Add("styles/common/dark-theme.css"); } #else resourceList = new List <string> { "styles/common/demos.min.css", "scripts/common/demos.min.js" }; if (uriHelper.Uri.Contains("theme=highcontrast") || new Regex(@"theme=.*-dark").IsMatch(uriHelper.Uri)) { resourceList.Add("styles/common/dark-theme.min.css"); } #endif } return(resourceList); }
/// <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 || STAGING resourceList = new List <string> { "scripts/common/lodash.min.js", "_content/Syncfusion.Blazor.Core/scripts/syncfusion-blazor.min.js", "styles/common/roboto.css", "styles/common/highlight.css", "styles/common/demos.css", "scripts/common/highlight.min.js" }; if (uriHelper.Uri.Contains("theme=highcontrast")) { resourceList.Add("styles/common/highcontrast.css"); } if (new Regex(@"theme=.*-dark").IsMatch(uriHelper.Uri)) { resourceList.Add("styles/common/dark-theme.css"); } #else resourceList = new List <string> { $"scripts/common/lodash.min.js", $"https://cdn.syncfusion.com/blazor/19.3.43/syncfusion-blazor.min.js", $"styles/common/demos.min.css", $"scripts/common/demos.min.js" }; if (uriHelper.Uri.Contains("theme=highcontrast") || new Regex(@"theme=.*-dark").IsMatch(uriHelper.Uri)) { resourceList.Add("styles/common/dark-theme.min.css"); } #endif if (sampleService.ComponentName.Equals("PDF Viewer") && !sampleService.IsPdfScriptLoaded) { sampleService.IsPdfScriptLoaded = true; resourceList.Add(sampleService.PdfScriptPath + "/syncfusion-blazor-pdfviewer.min.js"); } if (sampleService.ComponentName.Equals("Word Processor") && !sampleService.IsDocScriptLoaded) { sampleService.IsDocScriptLoaded = true; resourceList.Add(sampleService.DocScriptPath + "/syncfusion-blazor-documenteditor.min.js"); } if (sampleService.ComponentName.Equals("Diagram") && !sampleService.IsDiagramScriptLoaded) { sampleService.IsDiagramScriptLoaded = true; #if DEBUG || STAGING resourceList.Add("scripts/diagram/interop.js"); #else resourceList.Add("scripts/diagram/interop.min.js"); #endif } } return(resourceList); }