如何解决在相应机器人上显示动态字段的问题

时间:2016-07-14 09:37:32

标签: c# botframework

我正在使用bot框架技术,在我的一个项目中,我想设置动态字段,因为我在下面写了一行代码。

.Field(new FieldReflector<Customer>("Savings_Balance")
.SetType(null)
.SetActive((state) => state.Option == Options.SavingsAccountBalance)
.SetDefine(async (state, field) =>
    {
        if (state.Savings_Balance != null)
         {
            if (state.Savings_Balance.AccountNumber != null && state.Savings_Balance.PIN != null)
            {
                string availableBalance = SQLDatabaseService.checkingAccountBalance(state.Savings_Balance.AccountNumber, state.Savings_Balance.PIN);
                if (availableBalance != null && availableBalance != "")
                {
                    var totalsavingsbalance = new PromptAttribute($"Total available savings account balance is ${availableBalance:F2}");                          


                    field.SetPrompt(totalsavingsbalance);

                    return true;
                }
                else
                {
                    field.SetPrompt(new PromptAttribute($"I'm sorry. I didn't understand you."));
                    return false;
                }
            }
            else
            {
                field.SetPrompt(new PromptAttribute($"I'm sorry. I didn't understand you."));
                return false;
            }
        }
        else
        {
            field.SetPrompt(new PromptAttribute($"I'm sorry. I didn't understand you."));
            return false;
        }
     }))

var totalsavingsbalance = new PromptAttribute($"Total available savings account balance is ${availableBalance:F2}");                          
field.SetPrompt(totalsavingsbalance);

在旧版本的bot中,上述字段将成功显示。但是当我更新到版本3时,即使上面的行正常执行也没有显示任何字段,没有任何例外。 请告诉我什么是问题,我该如何解决。

此致

与Pradeep

0 个答案:

没有答案