当前位置: 首页>>代码示例>>C#>>正文


C# TfsTeamProjectCollection.Connect方法代码示例

本文整理汇总了C#中TfsTeamProjectCollection.Connect方法的典型用法代码示例。如果您正苦于以下问题:C# TfsTeamProjectCollection.Connect方法的具体用法?C# TfsTeamProjectCollection.Connect怎么用?C# TfsTeamProjectCollection.Connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TfsTeamProjectCollection的用法示例。


在下文中一共展示了TfsTeamProjectCollection.Connect方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetTeamProjectCollection

        public static TfsTeamProjectCollection GetTeamProjectCollection(Uri tfsCollectionUri, ITfsCredentials tfsCredentials)
        {
            TfsTeamProjectCollection result;

            TfsClientCredentials credential = null;
            if (tfsCredentials != null)
            {
                credential = tfsCredentials.GetCredentials();
            }
            else
            {
                if (Defaults.GetDefaultCredentials(tfsCollectionUri) != null)
                {
                    credential = Defaults.GetDefaultCredentials(tfsCollectionUri).GetCredentials();
                }
            }

            if (credential != null)
            {
                result = new TfsTeamProjectCollection(tfsCollectionUri, credential);

                result.Connect(ConnectOptions.IncludeServices);
            }
            else
            {
                result = new TfsTeamProjectCollection(tfsCollectionUri);
            }

            return result;
        }
开发者ID:devoneonline,项目名称:Tfs-Api,代码行数:30,代码来源:TfsTeamProjectCollectionFactory.cs

示例2: ConnectToTfs

        private TfsTeamProjectCollection ConnectToTfs()
        {
            var tfsServer = new TfsTeamProjectCollection(new Uri(Properties.Settings.Default.TfsAddress));

            tfsServer.ClientCredentials = new TfsClientCredentials(new WindowsCredential());
            tfsServer.Connect(Microsoft.TeamFoundation.Framework.Common.ConnectOptions.None);
            return tfsServer;
        }
开发者ID:ielcoro,项目名称:TFSWorkItemQueryToWebAPI,代码行数:8,代码来源:QueryExecutionTests.cs

示例3: GenerateTfsConnection

        public TfsTeamProjectCollection GenerateTfsConnection()
        {
            var tfs= new TfsTeamProjectCollection(GetTfsUri(), GetNetworkCredential());
            tfs.Authenticate();
            tfs.Connect(new ConnectOptions());

            return tfs;
        }
开发者ID:Workshop2,项目名称:MergeReminder,代码行数:8,代码来源:SystemConfiguration.cs

示例4: TFSAPI

        /// <summary>
        /// Create a new instance of TFSAPI Class
        /// </summary>
        /// <param name="TfsCollectionURI">URI to access the TFS Server and project collection</param>
        /// <param name="ProjectName">Default project</param>
        public TFSAPI(Uri TfsCollectionURI, string ProjectName)
        {
            teamProjectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(TfsCollectionURI);
            teamProjectCollection.Connect(Microsoft.TeamFoundation.Framework.Common.ConnectOptions.IncludeServices);
            teamProjectCollection.EnsureAuthenticated();

            wiStore = new WorkItemStore(teamProjectCollection);

            workItemTypeCollection = wiStore.Projects[ProjectName].WorkItemTypes;
        }
开发者ID:rolandocc,项目名称:TFSAPIWrapper,代码行数:15,代码来源:TFSAPI.cs

示例5: MyClassInitialize

        public static void MyClassInitialize(TestContext testContext)
        {
            NetworkCredential networkCredential = new NetworkCredential(@"[email protected]","zippyd00da");
            BasicAuthToken basicAuthToken = new BasicAuthToken(networkCredential);
            BasicAuthCredential basicAuthCredential = new BasicAuthCredential(basicAuthToken);
            TfsClientCredentials tfsClientCredentials = new TfsClientCredentials(basicAuthCredential);
            tfsClientCredentials.AllowInteractive = false;

            server2 = new TfsTeamProjectCollection(new Uri("https://rdavis.visualstudio.com/DefaultCollection"), tfsClientCredentials);

            server2.Connect(Microsoft.TeamFoundation.Framework.Common.ConnectOptions.None);
            server2.EnsureAuthenticated();

            server2.Authenticate();

            if (!server2.HasAuthenticated)
                throw new InvalidOperationException("Not authenticated");

            store = new WorkItemStore(server2);
        }
