コード例 #1
0
        /// <summary>
        /// Ensure all needed scripts by registered control are registered properly in memory.
        /// This API supports the AjaxControlToolkit infrastructure and is not intended to be used directly from your code.
        /// </summary>
        public void ValidateScriptReferences()
        {
            // validation works for combine and minification only
            if (!_combineScripts || IsDebugMode)
            {
                return;
            }

            var controlTypesInPage = new List <Type>();

            GetRegisteredControlTypes(Page.Controls, controlTypesInPage);
            foreach (var controlType in controlTypesInPage)
            {
                var scriptReferences = ScriptObjectBuilder.GetScriptReferences(controlType);
                foreach (var scriptReference in scriptReferences)
                {
                    if (!_combiner.IsScriptRegistered(scriptReference))
                    {
                        throw new Exception("Could not load control " + controlType.FullName
                                            + ". The script reference(s) of this control was not loaded correctly. "
                                            +
                                            "If AjaxControlToolkit.config is used, probably this control is not registered properly.");
                    }
                }
            }
        }
コード例 #2
0
 protected virtual IEnumerable <ScriptReference> GetScriptReferences()
 {
     if (Visible)
     {
         List <ScriptReference> scriptRefs = new List <ScriptReference>();
         scriptRefs.AddRange(ScriptObjectBuilder.GetScriptReferences(GetType(), false));
         return(scriptRefs);
     }
     return(null);
 }
コード例 #3
0
        // Token: 0x06000061 RID: 97 RVA: 0x00002CDC File Offset: 0x00000EDC
        internal IEnumerable <ScriptReference> EnsureScripts()
        {
            List <ScriptReference> list = new List <ScriptReference>();

            list.AddRange(ScriptObjectBuilder.GetScriptReferences(base.GetType(), null != this.ScriptPath));
            string scriptPath = this.ScriptPath;

            if (!string.IsNullOrEmpty(scriptPath))
            {
                list.Add(new ScriptReference(scriptPath));
            }
            return(list);
        }
コード例 #4
0
        /// <summary>
        /// Walks the various script types and prepares to notify the ScriptManager to load them.
        /// 1) Required scripts such as ASP.NET AJAX Scripts or other components
        /// 2) Scripts for this Extender/Behavior
        /// </summary>
        internal IEnumerable <ScriptReference> EnsureScripts(/*ScriptManager scriptManager*/)
        {
            List <ScriptReference> scriptRefs = new List <ScriptReference>();

            scriptRefs.AddRange(ScriptObjectBuilder.GetScriptReferences(GetType(), (null != ScriptPath)));
            string scriptPath = ScriptPath;

            if (!string.IsNullOrEmpty(scriptPath))
            {
                scriptRefs.Add(new ScriptReference(scriptPath));
            }

            return(scriptRefs);
        }
コード例 #5
0
        protected override IEnumerable <ScriptReference> GetScriptReferences()
        {
            if (!this.Visible)
            {
                return(null);
            }
            List <ScriptReference> list = new List <ScriptReference>();

            list.AddRange(ScriptObjectBuilder.GetScriptReferences(base.GetType()));
            if (this.ScriptPath.Length > 0)
            {
                list.Add(new ScriptReference(this.ScriptPath));
            }
            return(list);
        }
コード例 #6
0
        protected virtual IEnumerable <ScriptReference> GetScriptReferences()
        {
            if (!Visible)
            {
                return(null);
            }

            List <ScriptReference> refs = new List <ScriptReference>();

            refs.AddRange(ScriptObjectBuilder.GetScriptReferences(GetType()));
            if (ScriptPath.Length > 0)
            {
                refs.Add(new ScriptReference(ScriptPath));
            }
            return(refs);
        }
コード例 #7
0
        /// <summary>
        /// Load all script references needed by toolkits registered at config file based on bundles.
        /// If bundles is null then all control types from config are loaded.
        /// </summary>
        /// <param name="context">Current HttpContext</param>
        /// <param name="bundles">Name of bundles</param>
        /// <returns>List of script reference</returns>
        public List <ScriptReference> LoadScriptReferences(HttpContextBase context, string[] bundles)
        {
            _scriptReferences = new List <ScriptReference>();
            foreach (var control in _scriptManagerConfig.GetControlTypesInBundles(context, bundles))
            {
                var scriptRefs = ScriptObjectBuilder.GetScriptReferences(control);
                foreach (var scriptRef in scriptRefs)
                {
                    if (_scriptReferences.All(s => s.Name != scriptRef.Name))
                    {
                        _scriptReferences.Add(scriptRef);
                    }
                }
            }

            _scriptEntriesLoaded = true;
            return(_scriptReferences);
        }
コード例 #8
0
        public List <ScriptReference> GetScriptReferences(HttpContextBase context, string[] bundles, out ScriptReference[] addedScriptReferences, out ScriptReference[] removedScriptReferences)
        {
            var scriptReferences = new List <ScriptReference>();

            foreach (
                var control in
                GetControlTypesInBundles(context, bundles, out addedScriptReferences, out removedScriptReferences))
            {
                var scriptRefs = ScriptObjectBuilder.GetScriptReferences(control).ToList();
                foreach (var scriptRef in scriptRefs)
                {
                    if (scriptReferences.All(s => s.Name != scriptRef.Name))
                    {
                        scriptReferences.Add(scriptRef);
                    }
                }
            }

            scriptReferences = scriptReferences.Distinct().ToList();
            if (addedScriptReferences != null)
            {
                foreach (var script in addedScriptReferences)
                {
                    scriptReferences.Add(script);
                }
            }

            if (removedScriptReferences != null)
            {
                foreach (var script in removedScriptReferences)
                {
                    var scriptToRemove = scriptReferences.FirstOrDefault(s => s.Name.Equals(script.Name) && s.Assembly.Equals(script.Assembly));
                    if (scriptToRemove != null)
                    {
                        scriptReferences.Remove(scriptToRemove);
                    }
                }
            }

            return(scriptReferences);
        }
コード例 #9
0
 // Token: 0x060000E2 RID: 226 RVA: 0x000038D8 File Offset: 0x00001AD8
 public static IEnumerable <ScriptReference> GetScriptReferences(Type type)
 {
     return(ScriptObjectBuilder.GetScriptReferences(type, false));
 }