Skip to main content

SmartTextBoxAdapter

Namespace: Wisej.AI.Adapters

Assembly: Wisej.AI

Enhances a TextBox control with several AI features, including suggestions, translation, and auto-correction.

public class SmartTextBoxAdapter : SmartAdapter, IExtenderProvider

This class extends the functionality of a standard TextBox by providing AI-driven features such as text suggestions, automatic translation between specified languages, and auto-correction of text input. It uses SmartPrompt sessions to interact with AI services.

Constructors​

SmartTextBoxAdapter()​

Initializes a new instanced of SmartTextBoxAdapter.

Properties​

AcceptIconSource​

String: Gets or sets the source of the icon displayed when a suggestion is accepted. (Default: null)

ProcessingIconSource​

String: Gets or sets the source of the icon displayed during processing. (Default: "resource.wx/Wisej.AI/Icons/processing.svg")

SuggestionDelay​

Int32: Gets or sets the delay in milliseconds before suggestions are shown. (Default: 250)

SuggestionStyle​

String: Gets or sets the CSS style applied to suggestions. (Default: "opacity:0.4")

Methods​

GetEnableAutoCorrection(control)​

Determines whether the auto-correction feature is enabled for the specified control.

ParameterTypeDescription
controlControlThe control to check.

Returns: Boolean. True if auto-correction is enabled; otherwise, false.

Throws:

GetEnableSuggestions(control)​

Determines whether the suggestions feature is enabled for the specified control.

ParameterTypeDescription
controlControlThe control to check.

Returns: Boolean. True if suggestions are enabled; otherwise, false.

Throws:

GetEnableTranslation(control)​

Determines whether the translation feature is enabled for the specified control.

ParameterTypeDescription
controlControlThe control to check.

Returns: Boolean. True if translation is enabled; otherwise, false.

Throws:

GetTranslateFromLanguage(control)​

Gets the source language for the translation feature associated with the specified control.

ParameterTypeDescription
controlControlThe control from which to retrieve the source language.

Returns: String. The source language as a string.

Throws:

GetTranslateToLanguage(control)​

Gets the target language for the translation feature associated with the specified control.

ParameterTypeDescription
controlControlThe control from which to retrieve the target language.

Returns: String. The target language as a string.

Throws:

GetUserPhrases(control)​

Gets the user-provided phrases associated with the specified control.

ParameterTypeDescription
controlControlThe control from which to retrieve the user phrases.

Returns: String[]. An array of user phrases.

Throws:

GetUserRole(control)​

Gets the user role associated with the specified control.

ParameterTypeDescription
controlControlThe control from which to retrieve the user role.

Returns: String. The user role as a string.

Throws:

OnControlCreated(control)​

ParameterTypeDescription
controlControl

OnControlDisposed(control)​

ParameterTypeDescription
controlControl

RunAsyncCore(control)​

ParameterTypeDescription
controlControl

Returns: Task<Message>.

SetEnableAutoCorrection(control, value)​

ParameterTypeDescription
controlControl
valueBoolean

SetEnableSuggestions(control, value)​

ParameterTypeDescription
controlControl
valueBoolean

SetEnableTranslation(control, value)​

ParameterTypeDescription
controlControl
valueBoolean

SetTranslateFromLanguage(control, value)​

Sets the source language for the translation feature associated with the specified control.

ParameterTypeDescription
controlControlThe control to associate with the source language.
valueStringThe source language as a string.

Throws:

SetTranslateToLanguage(control, value)​

Sets the target language for the translation feature associated with the specified control.

ParameterTypeDescription
controlControlThe control to associate with the target language.
valueStringThe target language as a string.

Throws:

SetUserPhrases(control, phrases)​

ParameterTypeDescription
controlControl
phrasesString[]

SetUserRole(control, value)​

ParameterTypeDescription
controlControl
valueString

Implements​

NameDescription
IToolProviderRepresents a provider that supplies tools.