c# - Bot Framework - Botstate between Dialogs loses values -


i'm trying pass state between different dialogs, , seem either a) not calling dialogs correctly or b) not using botstate correctly (or both).

can tell me losing when open second dialog? opened using context.forward();

in messagescontroller able set state;

stateclient stateclient = activity.getstateclient(); botdata userdata = await stateclient.botstate.getuserdataasync(activity.channelid, activity.from.id); userdata.setproperty<bool>("sessionactive", true); await stateclient.botstate.setuserdataasync(activity.channelid, activity.from.id, userdata); 

i open dialog controls access other dialogs;

await conversation.sendasync(activity, () => new dialogcontroller()); 

this separate class;

public class dialogcontroller : idialog<object> 

within dialog can access value set 'true' - works;

stateclient stateclient = new stateclient(new uri(message.serviceurl)); botdata userdata = await stateclient.botstate.getuserdataasync(message.channelid, message.from.id); userdata.getproperty<bool>("sessionactive") 

however, within dialog go on open second dialog dependant on state;

await context.forward(new subdialog(), throwouttask, message, cts.token); 

this separate class;

public class subdialog: idialog<object> 

however, when try retrieve 'sessionactive' state, in same way before, value false (i.e. instantiated first time)..?

when requesting state dialog class, should using context.

bool sessionactive = context.userdata.get<bool>("sessionactive"); 

Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -