void BuildQueryView()
        {
            queryStore.Clear();
            foreach (var server in TFSVersionControlService.Instance.Servers)
            {
                var node = queryStore.AddNode().SetValue(titleField, server.Name);
                foreach (var pc in server.ProjectCollections)
                {
                    node.AddChild().SetValue(titleField, pc.Name);
                    var workItemManager = new WorkItemManager(pc);
                    foreach (var projectInfo in pc.Projects.OrderBy(x => x.Name))
                    {
                        var workItemProject = workItemManager.GetByGuid(projectInfo.Guid);
                        if (workItemProject == null)
                        {
                            continue;
                        }

                        node.AddChild().SetValue(titleField, projectInfo.Name);

                        var privateQueries = workItemManager.GetMyQueries(workItemProject);
                        if (privateQueries.Any())
                        {
                            node.AddChild().SetValue(titleField, "My Queries");
                            foreach (var query in privateQueries)
                            {
                                node.AddChild().SetValue(titleField, query.QueryName).SetValue(queryField, query);
                                node.MoveToParent();
                            }
                            node.MoveToParent();
                        }
                        var publicQueries = workItemManager.GetPublicQueries(workItemProject);
                        if (publicQueries.Any())
                        {
                            node.AddChild().SetValue(titleField, "Public");
                            foreach (var query in publicQueries)
                            {
                                node.AddChild().SetValue(titleField, query.QueryName).SetValue(queryField, query);
                                node.MoveToParent();
                            }
                            node.MoveToParent();
                        }
                        node.MoveToParent();
                    }
                    queryView.ExpandRow(node.CurrentPosition, true);
                }
            }
            var cursor = queryStore.GetFirstNode();

            if (cursor.MoveToChild()) //Move to Project Collections
            {
                queryView.ExpandToRow(cursor.CurrentPosition);
            }
        }
Beispiel #2
0
 private void UpdateData()
 {
     _treeStore.Clear();
     foreach (var server in TFSVersionControlService.Instance.Servers)
     {
         var node = _treeStore.AddNode().SetValue(_name, server.Name)
                    .SetValue(_type, NodeType.Server)
                    .SetValue(_item, server);
         try
         {
             foreach (var pc in server.ProjectCollections)
             {
                 node.AddChild().SetValue(_name, pc.Name)
                 .SetValue(_type, NodeType.ProjectCollection)
                 .SetValue(_item, pc);
                 var workItemManager = new WorkItemManager(pc);
                 foreach (var projectInfo in pc.Projects.OrderBy(x => x.Name))
                 {
                     node.AddChild().SetValue(_name, projectInfo.Name).SetValue(_type, NodeType.Project).SetValue(_item, projectInfo);
                     var workItemProject = workItemManager.GetByGuid(projectInfo.Guid);
                     if (workItemProject != null)
                     {
                         node.AddChild().SetValue(_name, "Work Items").SetValue(_type, NodeType.WorkItems);
                         var privateQueries = workItemManager.GetMyQueries(workItemProject);
                         if (privateQueries.Any())
                         {
                             node.AddChild().SetValue(_name, "My Queries").SetValue(_type, NodeType.WorkItemQueryType);
                             foreach (var query in privateQueries)
                             {
                                 node.AddChild().SetValue(_name, query.QueryName).SetValue(_type, NodeType.WorkItemQuery).SetValue(_item, query);
                                 node.MoveToParent();
                             }
                             node.MoveToParent();
                         }
                         var publicQueries = workItemManager.GetPublicQueries(workItemProject);
                         if (publicQueries.Any())
                         {
                             node.AddChild().SetValue(_name, "Public").SetValue(_type, NodeType.WorkItemQueryType);
                             foreach (var query in publicQueries)
                             {
                                 node.AddChild().SetValue(_name, query.QueryName).SetValue(_type, NodeType.WorkItemQuery).SetValue(_item, query);
                                 node.MoveToParent();
                             }
                             node.MoveToParent();
                         }
                         node.MoveToParent();
                     }
                     node.AddChild().SetValue(_name, "Source Control").SetValue(_type, NodeType.SourceControl);
                     node.MoveToParent();
                     node.MoveToParent();
                 }
                 node.MoveToParent();
             }
         }
         catch (Exception ex)
         {
             node.AddChild().SetValue(_name, ex.Message).SetValue(_type, NodeType.Exception);
         }
     }
     ExpandServers();
 }