How to use the adaptive-expressions.ArrayExpression function in adaptive-expressions

To help you get started, we’ve selected a few adaptive-expressions examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / BotBuilder-Samples / experimental / adaptive-dialog / javascript_nodejs / declarative / 60.adaptive-bot / index.js View on Github external
const switchCases = [];
    (resourceExplorer.getResources('.dialog') || []).forEach(resource => {
        if (resource.resourceId !== undefined && resource.resourceId.endsWith('.main.dialog')) {
            let dialogName = path.basename(resource.resourceId, '.main.dialog');
            const subDialog = resourceExplorer.loadType(resource);
            choices.push({value : dialogName});
            switchCases.push(new Case(dialogName, [subDialog]));
        }
    });
    rootDialog.generator = new TemplateEngineLanguageGenerator();
    rootDialog.triggers.push(new OnBeginDialog([
        new ChoiceInput().configure({
            property: new StringExpression('turn.userChoice'),
            prompt: new ActivityTemplate(`Choose a declarative sample to run..`),
            style: new EnumExpression(ListStyle.list),
            choices: new ArrayExpression(choices),
            alwaysPrompt: new BoolExpression(true)
        }),
        new SendActivity("# Running ${turn.userChoice}.main.dialog"),
        new SwitchCondition('turn.userChoice', switchCases),
        new RepeatDialog()
    ]));
    return rootDialog;
}