예제 #1
0
 protected virtual string RenderPage(IDotvvmRequestContext context, DotvvmView view)
 {
     // prepare the render context
     // get the HTML
     using (var textWriter = new StringWriter())
     {
         var htmlWriter = new HtmlWriter(textWriter, context);
         view.Render(htmlWriter, context);
         return(textWriter.ToString());
     }
 }
예제 #2
0
        protected virtual MemoryStream RenderPage(IDotvvmRequestContext context, DotvvmView view)
        {
            var outStream = new MemoryStream();

            using (var textWriter = new StreamWriter(outStream, Encoding.UTF8, 4096, leaveOpen: true))
            {
                var htmlWriter = new HtmlWriter(textWriter, context);
                view.Render(htmlWriter, context);
            }
            outStream.Position = 0;
            return(outStream);
        }
예제 #3
0
        protected virtual MemoryStream RenderPage(IDotvvmRequestContext context, DotvvmView view)
        {
            var outStream = new MemoryStream();

            using (var textWriter = new StreamWriter(outStream, new UTF8Encoding(encoderShouldEmitUTF8Identifier: false), 4096, leaveOpen: true))
            {
                var htmlWriter = new HtmlWriter(textWriter, context);
                view.Render(htmlWriter, context);
            }
            outStream.Position = 0;
            return(outStream);
        }
예제 #4
0
        protected static string InvokeLifecycleAndRender(DotvvmView view, TestDotvvmRequestContext context)
        {
            view.DataContext = context.ViewModel;
            view.SetValue(Internal.RequestContextProperty, context);

            DotvvmControlCollection.InvokePageLifeCycleEventRecursive(view, LifeCycleEventType.PreRenderComplete);
            using (var text = new StringWriter())
            {
                var html = new HtmlWriter(text, context);
                view.Render(html, context);
                return(text.ToString());
            }
        }
예제 #5
0
        protected string RenderPage(IDotvvmRequestContext context, DotvvmView view)
        {
            // embed resource links
            EmbedResourceLinks(view);

            // prepare the render context
            // get the HTML
            using (var textWriter = new StringWriter())
            {
                var htmlWriter = new HtmlWriter(textWriter, context);
                view.Render(htmlWriter, context);
                return(textWriter.ToString());
            }
        }