开发者ID:richarddavis42,项目名称:mirror,代码行数:20,代码来源:WiqlPartsTest.cs

示例6: Connect

        public bool Connect()
        {
            try
            {
                if (teamFoundationServerExt.ActiveProjectContext == null)
                {
                    return false;
                }

                if (tfsCollection == null || !tfsConnectionUrl.Equals(teamFoundationServerExt.ActiveProjectContext.DomainUri, StringComparison.CurrentCultureIgnoreCase))
                {
                    tfsConnectionUrl = teamFoundationServerExt.ActiveProjectContext.DomainUri;
                    if (string.IsNullOrWhiteSpace(tfsConnectionUrl))
                    {
                        return false;
                    }
                    if(ConnectionChanged != null)
                    {
                        ConnectionChanged(this, null);
                    }
                    logger.Log(string.Format("Connecting to TFS server '{0}'", tfsConnectionUrl), LogLevel.Info);
                    tfsCollection = new TfsTeamProjectCollection(new Uri(tfsConnectionUrl));
                    tfsCollection.Connect(Microsoft.TeamFoundation.Framework.Common.ConnectOptions.None);
                    return true;
                }
                else
                {
                    return true;
                }
            }
            catch (Exception ex)
            {
                logger.Log(string.Format("Error trying to connect to tfs server\n {0}", ex.ToString()), LogLevel.Error);
                return false;
            }
        }
开发者ID:modulexcite,项目名称:tfsproductivitypack,代码行数:36,代码来源:TFSConnection.cs

示例7: ApplyUserServerPreferences

        private void ApplyUserServerPreferences()
        {
            if (_userPreferences.TfsUri.Value == null ||
                String.IsNullOrEmpty(_userPreferences.TestProject))
            {
                return;
            }

            _logger.Info("Apply server preferences. TFS URI: {0}; TestProject: {1}",
                _userPreferences.TfsUri.Value, _userPreferences.TestProject);

            _tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(_userPreferences.TfsUri);
            _tfs.Connect(ConnectOptions.IncludeServices);
            _testProject = _tfs.GetService<ITestManagementService>().GetTeamProject(_userPreferences.TestProject);

            _changeProjectToolStripButton.Text = _userPreferences.TestProject;
        }
开发者ID:Eric4Zhang,项目名称:TFSTestStepsEditor,代码行数:17,代码来源:MainForm.cs

示例8: Connect

        /// <summary>
        /// The connect.
        /// </summary>
        /// <param name="uri">
        /// The uri.
        /// </param>
        /// <param name="credentials">
        /// The credentials.
        /// </param>
        /// <returns>
        /// is connected
        /// </returns>
        public bool Connect(Uri uri, ICredentials credentials, bool anotherUser)
        {

            List<CatalogNode> catalogNodes = GetCatalogNodes(uri, credentials, anotherUser);
            
            if (catalogNodes != null)
            {
                nodes = new List<CatalogNode>();
                foreach (CatalogNode node in catalogNodes)
                {
                    try
                    {
                        using (TfsTeamProjectCollection projCollection = new TfsTeamProjectCollection(new Uri(string.Format(@"{0}/{1}", uri, node.Resource.DisplayName)), Credential))
                        {
                            projCollection.Connect(ConnectOptions.None);
                            nodes.Add(node);
                        }
                    }
                    catch (TeamFoundationServiceUnavailableException)
                    {
                    }
                    catch (Exception ex)
                    {
                        //MessageBox.Show(ex.Message);
                    }
                }

                if (nodes.Count > 0)
                {
                    ChangeCollection(nodes[0].Resource.DisplayName);
                    tfsVersion = collection.GetVersion();
                    return true;
                }
            }

            return false;
        }
开发者ID:nkravch,项目名称:SALMA-2.0,代码行数:49,代码来源:TfsManager.cs

示例9: GetTeamProjectCollection

 private static void GetTeamProjectCollection()
 {
     _collection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(tpcUri));
     _collection.Connect(Microsoft.TeamFoundation.Framework.Common.ConnectOptions.IncludeServices);
 }
开发者ID:dicko2,项目名称:NUnitTfsTestCase,代码行数:5,代码来源:ProjectConnection.cs


注:本文中的TfsTeamProjectCollection.Connect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。