示例#1
0
        void HandleCanceledForm(Activity activity, FormCanceledException ex)
        {
            string responseMessage = "You cancelled the form.";

            var connector = new ConnectorClient(new Uri(activity.ServiceUrl));
            var response  = activity.CreateReply(responseMessage);

            connector.Conversations.ReplyToActivity(response);
        }
示例#2
0
        void HandleCanceledForm(Activity activity, FormCanceledException ex)
        {
            string responseMessage =
                $"Your conversation ended on {ex.Last}. " +
                "The following properties have values: " +
                string.Join(", ", ex.Completed);

            var connector = new ConnectorClient(new Uri(activity.ServiceUrl));
            var response  = activity.CreateReply(responseMessage);

            connector.Conversations.ReplyToActivity(response);
        }
示例#3
0
        private async Task OnPersonDialogCancelled(IDialogContext context, FormCanceledException <Person> formCanceledException)
        {
            order.CustomerDetails = formCanceledException.LastForm;
            PromptDialog.Choice(context, async(subContext, result) =>
            {
                try
                {
                    await result;
                }
                catch (TooManyAttemptsException)
                {
                    subContext.Call(dialogFactory.Create <HelpDialog, bool>(false), null);
                    return;
                }
                var response = await result;
                if (response.ToLower().Contains("doplnit"))
                {
                    var form = new FormDialog <Person>(order.CustomerDetails, Person.BuildForm, FormOptions.PromptInStart);
                    subContext.Call(form, OnPersonalDetailsGiven);
                    return;
                }

                if (response.ToLower().Contains("znovu"))
                {
                    StartOver(subContext);
                    return;
                }
                if (response.ToLower().Contains("spojit"))
                {
                    await CheckAvailableOperators(subContext);
                    return;
                }
            },
                                new [] { Resources.MluviiDialog_return_back_to_person_form, Resources.HelpDialog_start_over, Resources.HelpDialog_connect_operator },
                                Resources.MluviiDialog_person_form_cancelled,
                                Resources.RetryText, MaxAttempts);
        }