示例#1
0
        private void RenderReport(Report report, IRenderingContext context)
        {
            using (var childCtx = context.CreateChildContext(report.Name + ".html"))
            {
                childCtx.Render(report);

                context.Document.WriteLine("<a href=\"{0}\">{1}</a>", childCtx.RelativeDocumentUrl(context), report.Name);
            }
        }
示例#2
0
            private void Render(ValueWithDetails valueWithDetails)
            {
                if (valueWithDetails.Details == null)
                {
                    myContext.Document.WriteLine(HtmlRenderingUtils.GetDisplayText(valueWithDetails.Value));
                }
                else
                {
                    using (var childCtx = myContext.CreateChildContext(valueWithDetails.Details.Reference, valueWithDetails.Details.Name + ".html"))
                    {
                        childCtx.Render(valueWithDetails.Details);

                        myContext.Document.WriteLine("<a href=\"{0}\">{1}</a>", childCtx.RelativeDocumentUrl(myContext), HtmlRenderingUtils.GetDisplayText(valueWithDetails.Value));
                    }
                }
            }
示例#3
0
        public static IRenderingContext CreateChildContext(this IRenderingContext self, params string[] relativeDocumentPath)
        {
            var childCtx  = self.CreateChildContext();
            var directory = self.DocumentUrlRoot != null ? self.DocumentUrlRoot : self.DocumentRoot;

            childCtx.DocumentUrl = OS.CombinePaths(new[] { directory }, relativeDocumentPath);

            if (!Directory.Exists(childCtx.DocumentUrlRoot))
            {
                Directory.CreateDirectory(childCtx.DocumentUrlRoot);
            }

            childCtx.Document = new StreamWriter(childCtx.DocumentUrl);

            return(childCtx);
        }
        private void RenderSignal(IndicatorResult result, IRenderingContext context)
        {
            if (result.Report == null)
            {
                context.Document.WriteLine("<td>{0}</td>", HtmlRenderingUtils.GetDisplayText(result.Signal));
            }
            else
            {
                using (var childCtx = context.CreateChildContext(result.Indicator, result.Report.Name + ".html"))
                {
                    childCtx.Render(result.Report);

                    context.Document.WriteLine("<td><a href=\"{0}\">{1}</a></td>",
                                               childCtx.RelativeDocumentUrl(context), HtmlRenderingUtils.GetDisplayText(result.Signal));
                }
            }
        }
示例#5
0
 public static IRenderingContext CreateUniqChildContext(this IRenderingContext self)
 {
     return(self.CreateChildContext(Guid.NewGuid().ToString() + ".html"));
 }