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