private async Task <DialogTurnResult> GetRunningProcessStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            var processDetails = (ProcessDetails)stepContext.Options;
            var processes      = processDetails.Processes;
            var text           = "Here are your running processes.";

            if (processDetails.LoadMore)
            {
                text = string.Empty;
                processDetails.LoadMore = false;
            }
            if (processes.Count > 0)
            {
                var rpaService = new RPAService();
                //var _user = await _userAccessor.GetAsync(stepContext.Context, () => new User(), cancellationToken);
                var response = rpaService.GetUser(stepContext.Context.Activity.Conversation.Id);
                var user     = new List <User>();
                if (response.IsSuccess)
                {
                    user = JsonConvert.DeserializeObject <List <User> >(response.Content);
                }
                var result  = rpaService.GetListOfProcess(processes, Convert.ToInt32(user[0].u_last_index));
                var choices = result.Choices;
                //var rpaSupportChoice = rpaService.GetRPASupportOption();
                var menuValue = JsonConvert.SerializeObject(new PromptOption {
                    Id = "menu", Value = "menu"
                });
                var mainMenu = new Choice
                {
                    Value  = "menu",                   //[email protected]
                    Action = new CardAction(ActionTypes.PostBack, "**Main Menu**", null, "**Main Menu**", "**Main Menu**", value: menuValue, null)
                };
                //choices.Add(rpaSupportChoice);
                choices.Add(mainMenu);
                //save index
                user[0].u_last_index = result.LastIndex.ToString();
                rpaService.UpdateUser(user[0], stepContext.Context.Activity.Conversation.Id);
                //_user.u_last_index = result.LastIndex;
                //await this._userAccessor.SetAsync(stepContext.Context, _user, cancellationToken);

                return(await stepContext.PromptAsync(nameof(TextPrompt), new PromptOptions
                {
                    Prompt = (Activity)ChoiceFactory.HeroCard(choices, text + Environment.NewLine + "Click the process you would like to get the status for.")

                             /*Prompt = MessageFactory.Text(text + Environment.NewLine + "Click the process you would like to get the status for."),
                              * Choices = choices,
                              * Style = ListStyle.Auto*/
                }, cancellationToken));
            }
            else
            {
                processDetails.Action = "error";
                return(await stepContext.ReplaceDialogAsync(nameof(MainDialog), processDetails, cancellationToken));
            }
        }
        private async Task <DialogTurnResult> ShowProcessStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            var processDetails = (ProcessDetails)stepContext.Options;
            var processes      = processDetails.Processes;
            var text           = "Here are your processes in progress. ";

            if (processDetails.LoadMore)
            {
                text = string.Empty;
                processDetails.LoadMore = false;
            }
            if (processes.Count > 0)
            {
                var rpaService = new RPAService();
                //var _user = await _userAccessor.GetAsync(stepContext.Context, () => new User(), cancellationToken);
                //get last index
                var response = rpaService.GetUser(stepContext.Context.Activity.Conversation.Id);
                var user     = new List <User>();
                if (response.IsSuccess)
                {
                    user = JsonConvert.DeserializeObject <List <User> >(response.Content);
                }
                var result  = rpaService.GetListOfProcess(processes, Convert.ToInt32(user[0].u_last_index));
                var choices = result.Choices;
                //add one choice for rpa support
                var rpaSupportChoice = rpaService.GetRPASupportOption();
                choices.Add(rpaSupportChoice);
                //save index
                user[0].u_last_index = result.LastIndex.ToString();
                rpaService.UpdateUser(user[0], stepContext.Context.Activity.Conversation.Id);
                //_user.u_last_index = result.LastIndex;
                //await this._userAccessor.SetAsync(stepContext.Context, _user, cancellationToken);

                return(await stepContext.PromptAsync(nameof(TextPrompt), new PromptOptions
                {
                    Prompt = (Activity)ChoiceFactory.HeroCard(choices, text + "Which one would you like to stop?")

                             /*Prompt = MessageFactory.Text(text+ "Which one would you like to stop?"),
                              * Choices = choices,
                              * Style = ListStyle.Auto*/
                }, cancellationToken));
            }
            else
            {
                processDetails.Action = "error";
                return(await stepContext.ReplaceDialogAsync(nameof(MainDialog), processDetails, cancellationToken));
            }
        }