Exemplo n.º 1
0
        /// <summary>
        /// Gets the team settings using the default team for the project.
        /// </summary>
        /// <param name="projectName">Name of the project.</param>
        /// <returns></returns>
        public TeamSettings GetTeamSettings()
        {
            //TODO: need to see what happens when there are multiple teams on the same project
            var configSvc  = ProjectCollection.GetService <TeamSettingsConfigurationService>();
            var configs    = configSvc.GetTeamConfigurationsForUser(new[] { Project.Uri.AbsoluteUri });
            var teamConfig = configs.FirstOrDefault(c => c.IsDefaultTeam);

            return(teamConfig.TeamSettings);
        }
        private void FillTreeView()
        {
            _treeStore.Clear();
            var versionControl = projectCollection.GetService <RepositoryService>();
            var items          = versionControl.QueryItems(this._currentWorkspace, new ItemSpec(VersionControlPath.RootFolder, RecursionType.Full), VersionSpec.Latest, DeletedState.NonDeleted, ItemType.Folder, false);

            var root = ItemSetToHierarchItemConverter.Convert(items);
            var node = _treeStore.AppendNode();

            _treeStore.SetValues(node, root.Item, GetRepositoryImage(), root.Name);
            AddChilds(node, root.Children);
            TreeIter firstNode;

            if (_treeStore.GetIterFirst(out firstNode))
            {
                _treeView.ExpandRow(_treeStore.GetPath(firstNode), false);
                _treeView.Selection.SelectIter(firstNode);
            }
            _treeView.Model = _treeStore;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Gets the iteration details.
        /// </summary>
        /// <param name="iterationPath">The iteration path (including the project name, e.g. "TfsReporting\Sprint 3").</param>
        /// <returns></returns>
        public TfsIteration GetIteration(string iterationPath)
        {
            // you need to add the “Iteration” word after the team project name.
            // //Project Name\\Iteration\Iteration 1
            var projectNameIndex = iterationPath.IndexOf("\\", 2);
            var fullPath         = iterationPath.Insert(projectNameIndex, "\\Iteration");

            var css       = ProjectCollection.GetService <ICommonStructureService4>();
            var node      = css.GetNodeFromPath(fullPath);
            var iteration = new TfsIteration()
            {
                StartDate  = node.StartDate,
                FinishDate = node.FinishDate,
                Name       = node.Name,
                Path       = node.Path
            };

            return(iteration);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Attempts to authenticate with given access token, returns bool indicating success
        /// </summary>
        public static bool VSTSConnect(string accessToken)
        {
            VssBasicCredential vssCreds = new VssBasicCredential(string.Empty, accessToken);
            Task connectTask            = null;

            try
            {
                VssConnection             = new VssConnection(new Uri(@"https://adamfeher.visualstudio.com"), vssCreds);
                connectTask               = VssConnection.ConnectAsync();
                Session.ProjectCollection = new TfsTeamProjectCollection(new Uri(@"https://adamfeher.visualstudio.com/DefaultCollection"), vssCreds);
                Session.ProjectCollection.Authenticate();
            }
            catch (Exception e) { return(false); }

            if (!connectTask.IsCompleted)
            {
                connectTask.SyncResult();
            }

            Wit         = VssConnection.GetClient <WorkItemTrackingHttpClient>();
            TestService = ProjectCollection.GetService <ITestManagementService>();

            return(true);
        }
 public static Workspace GetWorkspace(ProjectCollection collection, string name)
 {
     var versionControl = collection.GetService<RepositoryService>();
     return versionControl.QueryWorkspace(collection.Server.UserName, name);
 }
 public static List<Workspace> GetRemoteWorkspaces(ProjectCollection collection)
 {
     var versionControl = collection.GetService<RepositoryService>();
     return versionControl.QueryWorkspaces(collection.Server.UserName, string.Empty);
 }
 public static List<Workspace> GetLocalWorkspaces(ProjectCollection collection)
 {
     var versionControl = collection.GetService<RepositoryService>();
     return versionControl.QueryWorkspaces(collection.Server.UserName, Environment.MachineName);
 }
Exemplo n.º 8
0
        public static Workspace GetWorkspace(ProjectCollection collection, string workspaceName)
        {
            var versionControl = collection.GetService <RepositoryService>();

            return(versionControl.QueryWorkspace(collection.Server.UserName, workspaceName));
        }
Exemplo n.º 9
0
        public static List <Workspace> GetRemoteWorkspaces(ProjectCollection collection)
        {
            var versionControl = collection.GetService <RepositoryService>();

            return(versionControl.QueryWorkspaces(collection.Server.UserName, string.Empty));
        }
Exemplo n.º 10
0
        public static List <Workspace> GetLocalWorkspaces(ProjectCollection collection)
        {
            var versionControl = collection.GetService <RepositoryService>();

            return(versionControl.QueryWorkspaces(collection.Server.UserName, Environment.MachineName));
        }
Exemplo n.º 11
0
 public ChatHub() : base()
 {
     if (TFSPoll == null)
     {
         TFSPoll = new System.Timers.Timer(int.Parse(System.Configuration.ConfigurationManager.AppSettings.Get("TFSServerTimer")));
         //TFSPoll.Elapsed += OnTimedEvent;
         TFSPoll.Elapsed += OnTimedEvent2;
         TFSPoll.Enabled  = true;
     }
     if (TimerLog == null)
     {
         TimerLog = new List <string>();
     }
     if (ProjectCollectionUris == null)
     {
         ProjectCollectionUris = new List <Uri>();
         //Fetch the list of uri to the tfs server(s) project collection(s)
         //Parses comma delimited array of Uri
         foreach (string CollectionURI in System.Configuration.ConfigurationManager.AppSettings.Get("TFSServerUri").Split(','))
         {
             ProjectCollectionUris.Add(new Uri(CollectionURI.Trim()));
         }
     }
     if (TfsProjectCollections == null)
     {
         //This builds a list of project collections for querying later.
         TfsProjectCollections = new List <TfsTeamProjectCollection>();
         foreach (Uri Location in ProjectCollectionUris)
         {
             TfsProjectCollections.Add(new TfsTeamProjectCollection(Location));
         }
     }
     if (TFSServerQuery == null)
     {
         TFSServerQuery = System.Configuration.ConfigurationManager.AppSettings.Get("TFSServerQuery");
     }
     if (TFSServerQuerys == null)
     {
         TFSServerQuerys = new Dictionary <string, Query>();
         foreach (TfsTeamProjectCollection ProjectCollection in TfsProjectCollections)
         {
             TFSServerQuerys.Add(ProjectCollection.Name, new Query((WorkItemStore)ProjectCollection.GetService(typeof(WorkItemStore)), TFSServerQuery));
         }
     }
     if (TimerEventLock == null)
     {
         TimerEventLock = new Object();
     }
     if (TFSWorkItems == null)
     {
         TFSWorkItems = new Dictionary <string, List <WorkItem> >();
     }
     TFSServerQueryTimeout = int.Parse(System.Configuration.ConfigurationManager.AppSettings.Get("TFSServerQueryTimeout"));
 }