public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (!(value is Document document)) { return(null); } FrameworkContentElement content; DocumentRenderTargetBase target; if (DocumentType == PresentationDocumentType.FixedDocument) { var fixedDocument = new FixedDocument(); target = new FixedDocumentRenderTarget(fixedDocument); content = fixedDocument; } else { var flowDocument = new FlowDocument(); target = new FlowDocumentRenderTarget(flowDocument); content = flowDocument; } target.Background = Background; target.FontFamily = FontFamily; target.FontSize = FontSize; target.FontStretch = FontStretch; target.FontStyle = FontStyle; target.FontWeight = FontWeight; ConsoleRenderer.RenderDocument(document, target, new Rect(new Size(ConsoleWidth, Size.Infinity))); return(content); }
public object Convert (object value, Type targetType, object parameter, CultureInfo culture) { var document = value as Document; if (document == null) return null; FrameworkContentElement content; DocumentRenderTargetBase target; if (DocumentType == PresentationDocumentType.FixedDocument) { var fixedDocument = new FixedDocument(); target = new FixedDocumentRenderTarget(fixedDocument); content = fixedDocument; } else { var flowDocument = new FlowDocument(); target = new FlowDocumentRenderTarget(flowDocument); content = flowDocument; } target.Background = Background; target.FontFamily = FontFamily; target.FontSize = FontSize; target.FontStretch = FontStretch; target.FontStyle = FontStyle; target.FontWeight = FontWeight; ConsoleRenderer.RenderDocument(document, target, new Rect(new Size(ConsoleWidth, Size.Infinity))); return content; }