Beispiel #1
0
        public override async Task <IEnumerable <string> > EnumerateValuesAsync(ValueEnumerationContext context)
        {
            var credentials = ResourceCredentials.Create <TfsCredentials>(this.CredentialName);

            var api      = new TfsRestApi(credentials, null);
            var projects = await api.GetProjectsAsync().ConfigureAwait(false);

            return(projects.Select(p => p.name));
        }
        public async Task <IEnumerable <string> > GetSuggestionsAsync(IComponentConfiguration config)
        {
            var credentialName = config["CredentialName"];

            if (string.IsNullOrEmpty(credentialName))
            {
                return(Enumerable.Empty <string>());
            }

            var credentials = ResourceCredentials.Create <TfsCredentials>(credentialName);

            var api      = new TfsRestApi(credentials, null);
            var projects = await api.GetProjectsAsync().ConfigureAwait(false);

            return(projects.Select(p => p.name));
        }