/// <summary> /// Renders the specified <see cref="MvcComponentBase" /> to the current WebForms view. /// </summary> /// <param name="helper">The HTML helper instance that this method extends.</param> /// <param name="component">The <see cref="MvcComponentBase" /> to render.</param> public static void KrystalwareWebForms(this HtmlHelper helper, MvcComponentBase component) { IComponentRenderer renderer = RendererFactory.GetRenderer(component); renderer.Register(component); using (HtmlTextWriter w = new HtmlTextWriter(helper.ViewContext.Writer)) renderer.Render(component, w); }
/// <summary> /// Renders the specified <see cref="MvcComponentBase" /> and returns the output for a Razor view. /// </summary> /// <param name="helper">The HTML helper instance that this method extends.</param> /// <param name="component">The <see cref="MvcComponentBase" /> to render.</param> public static MvcHtmlString KrystalwareRazor(this HtmlHelper helper, MvcComponentBase component) { IComponentRenderer renderer = RendererFactory.GetRenderer(component); renderer.Register(component); using (StringWriter s = new StringWriter()) { using (HtmlTextWriter w = new HtmlTextWriter(s)) renderer.Render(component, w); return(MvcHtmlString.Create(s.ToString())); } }
protected void Render(TRendererContext ctx, IComponent component) { if (component.Layout.Size.Width * component.Layout.Size.Height == 0) { return; } if (_renderers.TryGetValue(component.GetType(), out var render)) { render(ctx, component); } else { DefaultRenderer.Render(ctx, component, Render); } }
public void RegisterRenderer <TComponent>(IComponentRenderer <TRendererContext, TComponent> renderer) where TComponent : IComponent { _renderers[typeof(TComponent)] = (ctx, c) => renderer.Render(ctx, (TComponent)c, Render); }
private void Render(double interpolation) { _currentAppStateRenderer.Render(interpolation); }