/// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public string ToHtmlString()
        {
            var mgr = new MvcResourceManager
            {
                CleanResourceUrl = config.CleanResourceUrl,
                ResourcePath     = config.ResourcePath,
                Locale           = config.Locale,
                FormID           = config.FormID,
                Namespace        = config.Namespace
            };

            if (config.ScriptMode != Ext.Net.ScriptMode.Release)
            {
                mgr.ScriptMode = config.ScriptMode;
            }

            if (config.RenderScripts != ResourceLocationType.Embedded)
            {
                mgr.RenderScripts = config.RenderScripts;
            }

            if (config.RenderStyles != ResourceLocationType.Embedded)
            {
                mgr.RenderStyles = config.RenderStyles;
            }

            if (config.Theme != Ext.Net.Theme.Default)
            {
                mgr.Theme = config.Theme;
            }

            if (!config.QuickTips)
            {
                mgr.QuickTips = config.QuickTips;
            }

            if (config.IDMode != Ext.Net.IDMode.Explicit)
            {
                mgr.IDMode = config.IDMode;
            }

            mgr.Listeners          = config.Listeners;
            mgr.CustomListeners    = config.CustomListeners;
            mgr.DirectEvents       = config.DirectEvents;
            mgr.CustomDirectEvents = config.CustomDirectEvents;

            return(mgr.SelfRender());
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="config"></param>
        public MvcResourceManagerBuilder(MvcResourceManagerConfig config)
        {
            MvcResourceManager.MarkAsMVC();
            this.config           = config ?? new MvcResourceManagerConfig();
            this.mgr              = new MvcResourceManager();
            this.mgr.IsSelfRender = true;

            if (HttpContext.Current != null)
            {
                HttpContext.Current.Items[typeof(MvcResourceManager)] = this.mgr;
            }

            this.config.Listeners          = this.mgr.Listeners;
            this.config.CustomListeners    = this.mgr.CustomListeners;
            this.config.DirectEvents       = this.mgr.DirectEvents;
            this.config.CustomDirectEvents = this.mgr.CustomDirectEvents;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="config"></param>
        public MvcResourceManagerBuilder(MvcResourceManagerConfig config)
        {
            MvcResourceManager.MarkAsMVC();
            this.config = config ?? new MvcResourceManagerConfig();
            this.mgr = new MvcResourceManager();
            this.mgr.IsSelfRender = true;

            if(HttpContext.Current != null)
            {
                HttpContext.Current.Items[typeof(MvcResourceManager)] = this.mgr;
            }

            this.config.Listeners = this.mgr.Listeners;
            this.config.CustomListeners = this.mgr.CustomListeners;
            this.config.DirectEvents = this.mgr.DirectEvents;
            this.config.CustomDirectEvents = this.mgr.CustomDirectEvents;
        }
        public static void SetTheme(Theme theme)
        {
            string themeName = theme == Ext.Net.Theme.Default ? "blue" : theme.ToString().ToLowerInvariant();

            ResourceManager.AddInstanceScript("Ext.net.ResourceMgr.setTheme(\"{0}\", \"{1}\");", MvcResourceManager.GetThemeUrl(theme), themeName);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public string ToHtmlString()
        {
            var mgr = new MvcResourceManager
            {
                CleanResourceUrl = config.CleanResourceUrl,
                ResourcePath = config.ResourcePath,
                Locale = config.Locale,
                Namespace = config.Namespace
            };

            if (config.ScriptMode != Ext.Net.ScriptMode.Release)
            {
                mgr.ScriptMode = config.ScriptMode;
            }

            if (config.RenderScripts != ResourceLocationType.Embedded)
            {
                mgr.RenderScripts = config.RenderScripts;
            }

            if (config.RenderStyles != ResourceLocationType.Embedded)
            {
                mgr.RenderStyles = config.RenderStyles;
            }

            if (config.Theme != Ext.Net.Theme.Default)
            {
                mgr.Theme = config.Theme;
            }

            if (!config.QuickTips)
            {
                mgr.QuickTips = config.QuickTips;
            }

            if (config.IDMode != Ext.Net.IDMode.Explicit)
            {
                mgr.IDMode = config.IDMode;
            }

            return mgr.SelfRender();
        }