Table of Contents

Class InteractiveElement<TResponse>

Namespace
ConsoleAppVisuals.Models
Assembly
ConsoleAppVisuals.dll

The InteractiveElement class is an abstract class that represents the interactive elements.

public abstract class InteractiveElement<TResponse> : Element

Type Parameters

TResponse
Inheritance
InteractiveElement<TResponse>
Derived
Inherited Members

Remarks

For more information, consider visiting the documentation available here.

Constructors

InteractiveElement()

protected InteractiveElement()

Fields

_interactionResponse

The response of the user.

protected List<InteractionEventArgs<TResponse>?> _interactionResponse

Field Value

List<InteractionEventArgs<TResponse>>

Properties

MaxNumberOfThisElement

Gets the maximum number of this element that can be drawn on the console. As an interactive element, the value is 1.

public override sealed int MaxNumberOfThisElement { get; }

Property Value

int

Type

Gets the type of the element.

public override sealed ElementType Type { get; }

Property Value

ElementType

Methods

GetResponse()

Gets the response of the user after an interaction.

[Visual]
public InteractionEventArgs<TResponse>? GetResponse()

Returns

InteractionEventArgs<TResponse>

Null if the user has not interacted with the element, otherwise the response of the user.

Remarks

This sample shows how to use the GetResponse() method using the var keyword:

var response = element.GetResponse();

For more information, consider visiting the documentation available here.

GetResponseHistory()

Gets the history of the responses of the user after interactions.

[Visual]
public List<InteractionEventArgs<TResponse>?> GetResponseHistory()

Returns

List<InteractionEventArgs<TResponse>>

The history of the responses of the user after interactions.

Remarks

For more information, consider visiting the documentation available here.

RenderOptionsAfterHand()

Stops listening to the user's interactions with the element.

[Visual]
protected override sealed void RenderOptionsAfterHand()

Remarks

For more information, consider visiting the documentation available here.

RenderOptionsBeforeHand()

Listens to the user's interactions with the element.

[Visual]
protected override sealed void RenderOptionsBeforeHand()

Remarks

For more information, consider visiting the documentation available here.

SendResponse(object?, InteractionEventArgs<TResponse>)

Triggers the EndOfInteractionEvent event.

[Visual]
protected void SendResponse(object? sender, InteractionEventArgs<TResponse> e)

Parameters

sender object

The sender of the event.

e InteractionEventArgs<TResponse>

The response of the user.

SetInteractionResponse(object?, InteractionEventArgs<TResponse>)

Sets the response of the user in the attribute field.

[Visual]
protected void SetInteractionResponse(object? sender, InteractionEventArgs<TResponse> e)

Parameters

sender object

The sender of the event.

e InteractionEventArgs<TResponse>

The response of the user.

Events

EndOfInteractionEvent

The event that is triggered when the user has interacted with the element.

public event EventHandler<InteractionEventArgs<TResponse>>? EndOfInteractionEvent

Event Type

EventHandler<InteractionEventArgs<TResponse>>