public async Task <bool> StartSubject(V4ReferenceContext context)
        {
            switch (context.Activity.Type)
            {
            case ActivityTypes.Message:

                await GuessingGamesSubjectResponses.ReplyWithGreeting(context);

                break;

            default:
                break;
            }
            return(true);
        }
        public async Task <bool> ContinueSubject(V4ReferenceContext context)
        {
            var conversation = ConversationState <ConversationData> .Get(context);

            if (conversation.SecretNumber == 0)
            {
                conversation.SecretNumber = new Random().Next(1, 10);
            }

            if (context.Activity.Type is ActivityTypes.Message)
            {
                if (int.TryParse(context.Activity.Text, out var guess))
                {
                    if (guess > conversation.SecretNumber)
                    {
                        await context.SendActivity($"Guess Lower");
                    }

                    if (guess < conversation.SecretNumber)
                    {
                        await context.SendActivity($"Guess Higher");
                    }

                    if (int.Parse(context.Activity.Text) == conversation.SecretNumber)
                    {
                        await context.SendActivity($"You Guessed it");
                    }

                    await context.SendActivity($"The number is {conversation.SecretNumber}");
                }
                else
                {
                    var luisResult = context.Services.Get <RecognizerResult>(LuisRecognizerMiddleware.LuisRecognizerResultKey);

                    (string key, double score)topItem = luisResult.GetTopScoringIntent();

                    switch (context.Activity.Type)
                    {
                    case ActivityTypes.Message:
                        switch (topItem.key)
                        {
                        case "Help":
                            // show help
                            await GuessingGamesSubjectResponses.ReplyWithHelp(context);

                            break;

                        case "MainMenu":
                            // show Main Menu
                            conversation.CurrentSubject = conversation.MainMenuSubject;
                            await conversation.MainMenuSubject.ContinueSubject(context);

                            break;

                        case "Quit":
                            // show Main Menu
                            conversation.CurrentSubject = ParentSubject;
                            await ParentSubject.StartSubject(context);

                            break;

                        default:
                            // show our confusion
                            await GuessingGamesSubjectResponses.ReplyWithConfused(context);

                            break;
                        }
                        break;

                    default:
                        break;
                    }
                }
            }

            return(true);
        }
        public async Task <bool> ContinueSubject(V4ReferenceContext context)
        {
            var conversation = ConversationState <ConversationData> .Get(context);

            if (context.Activity.Type == ActivityTypes.Message)
            {
                var luisResult =
                    context.Services.Get <RecognizerResult>(LuisRecognizerMiddleware.LuisRecognizerResultKey);

                if (luisResult != null)
                {
                    (string key, double score)topItem = luisResult.GetTopScoringIntent();

                    switch (topItem.key)
                    {
                    case "GetActivities":
                        // var activityId = luisResult.Entities.GetValue("ActivityID")[0].Value<string>();
                        // await context.SendActivity($" Found Entity Name: ActivityID : 04030201");
                        await context.SendActivities(BotResponses.GetSingle("04030201"));

                        break;

                    case "ListActivities":
                        await context.SendActivities(BotResponses.GetMultiple());

                        break;

                    case "SendAlert":
                        var xactivityId = luisResult.Entities.GetValue("ActivityID")[0].Value <string>();
                        await context.SendActivity($" Alert for Activity: {xactivityId} has been sent");

                        break;

                    case "CancelAlert":
                        var yactivityId = luisResult.Entities.GetValue("ActivityID")[0].Value <string>();
                        await context.SendActivity($"Activity : {yactivityId} has been cancelled");

                        break;

                    case "Help":
                        // show help
                        await context.SendActivity(MessageFactory.Text("Try commands like: latest, get latest alert, get last activity"));

                        break;

                    case "MainMenu":
                        // show Main Menu
                        conversation.CurrentSubject = conversation.MainMenuSubject;
                        await conversation.MainMenuSubject.ContinueSubject(context);

                        break;

                    case "Quit":
                        // show Main Menu
                        conversation.CurrentSubject = ParentSubject;
                        await ParentSubject.StartSubject(context);

                        break;

                    default:
                        // show our confusion
                        await GuessingGamesSubjectResponses.ReplyWithConfused(context);

                        break;
                    }
                }
            }

            return(true);
        }