是否有办法将对象实例传递到新对话框以进行主动对话。我想将一些自定义数据发送到对话框,主动使用该对话框将信息发送给用户。
E.g。
ProactiveMessage messageDetails = new ProactiveMessage() {
Message = “Hello User”,
Details = “blah blah”
}
我想将该对象发送到新对话框,以便在向用户构建消息时使用。
using (var scope = DialogModule.BeginLifetimeScope(Conversation.Container, message))
var botData = scope.Resolve<IBotData>();
await botData.LoadAsync(CancellationToken.None);
//This is our dialog stack
var stack = scope.Resolve<IDialogTask>();
//interrupt the stack. This means that we're stopping whatever conversation that is currently happening with the user
//Then adding this stack to run and once it's finished, we will be back to the original conversation
var dialog = new ProactiveDialog();
stack.Call(dialog.Void<object, IMessageActivity>(), null);
await stack.PollAsync(CancellationToken.None);
//flush dialog stack
await botData.FlushAsync(CancellationToken.None);
}