Display item history windows using the TFS SDK

I am writing an application that integrates with TFS through the official SDKs to automate and support various common activities. Although most of them are automation, and the TFS API provides almost everything I need, some of the actions require user intervention, so I need to display information to the user.

I found methods such as Difference.VisualDiffItemsthat make it easy to compare files visually using the same interface that Visual Studio uses. I also need to display the history of the elements (including branches, renames, etc.), and I would like to use the built-in user interface instead of writing myself. The item history user interface is actually quite complex, and I thought MS would provide it in the SDK, but I cannot find it.

Can anyone confirm that the TFS SDK does not provide the necessary methods for visualizing the history of the elements, or is pointing me in the right direction, if so?

+5
source share
2 answers

ILSpy TF.exe, , , , Microsoft.TeamFoundation.VersionControl.Controls.DialogHistory. , , , .

, social.msdn: http://social.msdn.microsoft.com/Forums/ar/tfsversioncontrol/thread/9a10473e-d381-4e83-bde9-dd423f430feb

, , Buck Hodges: " . , ( ), , "

TF ( TF.exe , ). , , , , .

, .

+4

Jonno -. ( TFS 2010 SP1). , - . , .

public class TfsHistoryDialogWrapper
{
    private readonly Type _dialogHistoryType;
    private readonly object _historyDialogInstance;

    public TfsHistoryDialogWrapper(VersionControlServer versionControl, string historyItem, VersionSpec itemVersion, int itemDeletionId, RecursionType recursionType, VersionSpec versionFrom, VersionSpec versionTo, string userFilter, int maxVersions, bool? slotMode)
    {
        Assembly tfsAssembly = typeof(Microsoft.TeamFoundation.VersionControl.Controls.LocalPathLinkBox).Assembly;
        _dialogHistoryType = tfsAssembly.GetType("Microsoft.TeamFoundation.VersionControl.Controls.DialogHistory");

        _historyDialogInstance = _dialogHistoryType.GetConstructor(
                                BindingFlags.NonPublic | BindingFlags.Instance,
                                null, 
                                new Type[]{typeof(VersionControlServer), typeof(string), typeof(VersionSpec), typeof(int), typeof(RecursionType), typeof(VersionSpec), typeof(VersionSpec), typeof(string), typeof(int), typeof(bool?)},
                                null).Invoke(new object[]{ versionControl, historyItem, itemVersion, itemDeletionId, recursionType, versionFrom, versionTo, userFilter, maxVersions, slotMode });
    }

    public void ShowDialog()
    {
        _dialogHistoryType.GetMethod("ShowDialog", new Type[]{}).Invoke(_historyDialogInstance, new object[]{});
    }

}
+4

All Articles