コード例 #1
0
        private static WorkItemStore GetWorkItemStore(ISourceControlConnectionSettingsSource settings)
        {
            TfsConnectionParameters parameters = TfsConnectionHelper.GetTfsConnectionParameters(settings);

            var teamProjectCollection = new TfsTeamProjectCollection(parameters.TfsCollectionUri, parameters.Credential);

            teamProjectCollection.EnsureAuthenticated();

            var workItemStore = teamProjectCollection.GetService <WorkItemStore>();

            return(workItemStore);
        }
コード例 #2
0
        private string OnExecute(string args)
        {
            var profile = args.DeserializeProfile();

            try
            {
                var workItemsTypes = TfsConnectionHelper.GetWorkItemTypesForProject(profile.Settings as TfsPluginProfile);
                return(workItemsTypes.Where(type => WorkItemsTypes.Instance.AllTypes.Contains(type)).Serialize());
            }
            catch
            {
                return(string.Empty);
            }
        }
コード例 #3
0
        private string OnExecute(string args)
        {
            var profile = args.DeserializeProfile();

            try
            {
                var teamProjects = TfsConnectionHelper.GetAvailableTeamProjects(profile.Settings as TfsPluginProfile);
                var array        = teamProjects.Select(x => x.Name).ToArray();
                return(array.Serialize());
            }
            catch
            {
                return(string.Empty);
            }
        }
コード例 #4
0
        private VersionControlServer GetVersionControl(ISourceControlConnectionSettingsSource settings)
        {
            VersionControlServer versionControl = null;

            TfsConnectionParameters parameters = TfsConnectionHelper.GetTfsConnectionParameters(settings);

            switch (parameters.SegmentsCount)
            {
            case UriTfsProjectCollection:
            {
                _teamProjectCollection = new TfsTeamProjectCollection(parameters.TfsCollectionUri, parameters.Credential);
                _teamProjectCollection.EnsureAuthenticated();

                versionControl = _teamProjectCollection.GetService <VersionControlServer>();
                _teamProjects  = versionControl.GetAllTeamProjects(false);

                break;
            }

            case UriTfsTeamProject:
            {
                _teamProjectCollection = new TfsTeamProjectCollection(parameters.TfsCollectionUri, parameters.Credential);
                _teamProjectCollection.EnsureAuthenticated();

                versionControl = _teamProjectCollection.GetService <VersionControlServer>();
                _teamProjects  = new TeamProject[] { versionControl.GetTeamProject(parameters.TeamProjectName) };

                break;
            }

            default:
                throw new Exception("Wrong URI format.");
            }

            return(versionControl);
        }