Ext.Net.ResourceManager.IsClientStyleBlockRegistered C# (CSharp) Method

IsClientStyleBlockRegistered() public method

public IsClientStyleBlockRegistered ( string key ) : bool
key string
return bool
        public bool IsClientStyleBlockRegistered(string key)
        {
            return this.clientStyleBlockBag.ContainsKey(key);
        }

Usage Example

Esempio n. 1
0
        protected static void RegisterTriggerIcon(TriggerIcon icon)
        {
            if (icon == TriggerIcon.Combo ||
                icon == TriggerIcon.Clear ||
                icon == TriggerIcon.Date ||
                icon == TriggerIcon.Search ||
                HttpContext.Current == null)
            {
                return;
            }

            ResourceManager rm = ResourceManager.GetInstance(HttpContext.Current);

            if (rm == null)
            {
                return;
            }

            string iconName = icon.ToString();
            string key      = "x-form-".ConcatWith(iconName.ToLower(), "-trigger");

            if (rm.IsClientStyleBlockRegistered(key))
            {
                return;
            }

            string urlName = iconName.ToCharacterSeparatedFileName('-', "gif");

            if (rm.Theme != Theme.Default && (icon == Net.TriggerIcon.Ellipsis || icon == Net.TriggerIcon.Empty))
            {
                urlName = string.Concat(rm.Theme.ToString().ToLowerInvariant(), ".", urlName);
            }

            string url  = rm.GetWebResourceUrl(string.Format(ResourceManager.ASSEMBLYSLUG + ".ux.extensions.triggerfield.images.{0}", urlName));
            string url1 = "";
            string css  = ".x-form-field-wrap .{0}{{background-image:url({1});cursor:pointer;}}";

            if (!RequestManager.IsWebKit && iconName.StartsWith("Simple"))
            {
                url1 = rm.GetWebResourceUrl(string.Format(ResourceManager.ASSEMBLYSLUG + ".ux.extensions.triggerfield.images.{0}", iconName.ToCharacterSeparatedFileName('-', "").ConcatWith("-small.gif")));
                css += " .x-small-editor .x-form-field-wrap .{0}{{background-image:url({2});cursor:pointer;}}";
            }

            if (Ext.Net.X.IsAjaxRequest)
            {
                //CSS.CreateStyleSheet(css.FormatWith(key, url, url1), key);
                rm.AddScript("Ext.net.ResourceMgr.registerCssClass({0}, {1});", JSON.Serialize(key), JSON.Serialize(css.FormatWith(key, url, url1)));
            }
            else
            {
                rm.RegisterClientStyleBlock(key, css.FormatWith(key, url, url1));
            }
        }