我有一种连接到 tfs 并签出文件的方法。我必须将它分成 2 种方法,因为它们不会连续发生。但我不确定如何将其分成 2 种方法,因为如果我进行了结帐,这意味着我必须再次获取凭据和项目集合?
public static void Connect(String server, string path)
{
try
{
Uri serverUri = new Uri(server + "/tfs");
ICredentialsProvider credentials = new UICredentialsProvider();
TfsTeamProjectCollection tpc = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(serverUri, credentials);
tpc.EnsureAuthenticated();
VersionControlServer versionControl = tpc.GetService<VersionControlServer>();
Workspace workspace = versionControl.TryGetWorkspace(path);
workspace.PendEdit(path);
}