Ejemplo n.º 1
0
        private async Task StatusSelected(IDialogContext context, IAwaitable <IMessageActivity> result)
        {
            var activity = await result;
            var s        = activity.GetTrimmedText().ToLower();

            if (s.Contains("new"))
            {
                status = "New";
            }
            else if (s.Contains("in progress"))
            {
                status = "In progress";
            }
            else if (s.Contains("shareable"))
            {
                status = "Shareable";
            }
            else if (s.Contains("all"))
            {
                status = null;
            }
            else
            {
                await context.ChoiceAsync("Would you like?", ideaStatusChoices);

                context.Wait(StatusSelected);
                return;
            }

            await context.Forward(new SignInDialog(), ListIdeasAsync, context.Activity, CancellationToken.None);
        }
Ejemplo n.º 2
0
 protected override async Task StartTeamActionAsync(IDialogContext context)
 {
     if (status.IsNullOrEmpty())
     {
         await context.ChoiceAsync("Would you like?", ideaStatusChoices);
         context.Wait(StatusSelected);
     }
     else
         await context.Forward(new SignInDialog(), ListIdeasAsync, context.Activity, CancellationToken.None);
 }
Ejemplo n.º 3
0
        private async Task SetOwner(IDialogContext context, IAwaitable <TeamMember> result)
        {
            idea.Owners = new[] { await result };

            await context.ChoiceAsync(
                "Almost done. What date will you start to implement this? <br /> (Click one of the dates below, or input one with format mm/dd/yyyy)",
                new[] { "Today", "Tomorrow" });

            context.Wait(SetStartDate);
        }
Ejemplo n.º 4
0
        private async Task SelectTeamMember(IDialogContext context, IAwaitable <GraphServiceClient> result)
        {
            var graphServiceClient = await result;
            var teamService        = new TeamService(graphServiceClient);

            members = await teamService.GetTeamMembersAsync(team.Id);

            await context.ChoiceAsync(text, members.Select(i => i.DisplayName).ToArray());

            context.Wait(TeamMemberSelected);
        }
Ejemplo n.º 5
0
        private async Task TeamMemberSelected(IDialogContext context, IAwaitable <object> result)
        {
            var activity    = await result as Activity;
            var displayName = activity.Text;
            var member      = members
                              .Where(i => i.DisplayName == displayName)
                              .FirstOrDefault();

            if (member == null)
            {
                var text = $"Sorry, could not find user '{displayName}' in {team.DisplayName}. Please identify the idea owner.";
                await context.ChoiceAsync(text, members.Select(i => i.DisplayName).ToArray());

                context.Wait(TeamMemberSelected);
            }
            else
            {
                context.Done(member);
            }
        }
Ejemplo n.º 6
0
        private async Task TeamSelected(IDialogContext context, IAwaitable <IMessageActivity> result)
        {
            var activity = await result as Activity;

            var teamDisplayName = activity.Text.Trim();
            var team            = teams
                                  .Where(i => teamDisplayName.Contains(i.DisplayName))
                                  .FirstOrDefault();

            if (team == null)
            {
                await context.ChoiceAsync($"Could not find team '{teamDisplayName}'. Please select one of you teams", teams.Select(i => i.DisplayName));

                context.Wait(TeamSelected);
            }
            else
            {
                context.Done(team);
            }
        }
Ejemplo n.º 7
0
        private async Task SelectTeam(IDialogContext context, IAwaitable <GraphServiceClient> result)
        {
            var graphServiceClient = await result;

            teams = await graphServiceClient.GetJoinedTeamsAsync();

            if (teams.Length == 0)
            {
                context.Fail(new Exception("Sorry, you do not belong to any team at the moment."));
            }
            else if (teams.Length == 1)
            {
                var team = teams.First();
                await context.SayAsync($"You only have one team: {team.DisplayName}. It was selected automatically.");

                context.Done(team);
            }
            else
            {
                await context.ChoiceAsync("Please select one of you teams", teams.Select(i => i.DisplayName));

                context.Wait(TeamSelected);
            }
        }
Ejemplo n.º 8
0
        public async Task None(IDialogContext context, LuisResult result)
        {
            await context.ChoiceAsync("I'm the Ideas Bot. You can tell me:", new[] { "New Idea", "List Ideas" });

            context.Wait(MessageReceived);
        }