/// <summary> /// Initialize authentication scorable. /// </summary> /// <param name="botdata">Bot data</param> /// <param name="dialogTask">Dialog task</param> /// <param name="botToUser">Bot to user</param> /// <param name="resourceId">Azure active directory resource identifier.</param> public AuthenticationScorable(IBotData botdata, IDialogTask dialogTask, IBotToUser botToUser, AuthenticationOptions authOptions, IAuthProvider authProvider) { _botData = botdata; _dialogTask = dialogTask; this.authOptions = authOptions; this.authProvider = authProvider; }
public NavigationScorable(IDialogStack stack, IDialogTask task) { SetField.NotNull(out this.stack, nameof(stack), stack); SetField.NotNull(out this.task, nameof(task), task); this.navigationCommands = new List <string>(); this.navigationCommands.Add(Resources.Main_Nav_Cmd); // Topic 1 this.navigationCommands.Add(Resources.Topic1_Nav_Cmd); this.navigationCommands.Add(Resources.Topic1_1_Nav_Cmd); this.navigationCommands.Add(Resources.Topic1_2_Nav_Cmd); this.navigationCommands.Add(Resources.Topic1_3_Nav_Cmd); // Topic 2 this.navigationCommands.Add(Resources.Topic2_Nav_Cmd); this.navigationCommands.Add(Resources.Topic2_1_Nav_Cmd); this.navigationCommands.Add(Resources.Topic2_2_Nav_Cmd); this.navigationCommands.Add(Resources.Topic2_3_Nav_Cmd); // Topic 3 this.navigationCommands.Add(Resources.Topic3_Nav_Cmd); this.navigationCommands.Add(Resources.Topic3_1_Nav_Cmd); this.navigationCommands.Add(Resources.Topic3_2_Nav_Cmd); this.navigationCommands.Add(Resources.Topic3_3_Nav_Cmd); }
public ScoringDialogTask(IDialogTask inner, IComparer <Score> comparer, ITraits <Score> traits, params IScorable <Score>[] scorables) : base(inner) { SetField.NotNull(out this.comparer, nameof(comparer), comparer); SetField.NotNull(out this.traits, nameof(traits), traits); SetField.NotNull(out this.scorables, nameof(scorables), scorables); }
public NavigationScorable2(IDialogTask task) { SetField.NotNull(out this.task, nameof(task), task); this.navigationCommands = new List <string>(); this.navigationCommands.Add(Consts.MainBotKey); }
public BotDialogContextArgs(IActivity activity, IDialogTask task, IBotData data, IBotToUser botToUser, ILifetimeScope scope) { Activity = activity; Task = task; BotData = data; DialogScope = scope; BotToUser = botToUser; }
public LuisScorable(ILuisService luisService, IDialogTask task, ILogger logger, LuisIntentHandlerDialogFactory luisIntentHandlerFactory) { this.luisService = luisService; this.luisResults = new Dictionary <string, LuisResult>(); this.task = task; this.logger = logger; this.luisIntentFactory = luisIntentHandlerFactory; }
public static async Task StartSurvey(ResumptionCookie cookie, CancellationToken token) { var container = WebApiApplication.FindContainer(); // the ResumptionCookie has the "key" necessary to resume the conversation var message = cookie.GetMessage(); ConnectorClient client = new ConnectorClient(new Uri(message.ServiceUrl)); try { var conversation = await client.Conversations.CreateDirectConversationAsync(message.Recipient, message.From); message.Conversation.Id = conversation.Id; } catch (HttpOperationException ex) { var reply = message.CreateReply(); reply.Text = ex.Message; await client.Conversations.SendToConversationAsync(reply); return; } // we instantiate our dependencies based on an IMessageActivity implementation using (var scope = DialogModule.BeginLifetimeScope(container, message)) { // find the bot data interface and load up the conversation dialog state var botData = scope.Resolve <IBotData>(); await botData.LoadAsync(token); // resolve the dialog task IDialogTask task = scope.Resolve <IDialogTask>(); // make a dialog to push on the top of the stack var child = scope.Resolve <SurveyDialog>(); // wrap it with an additional dialog that will restart the wait for // messages from the user once the child dialog has finished var interruption = child.Void <object, IMessageActivity>(); try { // put the interrupting dialog on the stack task.Call(interruption, null); // start running the interrupting dialog await task.PollAsync(token); } finally { // save out the conversation dialog state await botData.FlushAsync(token); } } }
public NavigationScorable(IDialogStack stack, IDialogTask task) { SetField.NotNull(out this.stack, nameof(stack), stack); SetField.NotNull(out this.task, nameof(task), task); this.navigationCommands = new List <string>(); this.navigationCommands.Add(Resources.MainBot_Menu); }
/// <summary> /// Load or create the dialog task from the store. /// </summary> /// <typeparam name="R">The type of the root dialog.</typeparam> /// <param name="task">The dialog task.</param> /// <param name="MakeRoot">The factory method for the root dialog.</param> /// <param name="token">An optional cancellation token.</param> /// <returns>A task representing the dialog task load operation.</returns> public static async Task LoadAsync <R>(this IDialogTask task, Func <IDialog <R> > MakeRoot, CancellationToken token = default(CancellationToken)) { if (task.Frames.Count == 0) { var root = MakeRoot(); var loop = root.Loop(); task.Call(loop, null); await task.PollAsync(); } }
/// <summary> /// Helper to quickly go to root dialog and optionally reset the dialog stack. /// </summary> /// <param name="dialogTask">context/stack</param> /// <param name="clearStack">TRUE to clear stack, FALSE to leave it unchanged</param> internal async static Task ForwardToRootDialogAsync(IDialogTask dialogTask, bool clearStack) { if (clearStack) { dialogTask.Reset(); } var newActivity = Activity.CreateEventActivity(); newActivity.Value = "INIT_DIALOG"; await dialogTask.Forward(new RootDialog(), null, newActivity, CancellationToken.None); }
/// <summary> /// Post an item to the dialog task and poll the dialog task for any work to be done. /// </summary> /// <typeparam name="R">The type of the root dialog.</typeparam> /// <typeparam name="T">The type of the item.</typeparam> /// <param name="task">The dialog task.</param> /// <param name="toBot">The item to be sent to the bot.</param> /// <param name="MakeRoot">The factory method for the root dialog.</param> /// <param name="token">An optional cancellation token.</param> /// <returns>A task representing the post operation.</returns> public static async Task PostAsync <T, R>(this IDialogTask task, T toBot, Func <IDialog <R> > MakeRoot, CancellationToken token = default(CancellationToken)) { await LoadAsync(task, MakeRoot, token); IPostToBot postToBot = task; try { await postToBot.PostAsync(toBot, token); } catch { task.Reset(); throw; } task.Save(); }
public MessageRouterScorable(IDialogTask dialogTask) { SetField.NotNull(out _dialogTask, nameof(dialogTask), dialogTask); }
public SettingsScorable(IDialogTask task) {
public CommonResponseScorable(IDialogTask task) { SetField.NotNull(out this.task, nameof(task), task); }
// Apparently when this gets constructed, an IDialogTask instance is given to us. // I do not understand yet, where this is coming from and what exactly it is... public GlobalHandlerDialog(IDialogTask task) { _task = task; }
public HelpScorable(IDialogTask task) { SetField.NotNull(out this.task, nameof(task), task); }
public ServerPasswordReset(IDialogTask task) { SetField.NotNull(out this.task, nameof(task), task); }
public LocalizedDialogTask(IDialogTask inner) : base(inner) { }
public RestoredFileScorable(IDialogTask task) { SetField.NotNull(out this.task, nameof(task), task); }
public NotificationsScorable(IDialogTask dialogTask) { SetField.NotNull(out _dialogTask, nameof(dialogTask), dialogTask); }
public ReactiveDialogTask(IDialogTask dialogTask, Func <IDialog <object> > makeRoot) { SetField.NotNull(out this.dialogTask, nameof(dialogTask), dialogTask); SetField.NotNull(out this.makeRoot, nameof(makeRoot), makeRoot); }
public StatusScorableDialog(IDialogTask task) { SetField.NotNull(out this.task, nameof(task), task); }
/// <summary> /// Interrupt the waiting dialog with a new dialog /// </summary> /// <typeparam name="T">The type of result expected from the dialog.</typeparam> /// <typeparam name="R">The type of the item posted to dialog.</typeparam> /// <param name="task">The dialog task.</param> /// <param name="dialog">The new interrupting dialog.</param> /// <param name="item">The item to forward to the new interrupting dialog.</param> /// <param name="token">The cancellation token.</param> /// <returns>A task that represents the interruption operation.</returns> public static async Task InterruptAsync <T, R>(this IDialogTask task, IDialog <T> dialog, R item, CancellationToken token) { await task.Forward(dialog.Void <T, R>(), null, item, token); await task.PollAsync(token); }
public HelpScorable(IDialogTask task, IDialogFactory dialogFactory) { SetField.NotNull(out this.task, nameof(task), task); SetField.NotNull(out this.dialogFactory, nameof(dialogFactory), dialogFactory); }
public VirtualMachineScroable(IDialogTask task) { SetField.NotNull(out this.task, nameof(task), task); }
public CreateLMSTicketScorable(IDialogTask task) { SetField.NotNull(out this.task, nameof(task), task); }
async Task IScorable <Score> .PostAsync <Item>(IDialogTask task, Item item, object state) { await this.Scorable.PostAsync(task, item, state); }
/// <summary> /// Initializes a new instance of the <see cref="ResetScorable"/> class. /// </summary> public ResetScorable(IDialogFactory dialogFactory, IDialogStack stack, IBotToUser botToUser, IBotData botData, IDialogTask task) : base(Resources.ResetScorable_Match) { SetField.NotNull(out _task, nameof(task), task); SetField.NotNull(out _botData, nameof(botData), botData); SetField.NotNull(out _stack, nameof(stack), stack); SetField.NotNull(out _dialogFactory, nameof(dialogFactory), dialogFactory); SetField.NotNull(out _botToUser, nameof(botToUser), botToUser); }
public DebugScorable(IDialogTask task, IMluviiBotDialogFactory dialogFactory) { SetField.NotNull(out this.task, nameof(task), task); SetField.NotNull(out this.dialogFactory, nameof(dialogFactory), dialogFactory); }
public CommandScorable(IBotToUser botToUser, IDialogTask task) { SetField.NotNull(out this.BotToUser, nameof(botToUser), botToUser); SetField.NotNull(out this.task, nameof(task), task); }