Exemplo n.º 1
0
        private async Task <DialogTurnResult> GenerateIDAsStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            //_logger.LogInformation($"MainDialog.SelectQRNGSourceStepAsync[{((FoundChoice)stepContext.Result)?.Value}]");
            var userProfileTemporary = await _userProfileTemporaryAccessor.GetAsync(stepContext.Context, () => new UserProfileTemporary());

            var actionHandler = new ActionHandler();

            var    idacou             = int.Parse(stepContext.Values["idacou"].ToString());
            string entropyQueryString = stepContext.Context.Activity.Text;

            if (entropyQueryString.Length == 64)
            {
                // Assume 64 chars exactly is entropy GID direct from camera or copy/pasted shared
                entropyQueryString = $"gid={entropyQueryString}&raw=true";
            }
            else if (stepContext.Values != null && stepContext.Values.ContainsKey("qrng_source_query_str"))
            {
                // GCP Retro / ANU Leftovers (pool)
                entropyQueryString = stepContext.Values["qrng_source_query_str"].ToString();
            }
            else
            {
                entropyQueryString = null;
            }

            switch (stepContext.Values["PointType"].ToString())
            {
            case "Attractor":
                await actionHandler.AttractorActionAsync(stepContext.Context, userProfileTemporary, cancellationToken, this, idacou : idacou, entropyQueryString : entropyQueryString);

                break;

            case "Void":
                await actionHandler.VoidActionAsync(stepContext.Context, userProfileTemporary, cancellationToken, this, idacou : idacou, entropyQueryString : entropyQueryString);

                break;

            case "Anomaly":
                await actionHandler.AnomalyActionAsync(stepContext.Context, userProfileTemporary, cancellationToken, this, idacou : idacou, entropyQueryString : entropyQueryString);

                break;

            case "Pair":
                await actionHandler.PairActionAsync(stepContext.Context, userProfileTemporary, cancellationToken, this, idacou : idacou, entropyQueryString : entropyQueryString);

                break;
            }

            // Long-running tasks like /getattractors etc will make use of ContinueDialog to re-prompt users
            return(await stepContext.EndDialogAsync(cancellationToken : cancellationToken));
        }
Exemplo n.º 2
0
        private async Task <DialogTurnResult> GetHowManyScanIDAsStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            //_logger.LogInformation($"ScanDialog.GetHowManyScanIDAsStepAsync[{((FoundChoice)stepContext.Result)?.Value}]");

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

            var actionHandler = new ActionHandler();

            int idacou;

            if (stepContext.Result == null)
            {
                idacou = int.Parse(stepContext.Context.Activity.Text); // manually inputted a number
            }
            else
            {
                idacou = int.Parse(((FoundChoice)stepContext.Result)?.Value);
            }

            switch (stepContext.Values["PointType"].ToString())
            {
            case "Attractor":
                await actionHandler.AttractorActionAsync(stepContext.Context, userProfileTemporary, cancellationToken, _mainDialog, true, idacou : idacou);

                break;

            case "Void":
                await actionHandler.VoidActionAsync(stepContext.Context, userProfileTemporary, cancellationToken, _mainDialog, true, idacou : idacou);

                break;

            case "Anomaly":
                await actionHandler.AnomalyActionAsync(stepContext.Context, userProfileTemporary, cancellationToken, _mainDialog, true, idacou : idacou);

                break;

            case "Pair":
                await actionHandler.PairActionAsync(stepContext.Context, userProfileTemporary, cancellationToken, _mainDialog, true, idacou : idacou);

                break;
            }

            // Long-running tasks like /getattractors etc will make use of ContinueDialog to re-prompt users
            return(await stepContext.EndDialogAsync(cancellationToken : cancellationToken));
        }