Beispiel #1
0
        private async Task <DialogTurnResult> InitializeStateAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            var context = await this.accessors.StorySelectionState.GetAsync(stepContext.Context, () => null);

            if (context == null || StringSimilarity.IsSimilar(stepContext.Context.Activity.Text, this.DefaultOptions[1])) // new story
            {
                await this.accessors.StorySelectionState.SetAsync(stepContext.Context, new StorySelectionState(api.GetStartingSection(StoryId), api.GetStartingStats(StoryId)));
            }

            return(await stepContext.NextAsync());
        }