c#bot框架-resumeafter中的DeleteStateForUser

c#bot框架-resumeafter中的DeleteStateForUser,c#,botframework,C#,Botframework,在表单生成器对话框之后,是否可以在resumAfter中使用DeleteStateForUser,以退出当前对话框 context.Call(searchFormDialog, this.ResumeAfterBuildSatisfactionForm); private IForm<SatisfactionQuery> BuildSatisfactionForm() { OnCompletionAsyncDelegate<Satis

在表单生成器对话框之后,是否可以在
resumAfter
中使用
DeleteStateForUser
,以退出当前对话框

    context.Call(searchFormDialog, this.ResumeAfterBuildSatisfactionForm);


    private IForm<SatisfactionQuery> BuildSatisfactionForm()
    {
        OnCompletionAsyncDelegate<SatisfactionQuery> processSearch = async (context, state) =>
        {
            await context.PostAsync($"Thx");
        };

        return new FormBuilder<SatisfactionQuery>()
            //.Message("")
            .AddRemainingFields()
            .OnCompletion(processSearch)
            .Build();
    }

private async Task ResumeAfterBuildSatisfactionForm(IDialogContext context, IAwaitable<SatisfactionQuery> result)
{
  //but i don't have Activity here :-(
activity.GetStateClient().BotState.DeleteStateForUser(activity.ChannelId,activity.From.Id);
}
context.Call(searchFormDialog,this.ResumeAfterBuildSatisfactionForm);
私有IForm BuildSatisfactionForm()
{
OnCompletionAsyncDelegate processSearch=async(上下文、状态)=>
{
wait context.PostAsync($“Thx”);
};
返回新的FormBuilder()
//.Message(“”)
.AddRemainingFields()
.OnCompletion(processSearch)
.Build();
}
私有异步任务ResumeAfterBuildSatisfactionForm(IDialogContext上下文,IAwaitable结果)
{
//但我在这里没有活动:-(
activity.GetStateClient().BotState.DeleteStateForUser(activity.ChannelId、activity.From.Id);
}

您可以使用ServiceUrl创建StateClient:

private async Task ResumeAfterBuildSatisfactionForm(IDialogContext context, IAwaitable<SatisfactionQuery> result)
{
    var msg = context.MakeMessage();
    var stateClient = new StateClient(new Uri(msg.ServiceUrl));
    stateClient.BotState.DeleteStateForUser(msg.ChannelId, msg.From.Id);
}
私有异步任务ResumeAfterBuildSatisfactionForm(IDialogContext上下文,IAwaitable结果)
{
var msg=context.MakeMessage();
var stateClient=newstateclient(新Uri(msg.ServiceUrl));
stateClient.BotState.DeleteStateForUser(msg.ChannelId,msg.From.Id);
}

Sorry@EricDahlvang您知道如何使用诸如context.MakeMessage().From=ChannelAccount(id:ContextConstants.BotId,name:ContextConstants.BotName)之类的Bot帐户发送FormBuilder查询吗?