Class HtmlBuilder
- Namespace
- SharpConsoleUI.Builders
- Assembly
- SharpConsoleUI.dll
Fluent builder for HtmlControl
public sealed class HtmlBuilder : IControlBuilder<HtmlControl>
- Inheritance
-
HtmlBuilder
- Implements
- Inherited Members
- Extension Methods
Methods
Build()
Builds the HtmlControl.
public HtmlControl Build()
Returns
Create()
Creates a new HtmlBuilder instance.
public static HtmlBuilder Create()
Returns
OnContentLoaded(EventHandler)
Sets the ContentLoaded event handler. Fires after the text layout of a fetched page has been committed — before images finish loading. Use OnLoadingCompleted(EventHandler) to wait for everything.
public HtmlBuilder OnContentLoaded(EventHandler handler)
Parameters
handlerEventHandler
Returns
OnLinkClicked(EventHandler<LinkClickedEventArgs>)
Sets the LinkClicked event handler.
public HtmlBuilder OnLinkClicked(EventHandler<LinkClickedEventArgs> handler)
Parameters
handlerEventHandler<LinkClickedEventArgs>
Returns
OnLinkHover(EventHandler<LinkHoverEventArgs>)
Sets the LinkHover event handler.
public HtmlBuilder OnLinkHover(EventHandler<LinkHoverEventArgs> handler)
Parameters
handlerEventHandler<LinkHoverEventArgs>
Returns
OnLoadError(EventHandler<LoadErrorEventArgs>)
Sets the LoadError event handler.
public HtmlBuilder OnLoadError(EventHandler<LoadErrorEventArgs> handler)
Parameters
handlerEventHandler<LoadErrorEventArgs>
Returns
OnLoadingCompleted(EventHandler)
Sets the LoadingCompleted event handler. Fires exactly once per LoadUrlAsync call when every phase of loading has finished (including progressive image loading) — on success, cancellation, or error.
public HtmlBuilder OnLoadingCompleted(EventHandler handler)
Parameters
handlerEventHandler
Returns
WithBackgroundColor(Color)
Sets the background color.
public HtmlBuilder WithBackgroundColor(Color color)
Parameters
colorColor
Returns
WithBaseUrl(string)
Sets the base URL for resolving relative links.
public HtmlBuilder WithBaseUrl(string baseUrl)
Parameters
baseUrlstring
Returns
WithBlockSpacing(int)
Sets the spacing between block elements.
public HtmlBuilder WithBlockSpacing(int spacing)
Parameters
spacingint
Returns
WithColors(Color, Color)
Sets both foreground and background colors.
public HtmlBuilder WithColors(Color foreground, Color background)
Parameters
Returns
WithContent(string)
Sets the HTML content to display.
public HtmlBuilder WithContent(string content)
Parameters
contentstring
Returns
WithContent(string, string)
Sets the HTML content with a base URL for resolving relative links.
public HtmlBuilder WithContent(string content, string baseUrl)
Parameters
Returns
WithForegroundColor(Color)
Sets the foreground color.
public HtmlBuilder WithForegroundColor(Color color)
Parameters
colorColor
Returns
WithHeight(int)
Sets the height.
public HtmlBuilder WithHeight(int height)
Parameters
heightint
Returns
WithHorizontalAlignment(HorizontalAlignment)
Sets the horizontal alignment.
public HtmlBuilder WithHorizontalAlignment(HorizontalAlignment alignment)
Parameters
alignmentHorizontalAlignment
Returns
WithLinkColor(Color)
Sets the color used for unvisited links.
public HtmlBuilder WithLinkColor(Color color)
Parameters
colorColor
Returns
WithLoadingText(string)
Sets the text displayed while content is loading.
public HtmlBuilder WithLoadingText(string loadingText)
Parameters
loadingTextstring
Returns
WithMargin(int)
Sets uniform margin.
public HtmlBuilder WithMargin(int margin)
Parameters
marginint
Returns
WithMargin(int, int, int, int)
Sets the margin.
public HtmlBuilder WithMargin(int left, int top, int right, int bottom)
Parameters
Returns
WithName(string)
Sets the control name for lookup.
public HtmlBuilder WithName(string name)
Parameters
namestring
Returns
WithScrollbarVisibility(ScrollbarVisibility)
Sets when the vertical scrollbar should be displayed.
public HtmlBuilder WithScrollbarVisibility(ScrollbarVisibility visibility)
Parameters
visibilityScrollbarVisibility
Returns
WithShowBulletPoints(bool)
Sets whether bullet points are rendered for lists.
public HtmlBuilder WithShowBulletPoints(bool show = true)
Parameters
showbool
Returns
WithShowImages(bool)
Sets whether images are rendered (as alt text placeholders).
public HtmlBuilder WithShowImages(bool show = true)
Parameters
showbool
Returns
WithTabSize(int)
Sets the tab size in spaces.
public HtmlBuilder WithTabSize(int tabSize)
Parameters
tabSizeint
Returns
WithTag(object)
Sets a tag object.
public HtmlBuilder WithTag(object tag)
Parameters
tagobject
Returns
WithVerticalAlignment(VerticalAlignment)
Sets the vertical alignment.
public HtmlBuilder WithVerticalAlignment(VerticalAlignment alignment)
Parameters
alignmentVerticalAlignment
Returns
WithVisible(bool)
Sets the visibility.
public HtmlBuilder WithVisible(bool visible = true)
Parameters
visiblebool
Returns
WithVisitedLinkColor(Color)
Sets the color used for visited links.
public HtmlBuilder WithVisitedLinkColor(Color color)
Parameters
colorColor
Returns
WithWidth(int)
Sets the width.
public HtmlBuilder WithWidth(int width)
Parameters
widthint
Returns
Operators
implicit operator HtmlControl(HtmlBuilder)
Implicit conversion to HtmlControl.
public static implicit operator HtmlControl(HtmlBuilder builder)
Parameters
builderHtmlBuilder