public async Task <DialogTurnResult> Handle(DialogContext context, InteruptAction interuptOption, CancellationToken cancellationToken) { if (context == null) { throw new ArgumentNullException(nameof(context)); } return(await _services[interuptOption].Handle(context, interuptOption, cancellationToken)); }
public async Task <DialogTurnResult> Handle(DialogContext innerDc, InteruptAction options, CancellationToken cancellationToken) { if (innerDc == null) { throw new ArgumentNullException(nameof(innerDc)); } if (options != InteruptAction.Cancel) { throw new ArgumentException($"Invalid interupt option {options} for Cancel Action"); } var sectionName = Environment.GetEnvironmentVariable("DIALOG_BOT_MESSAGES"); var msg = _messageService.Get(sectionName, options.ToString().ToLower()); this.CancelMsgText = msg != null ? msg.Text : this.CancelMsgText; var cancelMessage = MessageFactory.Text(CancelMsgText, CancelMsgText, InputHints.IgnoringInput); await _turnContextWrapper.SendActivityAsync(innerDc.Context, cancelMessage, cancellationToken); return(await _dialogContextWrapper.CancelAllDialogsAsync(innerDc, cancellationToken)); }
public async Task <DialogTurnResult> Handle(DialogContext innerDc, InteruptAction options, CancellationToken cancellationToken) { if (innerDc == null) { throw new ArgumentNullException(nameof(innerDc)); } if (options != InteruptAction.Help) { throw new ArgumentException($"Invalid interupt option {options} for Help Action"); } var sectionName = Environment.GetEnvironmentVariable("DIALOG_BOT_MESSAGES"); var msg = _messageService.Get(sectionName, options.ToString().ToLower()); this.HelpMsgText = msg != null ? msg.Text : this.HelpMsgText; var helpMessage = MessageFactory.Text(HelpMsgText, HelpMsgText, InputHints.ExpectingInput); var response = await _turnContextWrapper.SendActivityAsync(innerDc.Context, helpMessage, cancellationToken); return(new DialogTurnResult(DialogTurnStatus.Waiting)); }