예제 #1
0
        private static IEnumerable <string> GetComponentScripts(string component)
        {
            var allScripts = new List <string>();

            if (!string.IsNullOrEmpty(component) && ScriptDependencyResolver.ComponentsDefinitionsDictionary.Value.ContainsKey(component))
            {
                var componentDefinitionObject = ScriptDependencyResolver.ComponentsDefinitionsDictionary.Value[component];

                if (componentDefinitionObject.Scripts != null)
                {
                    allScripts.AddRange(componentDefinitionObject.Scripts);
                }

                if (componentDefinitionObject.Components != null)
                {
                    foreach (var comp in componentDefinitionObject.Components)
                    {
                        allScripts.AddRange(ScriptDependencyResolver.GetComponentScripts(comp));
                    }
                }
            }
            else
            {
                Log.Write(string.Format(System.Globalization.CultureInfo.InvariantCulture, "The component {0} could not be resolved", component));
            }

            return(allScripts.Distinct());
        }
예제 #2
0
        /// <summary>
        /// Gets the scripts.
        /// </summary>
        /// <param name="components">The components.</param>
        /// <returns></returns>
        public static IList <string> GetScripts(IEnumerable <string> components, IEnumerable <string> scripts)
        {
            if (components == null)
            {
                components = new List <string>();
            }

            if (scripts == null)
            {
                scripts = new List <string>();
            }

            var originalScripts = scripts.ToList();

            if (!components.Any())
            {
                return(originalScripts);
            }

            var dependencyScripts = new List <string>();

            foreach (var comp in components)
            {
                dependencyScripts.AddRange(ScriptDependencyResolver.GetComponentScripts(comp));
            }

            return(ScriptDependencyResolver.OrderScripts(dependencyScripts, originalScripts));
        }
예제 #3
0
        private void PopulateComponentsScriptReferences(DesignerViewConfigModel designerViewConfigModel)
        {
            if (designerViewConfigModel == null)
            {
                return;
            }

            if (designerViewConfigModel.Components != null && designerViewConfigModel.Components.Count > 0)
            {
                if (designerViewConfigModel.Scripts == null)
                {
                    designerViewConfigModel.Scripts = new List <string>();
                }

                designerViewConfigModel.Scripts = ScriptDependencyResolver.GetScripts(designerViewConfigModel.Components, designerViewConfigModel.Scripts);
            }
        }