コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            WebForms.RegisterStartupScript(Page, App.Name + "-UIEngineAngularBootstrapPath", "<script>var " + App.Name + "_UIEngineAngularBootstrapPath ='" + UIEngineAngularBootstrapPath + "'; var " + App.Name + "_UITemplatePath = '" + AppTemplatePath + "';</script>", false);

            //Register App JS
            if (!IsPostBack)
            {
                WebForms.RegisterStartupScriptInclude(Page, App.Name + "-AppJS", Page.ResolveUrl(ScriptHandler + "?appname=" + App.Name.ToLower() + "&portalid=" + PortalId.ToString() + "&moduleid=" + ModuleId.ToString()));


                Dictionary <string, object> appProperties = new Dictionary <string, object>
                {
                    { "AppName", App },
                    { "AppTemplatePath", Page.ResolveUrl(AppTemplatePath) },
                    { "FrameworkTemplatePath", Page.ResolveUrl(FrameworkTemplatePath) },
                    { "AngularTemplates", AngularViews },
                    { "ShowMissingKeys", ShowMissingKeys.ToString().ToLower() },
                    { "ResourceFilePath", AppResourceFilePath },
                    { "AppConfigJS", AppConfigJS },
                    { "AppJS", AppJSPath },
                    { "Dependencies", FrameworkManager.GetDependenciesModuleNames(Dependencies) }
                };

                Application["app-" + App.Name.ToLower()] = appProperties;

                InstallScheduler();
            }

            //Register Angular Template Paths
            WebForms.RegisterClientScriptBlock(Page, "AngularTemplates", "var mnAngularTemplatePath = { };", true);
            WebForms.RegisterStartupScript(Page, App.Name + "-TemplatePath", "mnAngularTemplatePath['" + App.Name + "'] = '" + Page.ResolveUrl(AppTemplatePath) + "';", true);

            //Register APP CSS
            if (!IsPostBack && File.Exists(Server.MapPath(AppCSSPath)))
            {
                WebForms.LinkCSS(Page, App.Name + "-CSS", Page.ResolveUrl(AppCSSPath), true);
            }
        }