本文整理汇总了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;
}
示例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;
}
示例3: GenerateTfsConnection
public TfsTeamProjectCollection GenerateTfsConnection()
{
var tfs= new TfsTeamProjectCollection(GetTfsUri(), GetNetworkCredential());
tfs.Authenticate();
tfs.Connect(new ConnectOptions());
return tfs;
}
示例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;
}
示例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);
}
示例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;
}
}
示例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;
}
示例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;
}
示例9: GetTeamProjectCollection
private static void GetTeamProjectCollection()
{
_collection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(tpcUri));
_collection.Connect(Microsoft.TeamFoundation.Framework.Common.ConnectOptions.IncludeServices);
}