public UserProfileDialog(ADSBotServices services) : base(nameof(UserProfileDialog)) { // This array defines how the Waterfall will execute. var waterfallSteps = new WaterfallStep[] { InitStep, NameStepAsync, NameConfirmStepAsync, ContactStepAsync, ContactConfirmStepAsync, TimeframeStepAsync, TimeframeConfirmStepAsync, FinalizeStepAsync }; // Add named dialogs to the DialogSet. These names are saved in the dialog state. AddDialog(new WaterfallDialog(nameof(WaterfallDialog), waterfallSteps)); AddDialog(new TextPrompt(PROMPT_Name, ValidateNameAsync)); AddDialog(new TextPrompt(PROMPT_Contact, ValidateContactAsync)); AddDialog(new ChoicePrompt(nameof(ChoicePrompt))); AddDialog(new ConfirmPrompt(nameof(ConfirmPrompt))); // The initial child Dialog to run. InitialDialogId = nameof(WaterfallDialog); Services = services; }
public FinanceDialog(ADSBotServices services) : base(nameof(FinanceDialog)) { // This array defines how the Waterfall will execute. var waterfallSteps = new WaterfallStep[] { PreInitializeStep, InitializeStep, CreditScoreStep, ValidateCreditScoreStep, IncomeStep, ValidateIncomeStep, HomeOwnershipStep, ValidateHomeOwnershipStep, EmploymentStep, ValidateEmploymentStep, ConfirmAppointmentStep, FinalizeStep }; // Add named dialogs to the DialogSet. These names are saved in the dialog state. AddDialog(new WaterfallDialog(nameof(WaterfallDialog), waterfallSteps)); AddDialog(new TextPrompt(nameof(TextPrompt))); AddDialog(new ChoicePrompt(nameof(ChoicePrompt))); AddDialog(new ConfirmPrompt(nameof(ConfirmPrompt))); // The initial child Dialog to run. InitialDialogId = nameof(WaterfallDialog); Services = services; }
// Initializes a new instance of the "WelcomeUserBot" class. public BenBot(ADSBotServices services, ActiveLeadDialog dialog, UserState user) { Services = services; User = user; DialogManager = new DialogManager(dialog) { UserState = user }; }
public VehicleInventoryDialog(ADSBotServices services, DataService storageDB) : base(nameof(VehicleInventoryDialog)) { // This array defines how the Waterfall will execute. var waterfallSteps = new WaterfallStep[] { PreInitializeStep, InitializeStep, NewUsedStepAsync, NewUsedConfirmStepAsync, PrimaryConcernStep, ValidatePrimaryConcernStep, RemainingGoalsStep, //Repeatable... ValidateRemainingGoalsStep, //Continue on or repeat AdditionalOptions, //If repeating, show options ValidateAdditonalOptions, //Tell how many results and go back to remaining goals to cycle ShowInventoryStep, //When user requests listing, show them cars. This needs to cycle too...(pages/reset filters/etc.) ConfirmAppointmentStep, FinalizeStep }; //Examples... //New -> Price -> 10k -> Inventory //New -> Price -> 10k -> Make -> Honda //New -> Make -> Honda -> Model -> Civic -> Inventory // Add named dialogs to the DialogSet. These names are saved in the dialog state. AddDialog(new WaterfallDialog(nameof(WaterfallDialog), waterfallSteps)); AddDialog(new TextPrompt(nameof(TextPrompt))); AddDialog(new ChoicePrompt(nameof(ChoicePrompt))); AddDialog(new ChoicePrompt(InventoryChoice) { Style = ListStyle.None }); AddDialog(new ConfirmPrompt(nameof(ConfirmPrompt))); // The initial child Dialog to run. InitialDialogId = nameof(WaterfallDialog); Services = services; Data_Service = storageDB; }
public VehicleProfileDialog(UserState userState, ADSBotServices services) : base(nameof(VehicleProfileDialog)) { _userProfileAccessor = userState.CreateProperty <UserProfile>(nameof(UserProfile)); // This array defines how the Waterfall will execute. var waterfallSteps = new WaterfallStep[] { InitializeStep, GoalsStep, ValidateGoalsStep, InterestStep, ValidateInterestStep, VehicleTypeStep, ValidateTypeStep, VehicleBrandStep, ValidateVehicleBrancStep, NewUsedStep, ValidateNewUsedStep, BudgetStep, ValidateBudgetStep, NeedFinancingStep, ExecuteFinancingStep, TradingInStep, ExecuteTradingInStep, FinalizeStep }; // Add named dialogs to the DialogSet. These names are saved in the dialog state. AddDialog(new WaterfallDialog(nameof(WaterfallDialog), waterfallSteps)); AddDialog(new TextPrompt(nameof(TextPrompt))); AddDialog(new ChoicePrompt(nameof(ChoicePrompt))); AddDialog(new ConfirmPrompt(nameof(ConfirmPrompt))); // The initial child Dialog to run. InitialDialogId = nameof(WaterfallDialog); Services = services; }
public SendAdaptiveDialog(TFactory modelFactory, ADSBotServices services) : base(nameof(TFactory)) { // This array defines how the Waterfall will execute. var waterfallSteps = new WaterfallStep[] { InitStep }; // Add named dialogs to the DialogSet. These names are saved in the dialog state. AddDialog(new WaterfallDialog(nameof(WaterfallDialog), waterfallSteps)); // The initial child Dialog to run. InitialDialogId = nameof(WaterfallDialog); Services = services; CardFactory = modelFactory; }
public SimpleInventoryDialog(ADSBotServices services, DataService dataService) : base(nameof(VehicleInventoryDialog)) { // This array defines how the Waterfall will execute. var waterfallSteps = new WaterfallStep[] { PreInitializeStep, InitializeStep, PrimaryConcernStep, ValidatePrimaryConcernStep, ConcernGoalStep, ValidateConcernStep, MakeStep, ValidateMakeStep, ModelStep, ValidateModelStep, ShowInventoryStep, ConfirmAppointmentStep, FinalizeStep }; // Add named dialogs to the DialogSet. These names are saved in the dialog state. AddDialog(new WaterfallDialog(nameof(WaterfallDialog), waterfallSteps)); AddDialog(new TextPrompt(nameof(TextPrompt))); AddDialog(new ChoicePrompt(nameof(ChoicePrompt))); AddDialog(new ChoicePrompt(InventoryChoice) { Style = ListStyle.None }); AddDialog(new ConfirmPrompt(nameof(ConfirmPrompt))); // The initial child Dialog to run. InitialDialogId = nameof(WaterfallDialog); Services = services; DataService = dataService; }
public ValueTradeInDialog(ADSBotServices services) : base(nameof(ValueTradeInDialog)) { // This array defines how the Waterfall will execute. var waterfallSteps = new WaterfallStep[] { PreInitializeStep, InitializeStep, MakeStep, ValidateMakeStep, ModelStep, ValidateModelStep, YearStep, ValidateYearStep, ConditionStep, ValidateConditionStep, AmountOwedStep, ValidateAmountOwedStep, ConfirmAppointmentStep, FinalizeStep }; // Add named dialogs to the DialogSet. These names are saved in the dialog state. AddDialog(new WaterfallDialog(nameof(WaterfallDialog), waterfallSteps)); AddDialog(new TextPrompt(nameof(TextPrompt))); AddDialog(new ChoicePrompt(nameof(ChoicePrompt))); AddDialog(new ConfirmPrompt(nameof(ConfirmPrompt))); // The initial child Dialog to run. InitialDialogId = nameof(WaterfallDialog); Services = services; }
public JSONVehicleInventoryCardFactory(ADSBotServices services) : base(nameof(JSONVehicleInventoryCardFactory), Path.Combine(".", "Cards", "json", "inventory-card.json")) { Services = services; }
public RootDialog(ActiveLeadDialog activeLeadDialog, ADSBotServices services) { Services = services; var rootDialog = new AdaptiveDialog(nameof(RootDialog)) { Generator = new TemplateEngineLanguageGenerator(), Triggers = new List <OnCondition>() { new OnBeginDialog() { Actions = new List <Dialog>() { new IfCondition() { Condition = "conversation.seen_help == false || conversation.seen_help == null", Actions = new List <Dialog>() { new EmitEvent(Constants.Event_Help) } }, new BeginDialog(nameof(ActiveLeadDialog)) } }, new OnCustomEvent(Constants.Event_Help) { Actions = new List <Dialog>() { new SetProperty() { Property = "conversation.seen_help", Value = "true" }, new ChoiceInput() { Prompt = new ActivityTemplate("I want to provide you with the best service possible! " + "Just select one of the easy-click options below, or " + "type a request directly into the text box."), AlwaysPrompt = true, AllowInterruptions = "true", Validations = new List <string>(new string[] { "true" }), Property = "conversation.interest", Choices = new ChoiceSet(new List <Choice>() { new Choice() { Value = "Explore Financing" }, new Choice() { Value = "Identify a Vehicle" }, new Choice() { Value = "Value a Trade-In" }, new Choice() { Value = "Search Inventory" } }) }, } } } }; AddDialog(rootDialog); AddDialog(activeLeadDialog); this.InitialDialogId = rootDialog.Id; }
public JSONFinanceCardFactory(ADSBotServices services) : base(nameof(JSONFinanceCardFactory), Path.Combine(".", "Cards", "json", "finance-card.json")) { Services = services; }
// Initializes a new instance of the "WelcomeUserBot" class. public WelcomeUserBot(ADSBotServices services) { dialogs = new DialogSet(services.DialogStateAccessor); //dialogs.Add(FinanceDialog.Instance); }
public JSONTradeInCardFactory(ADSBotServices services) : base(nameof(JSONTradeInCardFactory), Path.Combine(".", "Cards", "json", "trade-card.json")) { Services = services; }
public ActiveLeadDialog( UserProfileDialog userProfileDialog, FinanceDialog financeDialog, VehicleProfileDialog vehicleProfileDialog, ValueTradeInDialog valueTradeInDialog, SimpleInventoryDialog inventoryDialog, ICardFactory <BasicDetails> profileFactory, ICardFactory <FinancingDetails> financeFactory, ICardFactory <TradeInDetails> tradeinFactory, ICardFactory <VehicleProfileDetails> vehicleFactory, ADSBotServices botServices) : base(nameof(ActiveLeadDialog)) { Services = botServices; var rootDialog = new AdaptiveDialog(nameof(AdaptiveDialog)) { Generator = new TemplateEngineLanguageGenerator(), Triggers = new List <OnCondition>() { new OnCustomEvent(Constants.Event_Help) { Actions = new List <Dialog>() { new SetProperty() { Property = "conversation.seen_help", Value = "true" }, new ChoiceInput() { Prompt = new ActivityTemplate("I want to provide you with the best service possible! " + "Just select one of the easy-click options below, or " + "type a request directly into the text box."), AlwaysPrompt = true, Property = "conversation.interest", Choices = new ChoiceSet(Constants.HelpOptions.Select(o => new Choice(o)).ToList()) }, new IfCondition() { Condition = "conversation.interest != null", Actions = new List <Dialog>() { new EmitEvent(Constants.Event_Interest) } }, } }, new OnCustomEvent(Constants.Event_Interest) { Condition = "conversation.interest != null", Actions = new List <Dialog>() { new IfCondition() { Condition = "user.UserProfile.IsRegistered", Actions = new List <Dialog>() { new SwitchCondition() { Condition = "conversation.interest", Cases = new List <Case>() { new Case() { Value = Constants.INTEREST_Financing, Actions = new List <Dialog>() { new EmitEvent(Constants.Event_Card, "'financing'") } }, new Case() { Value = Constants.INTEREST_Identify, Actions = new List <Dialog>() { new EmitEvent(Constants.Event_Card, "'vehicle'") } }, new Case() { Value = Constants.INTEREST_TradeIn, Actions = new List <Dialog>() { new EmitEvent(Constants.Event_Card, "'tradein'") } }, new Case() { Value = Constants.INTEREST_Inventory, Actions = new List <Dialog>() { new EmitEvent(Constants.Event_Card, "'inventory'") } } } } }, ElseActions = new List <Dialog>() { new SetProperty() { Property = "conversation.residual_interest", Value = "conversation.interest" }, new DeleteProperty() { Property = "conversation.interest" }, new EmitEvent(Constants.Event_Card, "'profile'") } }, //Delete the property so we don't loop forever new DeleteProperty() { Property = "conversation.interest" } } }, new OnCustomEvent(Constants.Event_Cancel) { Actions = new List <Dialog>() { // when the user cancels we need to check where they were so that we can transition smoothly. // what if they weren't in a dialog? What if they've typed 'cancel' twice in a row? new EmitEvent(Constants.Event_Help, bubble: true), new CancelAllDialogs(), } }, new OnCustomEvent(Constants.Event_Card) { Actions = new List <Dialog>() { new SetProperty() { Property = "conversation.busy", Value = "true" }, new SwitchCondition() { Condition = "toLower(turn.dialogEvent.value)", Cases = new List <Case>() { //Just copied from below as a quick fix, ideally this would all be in the financing dialog itself. new Case("profile") { Actions = new List <Dialog>() { new BeginDialog(userProfileDialog.Id) } }, new Case("financing") { Actions = new List <Dialog>() { new BeginDialog(financeDialog.Id) } }, new Case("vehicle") { Actions = new List <Dialog>() { new BeginDialog(vehicleProfileDialog.Id) } }, new Case("tradein") { Actions = new List <Dialog>() { new BeginDialog(valueTradeInDialog.Id) } }, new Case("inventory") { Actions = new List <Dialog>() { new BeginDialog(inventoryDialog.Id) } }, }, Default = new List <Dialog>() { new SendActivity("I'm sorry, I can't handle that request yet. :("), new EmitEvent(Constants.Event_Help, bubble: true) } }, new SetProperty() { Property = "conversation.busy", Value = "false" }, new IfCondition() { Condition = "conversation.residual_interest != null", Actions = new List <Dialog>() { new SetProperty() { Property = "conversation.interest", Value = "conversation.residual_interest" }, new DeleteProperty() { Property = "conversation.residual_interest" }, new EmitEvent(Constants.Event_Interest) }, ElseActions = new List <Dialog>() { new DeleteProperty() { Property = "conversation.interest" }, new EmitEvent(Constants.Event_Help) } }, } }, new OnBeginDialog() { Actions = new List <Dialog>() { #if DEBUG new TraceActivity() { Name = "OnBeginDialog" }, #endif new CodeAction(async(context, _) => { await Services.SetUserProfileAsync(await Services.GetUserProfileAsync(context.Context), context); return(new DialogTurnResult(DialogTurnStatus.Complete)); }), new EmitEvent(Constants.Event_Help), } }, new OnMessageActivity() { Actions = new List <Dialog>() { #if DEBUG new TraceActivity("OnMessageActivity") { Name = "OnMessageActivity" }, #endif new CodeAction(async(context, _) => { await Services.SetUserProfileAsync(await Services.GetUserProfileAsync(context.Context), context); return(new DialogTurnResult(DialogTurnStatus.Complete)); }), new CodeAction(PrimaryHandler) } } } }; CardFactories.Add(profileFactory); CardFactories.Add(financeFactory); CardFactories.Add(tradeinFactory); CardFactories.Add(vehicleFactory); AddDialog(rootDialog); AddDialog(userProfileDialog); AddDialog(financeDialog); AddDialog(vehicleProfileDialog); AddDialog(valueTradeInDialog); AddDialog(inventoryDialog); }