Esempio n. 1
0
        private static void RequireWindowCommandScript()
        {
            WebUtility.RequiredScript(typeof(DeluxeScript));
            string script = string.Format("$HGRootNS.WindowCommand.set_commandInputID('{0}');", DeluxeScript.C_CommandIputClientID);

            script = DeluxeClientScriptManager.AddScriptTags(script);
            Page page = WebUtility.GetCurrentPage();

            page.ClientScript.RegisterStartupScript(page.GetType(), "RequireWindowCommandScript", script);
        }
Esempio n. 2
0
        /// <summary>
        /// 直接Response出刷新父页面脚本
        /// </summary>
        /// <param name="response">HttpResponse对象</param>
        public static void WriteRefreshParentWindowScriptBlock(this HttpResponse response)
        {
            if (response != null)
            {
                HttpContextExtension.ResponseRequireWindowCommandScriptBlock();

                string script = DeluxeClientScriptManager.AddScriptTags("$HGRootNS.WindowCommand.openerExecuteCommand(\"refresh\");");

                response.Write(script);
            }
        }
Esempio n. 3
0
        private static void RegisterScriptInHeader(Page page, FilePathConfigElementCollection urls)
        {
            foreach (FilePathConfigElement cssElement in urls)
            {
                string path = cssElement.Path;

                if (path.IsNotEmpty())
                {
                    DeluxeClientScriptManager.RegisterHeaderEndScript(page, path);
                }
            }
        }
Esempio n. 4
0
        internal static void ResponseRequireWindowCommandScriptBlock()
        {
            StringBuilder strB = new StringBuilder();

            strB.Append(WebUtility.GetRequiredScript(typeof(DeluxeScript)));
            strB.Append("\n");
            string script = string.Format("$HGRootNS.WindowCommand.set_commandInputID('{0}');", DeluxeScript.C_CommandIputClientID);

            strB.Append(DeluxeClientScriptManager.AddScriptTags(script));
            strB.Append("\n");

            ResponseString(HttpContext.Current, RequireWindowCommandScriptKey, strB.ToString());
        }
Esempio n. 5
0
        /// <summary>
        /// Response客户端弹出错误框
        /// </summary>
        /// <param name="response">HttpResponse对象</param>
        /// <param name="strMessage">错误框消息</param>
        /// <param name="strDetail">错误框详细信息</param>
        /// <param name="strTitle">错误框Title</param>
        public static void WriteShowClientErrorScriptBlock(this HttpResponse response, string strMessage, string strDetail, string strTitle)
        {
            if (response != null)
            {
                HttpContextExtension.ResponseClientMessageCommonScriptBlock();

                if (WebAppSettings.AllowResponseExceptionStackTrace() == false)
                {
                    strDetail = string.Empty;
                }

                string script = ScriptHelper.GetShowClientErrorScript(strMessage, strDetail, strTitle);

                script = DeluxeClientScriptManager.AddScriptTags(script);

                WebApplicationExceptionExtension.TryWriteAppLog(strMessage, strDetail);

                response.Write(script);
            }
        }
Esempio n. 6
0
        /// <summary>
        /// 向页面中增加与scriptType类型相关的脚本
        /// </summary>
        /// <param name="page">页面</param>
        /// <param name="scriptType">脚本相关类型</param>
        public static void RequiredScript(this Page page, Type scriptType)
        {
            if (page != null)
            {
                IEnumerable <ScriptReference> srs = Script.ScriptObjectBuilder.GetScriptReferences(scriptType);

                ScriptManager sm = ScriptManager.GetCurrent(page);
                foreach (ScriptReference sr in srs)
                {
                    if (sm != null)
                    {
                        sm.Scripts.Add(sr);
                    }
                    else
                    {
                        DeluxeClientScriptManager.RegisterHeaderScript(page, page.ClientScript.GetWebResourceUrl(scriptType, sr.Name));
                    }
                }

                Script.ScriptObjectBuilder.RegisterCssReferences(page, scriptType);
            }
        }
Esempio n. 7
0
        /// <summary>
        /// 得到某类型对应的脚本
        /// </summary>
        /// <param name="scriptType">类型信息</param>
        /// <returns></returns>
        public static string GetRequiredScript(Type scriptType)
        {
            ExceptionHelper.FalseThrow <ArgumentNullException>(scriptType != null, "scriptType");

            List <ResourceEntry> res  = Script.ScriptObjectBuilder.GetScriptResourceEntries(scriptType);
            StringBuilder        strB = new StringBuilder(1024);

            foreach (ResourceEntry entry in res)
            {
                Page page = GetCurrentPage();

                if (page == null)
                {
                    page = new Page();
                }

                string src = page.ClientScript.GetWebResourceUrl(entry.ComponentType, entry.ResourcePath);

                strB.Append(DeluxeClientScriptManager.GetScriptString(src));
                strB.Append("\n");
            }

            return(strB.ToString());
        }