示例#1
0
        protected WorkflowState PostRouterRendering(WorkflowContinuation <PostRouteWorkflowData> wc, PostRouteWorkflowData data)
        {
            string             template    = data.HtmlResponse.Html;
            IWebSessionService sessionSvc  = ServiceManager.Get <IWebSessionService>();
            List <string>      objectNames = new List <string>()
            {
                "session", "context", "cfg"
            };
            List <object> objects = new List <object>()
            {
                sessionSvc, data.Context, ServiceManager.Get <IAppConfigService>()
            };

            objectNames.AddRange(appTemplateObjects.Keys);
            objects.AddRange(appTemplateObjects.Values);
            try
            {
                string newHtml = templateEngine.Parse(template, objectNames.ToArray(), objects.ToArray());
                data.HtmlResponse.Html = newHtml;
            }
            catch (Exception ex)
            {
                // ServiceManager.Get<ILoggerService>().Log(ex);
                ServiceManager.Get <ISemanticProcessor>().ProcessInstance <LoggerMembrane, ST_Exception>(ex2 => ex2.Exception = ex);
            }

            return(WorkflowState.Continue);
        }
示例#2
0
        protected WorkflowState PostRouterInjectLayout(WorkflowContinuation <PostRouteWorkflowData> wc, PostRouteWorkflowData data)
        {
            string websitePath = ServiceManager.Get <IAppConfigService>().GetValue("WebsitePath");
            string text        = File.ReadAllText(Path.Combine(websitePath, "Layout\\_layout.html"));

            data.HtmlResponse.Html = text.Replace("<% content %>", data.HtmlResponse.Html);

            return(WorkflowState.Continue);
        }