private async Task GreetAsync(IDialogContext context, IAwaitable <IMessageActivity> awaitableMessageActivity)
        {
            IMessageActivity messageActivity = await awaitableMessageActivity;

            string userName = DataBagHelper.GetValue <string>(context, UserName);

            if (DataBagHelper.CheckAndResetValue(context, IsNameMessage))
            {
                userName = messageActivity.Text;
                DataBagHelper.SetValue(context, UserName, userName);
            }

            context.Done(messageActivity);
        }
Beispiel #2
0
        private async static Task <IDialog <string> > RoomReservationContinuation(IBotContext context, IAwaitable <object> item)
        {
            await item;

            string userName = DataBagHelper.GetValue <string>(context, UserName);

            if (string.IsNullOrEmpty(userName))
            {
                return(Chain.Return <string>("Thanks. We have booked reservation for you."));
            }
            else
            {
                return(Chain.Return <string>($"Thanks, {userName}. We have booked reservation for you."));
            }
        }
        private static async Task RequestNameAsync(IDialogContext context)
        {
            string userName = DataBagHelper.GetValue <string>(context, UserName);

            if (string.IsNullOrEmpty(userName))
            {
                await context.PostAsync("Hi there, I am John Bot. Please specify you name.");

                DataBagHelper.SetValue(context, IsNameMessage, true);
            }
            else
            {
                await context.PostAsync($"Hi {userName}, I am John Bot.");
            }
        }