예제 #1
0
        public virtual async Task SelectTeamAsync(IDialogContext context, IMessageActivity result)
        {
            context.ThrowIfNull(nameof(context));
            result.ThrowIfNull(nameof(result));

            var reply = context.MakeMessage();

            if (!teams.Any())
            {
                reply.Text = Labels.NoTeams;
                await context.PostAsync(reply);

                context.Done(reply);
                return;
            }

            var accountsCard = new TeamsCard(teams);

            reply.Text = Labels.Teams;
            reply.Attachments.Add(accountsCard.ToAttachment());

            await context.PostAsync(reply);

            context.Wait(this.TeamReceivedAsync);
        }
예제 #2
0
        public async Task TeamAsync(IDialogContext context, IAwaitable <IMessageActivity> result)
        {
            context.ThrowIfNull(nameof(context));
            result.ThrowIfNull(nameof(result));

            var data = context.UserData.GetValue <UserData>("userData");

            var resultService = await this.teamService.GetTeams(data.Account.Value, data.Project.Key, data.User.Token);

            var teams = resultService.ToDictionary(a => a.Id.ToString(), a => a.Name);

            var reply = context.MakeMessage();

            var accountsCard = new TeamsCard(teams);

            reply.Text = Labels.Teams;
            reply.Attachments.Add(accountsCard.ToAttachment());

            await context.PostAsync(reply);

            context.Done(reply);
        }