C# 编号为compt的问题<&燃气轮机;在Bot框架下

C# 编号为compt的问题<&燃气轮机;在Bot框架下,c#,botframework,C#,Botframework,我已将以下对话框添加到我的瀑布: AddDialog(new NumberPrompt<int>($"{nameof(ValidationDialog)}.integer")); AddDialog(新的numbercompt($“{nameof(ValidationDialog)}.integer”); 将在以下功能中提示: private async Task<DialogTurnResult> CheckNumeric(WaterfallStepContext

我已将以下对话框添加到我的瀑布:

AddDialog(new NumberPrompt<int>($"{nameof(ValidationDialog)}.integer"));
AddDialog(新的numbercompt($“{nameof(ValidationDialog)}.integer”);
将在以下功能中提示:

 private async Task<DialogTurnResult> CheckNumeric(WaterfallStepContext stepContext, CancellationToken cancellationToken)
    {
        return await stepContext.PromptAsync($"{nameof(ValidationDialog)}.integer",
            new PromptOptions
            {
                Prompt = MessageFactory.Text("Please enter an integer number greater than 0 or press any letter to skip"),
                RetryPrompt = MessageFactory.Text("Invalid number, try again!")
            }, cancellationToken);
    }
private async Task CheckNumeric(WaterCallStepContext stepContext,CancellationToken CancellationToken)
{
返回wait wait stepContext.PromptAsync($“{nameof(ValidationDialog)}.integer”,
新提示
{
Prompt=MessageFactory.Text(“请输入大于0的整数或按任意字母跳过”),
RetryPrompt=MessageFactory.Text(“无效数字,请重试!”)
},取消令牌);
}
输入:3*10^2

预期输出:提示应接受输入或重新提示并返回无效数字,然后重试


实际输出:它只存储3作为输入。

上述行为是因为NumberRecognizer.RecognizeNumber将输入识别为数字,并将3*10^2解析为3作为值(即>0)。您可以做的是添加一个验证器,检查识别的值是否与用户输入的值相同。您可以参考具有数字提示和验证的提示示例。上述行为是因为NumberRecognizer.RecognizeNumber将输入识别为数字,并将3*10^2解析为3作为值(大于0)。您可以做的是添加一个验证器,检查识别的值是否与用户输入的值相同。您可以参考prompt示例,该示例包含一个带有验证的数字prompt。