コード例 #1
0
        private async Task <DialogTurnResult> StartChainingStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            //_logger.LogInformation("ChainsDialog.StartChainingStepAsync");

            stepContext.Values["preferred_distance"] = stepContext.Result;

            //await stepContext.Context.SendActivityAsync(MessageFactory.Text(
            //    $"type: {stepContext.Values["point_type"]}\n\n" +
            //    $"center generation: {stepContext.Values["center_location"]}\n\n" +
            //    $"preferred distance: {stepContext.Values["preferred_distance"]}\n\n"
            //    ), cancellationToken);


            var userProfileTemporary = await _userProfileTemporaryAccessor.GetAsync(stepContext.Context, () => new UserProfileTemporary());

            var actionHandler = new ActionHandler();

            switch (stepContext.Values["point_type"].ToString())
            {
            case "Attractors":
                await actionHandler.ChainActionAsync(stepContext.Context, userProfileTemporary, cancellationToken, _mainDialog,
                                                     Enums.PointTypes.Attractor, (int)stepContext.Values["preferred_distance"], stepContext.Values["center_location"].ToString().ToLower().Equals("current"));

                break;

            case "Voids":
                await actionHandler.ChainActionAsync(stepContext.Context, userProfileTemporary, cancellationToken, _mainDialog,
                                                     Enums.PointTypes.Void, (int)stepContext.Values["preferred_distance"], stepContext.Values["center_location"].ToString().ToLower().Equals("current"));

                break;

            case "Anomalies":
                await actionHandler.ChainActionAsync(stepContext.Context, userProfileTemporary, cancellationToken, _mainDialog,
                                                     Enums.PointTypes.Anomaly, (int)stepContext.Values["preferred_distance"], stepContext.Values["center_location"].ToString().ToLower().Equals("current"));

                break;

            case "Quantums":
                await actionHandler.ChainActionAsync(stepContext.Context, userProfileTemporary, cancellationToken, _mainDialog,
                                                     Enums.PointTypes.Quantum, (int)stepContext.Values["preferred_distance"], stepContext.Values["center_location"].ToString().ToLower().Equals("current"));

                break;

            case "Pseudos":
                await actionHandler.ChainActionAsync(stepContext.Context, userProfileTemporary, cancellationToken, _mainDialog,
                                                     Enums.PointTypes.Pseudo, (int)stepContext.Values["preferred_distance"], stepContext.Values["center_location"].ToString().ToLower().Equals("current"));

                break;
            }

            return(await stepContext.EndDialogAsync(cancellationToken : cancellationToken));
        }