示例#1
0
        /// <summary>
        /// 直接Response出刷新父页面脚本
        /// </summary>
        public static void ResponseRefreshParentWindowScriptBlock()
        {
            ResponseRequireWindowCommandScriptBlock();

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

            HttpContext.Current.Response.Write(script);
        }
示例#2
0
        /// <summary>
        /// 直接Response出关闭窗口脚本,然后结束Response
        /// </summary>
        public static void ResponseCloseWindowScriptBlock()
        {
            ResponseRequireWindowCommandScriptBlock();

            string script = DeluxeClientScriptManager.AddScriptTags("$HGRootNS.WindowCommand.executeCommand('close');");

            HttpContext.Current.Response.Write(script);
            HttpContext.Current.Response.End();
        }
示例#3
0
        private static void RequireWindowCommandScript()
        {
            RequiredScript(typeof(DeluxeScript));
            string script = string.Format("$HGRootNS.WindowCommand.set_commandInputID('{0}');", DeluxeScript.C_CommandIputClientID);

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

            page.ClientScript.RegisterStartupScript(page.GetType(), "RequireWindowCommandScript", script);
        }
示例#4
0
        /// <summary>
        /// 调整窗口大小和位置
        /// </summary>
        /// <param name="windowFeature"></param>
        public static void AdjustWindow(IWindowFeature windowFeature)
        {
            RequiredScript(typeof(DeluxeScript));

            string clintObject = WindowFeatureHelper.GetClientObject(windowFeature);
            string script      = string.Format("$HGRootNS.WindowFeatureFunction.adjustWindow({0});", clintObject);

            Page page = GetCurrentPage();

            DeluxeClientScriptManager.RegisterStartupScript(page, script);
        }
示例#5
0
        /// <summary>
        /// Response客户端弹出提示框
        /// </summary>
        /// <param name="strMessage">提示框消息</param>
        /// <param name="strDetail">提示框详细信息</param>
        /// <param name="strTitle">提示框Title</param>
        public static void ResponseShowClientMessageScriptBlock(string strMessage, string strDetail, string strTitle)
        {
            ResponseClientMessageCommonScriptBlock();

            string script = string.Format("$HGRootNS.ClientMsg.inform(\"{0}\", \"{1}\", \"{2}\");",
                                          CheckScriptString(strMessage), CheckScriptString(strDetail), CheckScriptString(strTitle));

            script = DeluxeClientScriptManager.AddScriptTags(script);

            HttpContext.Current.Response.Write(script);
        }
示例#6
0
        private static void ResponseRequireWindowCommandScriptBlock()
        {
            StringBuilder strB = new StringBuilder();

            strB.Append(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());
        }
示例#7
0
        /// <summary>
        /// 注册响应OnLoad事件的脚本
        /// </summary>
        /// <param name="page"></param>
        /// <param name="script"></param>
        public static void RegisterOnLoadScriptBlock(Page page, string script)
        {
            ScriptManager sm = ScriptManager.GetCurrent(page);

            if (sm != null)
            {
                DeluxeClientScriptManager.RegisterAjaxApplicationLoadScriptBlock(page,
                                                                                 script);
            }
            else
            {
                DeluxeClientScriptManager.RegisterOnLoadScriptBlock(page, script);
            }
        }
示例#8
0
        /// <summary>
        /// 获取调整窗口大小和位置脚本
        /// </summary>
        /// <param name="windowFeature"></param>
        /// <param name="addScriptTags"></param>
        /// <returns></returns>
        public static string ToAdjustWindowScriptBlock(this IWindowFeature windowFeature, bool addScriptTags)
        {
            string requireScript = WebUtility.GetRequiredScriptBlock(typeof(DeluxeScript));

            string clintObject = WindowFeatureHelper.GetClientObject(windowFeature);
            //string callScript = string.Format("$HGRootNS.WindowFeatureFunction.adjustWindow({0});", clintObject);
            string callScript = string.Format("$HGRootNS.WindowFeatureFunction.registerAdjustWindow({0});", clintObject);

            string script = string.Format("{0}\n{1}", requireScript, callScript);

            if (addScriptTags)
            {
                script = DeluxeClientScriptManager.AddScriptTags(script);
            }

            return(script);
        }
示例#9
0
        /// <summary>
        /// Response客户端弹出错误框
        /// </summary>
        /// <param name="strMessage">错误框消息</param>
        /// <param name="strDetail">错误框详细信息</param>
        /// <param name="strTitle">错误框Title</param>
        public static void ResponseShowClientErrorScriptBlock(string strMessage, string strDetail, string strTitle)
        {
            ResponseClientMessageCommonScriptBlock();

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

            string script = string.Format("$HGRootNS.ClientMsg.stop(\"{0}\", \"{1}\", \"{2}\");",
                                          CheckScriptString(strMessage), CheckScriptString(strDetail), CheckScriptString(strTitle));

            script = DeluxeClientScriptManager.AddScriptTags(script);

            WebApplicationExceptionExtension.TryWriteAppLog(strMessage, strDetail);

            HttpContext.Current.Response.Write(script);
        }
示例#10
0
        /// <summary>
        /// 向页面添加配置扩展信息
        /// </summary>
        public static void LoadConfigPageContent(bool checkAutoLoad)
        {
            PageContentSection section = ConfigSectionFactory.GetPageExtensionSection();

            Page page = GetCurrentPage();

            if (checkAutoLoad)
            {
                if (!section.AutoLoad)
                {
                    return;
                }

                if (page.Header == null)
                {
                    return;
                }

                string headerAutoLoad = page.Header.Attributes["autoLoad"];

                if (headerAutoLoad.IsNotEmpty() && headerAutoLoad.ToLower() == "false")
                {
                    return;
                }
            }

            foreach (FilePathConfigElement cssElm in section.CssClasses)
            {
                string path = cssElm.Path;
                if (path != string.Empty)
                {
                    ClientCssManager.RegisterHeaderEndCss(page, path);
                }
            }

            foreach (FilePathConfigElement scriptElm in section.Scripts)
            {
                string path = scriptElm.Path;
                if (path != string.Empty)
                {
                    DeluxeClientScriptManager.RegisterHeaderEndScript(page, path);
                }
            }
        }
示例#11
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 re in res)
            {
                Page page = GetCurrentPage();
                if (page == null)
                {
                    page = new Page();
                }
                string src = page.ClientScript.GetWebResourceUrl(re.ComponentType, re.ResourcePath);

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

            return(strB.ToString());
        }
示例#12
0
        /// <summary>
        /// 向页面中增加与scriptType类型相关的脚本
        /// </summary>
        /// <param name="scriptType">脚本相关类型</param>
        public static void RequiredScript(Type scriptType)
        {
            Page page = GetCurrentPage();

            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(GetCurrentPage(), scriptType);
        }