語言

IFormBuilder<T> 介面

定義

建立表單的介面。

public interface IFormBuilder<T> where T : class
type IFormBuilder<'T (requires 'T : null)> = interface
Public Interface IFormBuilder(Of T)

類型參數

T

形態狀態。

衍生

備註

一個表單由一系列步驟組成,這些步驟可以是以下之一:

預設情況下,步驟的執行 Message(String, ActiveDelegate<T>, IEnumerable<String>)順序是 、 和 Field(IField<T>)Confirm(String, ActiveDelegate<T>, IEnumerable<String>) 呼叫。 若未明確控制,步驟將依照表單狀態中定義的順序執行,並附有最終確認。 這個介面讓你能靈活地組合欄位、訊息和確認函件來建立表單。 流暢的建構單元提供了常見的模式,例如欄位是基於你的狀態類別,但你也可以用 Advanced.IField 建立自己的表單定義。 如果你想用 C# 反射在狀態類別上建立表單,可以用 FormBuilder。 要透過 JSON Schema 宣告式建立表單,可以使用 Json.FormBuilderJson。

表單對當前執行緒的 UI 文化很敏感。 Microsoft。如果有的話,Bot.Builder 的字串會本地化到該文化。 你也可以透過呼叫 IForm.SaveResources 或使用 RView 工具將該資源加入專案,將產生的字串本地化。 對於動態欄位、訊息或確認中的字串,你需要使用一般的 C# 機制來本地化它們。 請參考概覽文件以獲得更多資訊。

屬性

名稱 Description
Configuration

表單設定提供預設範本與設定。

方法

名稱 Description
AddRemainingFields(IEnumerable<String>)

新增所有尚未加入表單的欄位。

Build(Assembly, String)

根據建構者所要求的方法來建立表單。

Confirm(MessageDelegate<T>, ActiveDelegate<T>, IEnumerable<String>)

使用代理生成確認訊息,動態建立訊息。

Confirm(PromptAttribute, ActiveDelegate<T>, IEnumerable<String>)

新增確認步驟。

Confirm(String, ActiveDelegate<T>, IEnumerable<String>)

新增確認步驟。

Field(IField<T>)

透過提供你自己的場定義來細化場步驟。

Field(String, ActiveDelegate<T>, ValidateAsyncDelegate<T>)

定義一個步驟,用來填寫表單狀態中的特定值。

Field(String, PromptAttribute, ActiveDelegate<T>, ValidateAsyncDelegate<T>)

定義一個步驟,用來填寫表單狀態中的特定值。

Field(String, String, ActiveDelegate<T>, ValidateAsyncDelegate<T>)

定義一個步驟,用來填寫表單狀態中的特定值。

HasField(String)

測試是否已經存在一個欄位 。name

Message(MessageDelegate<T>, ActiveDelegate<T>, IEnumerable<String>)

用代理來動態建立訊息。

Message(PromptAttribute, ActiveDelegate<T>, IEnumerable<String>)

顯示一則格式控制較多且不需回應的訊息。

Message(String, ActiveDelegate<T>, IEnumerable<String>)

展示不需要回應的訊息。

OnCompletion(OnCompletionAsyncDelegate<T>)

表格完成後委託人致電。

Prompter(PromptAsyncDelegate<T>)

委託發送提示給使用者。

適用於