Search code examples
tfsvisual-studio-2012visual-studio-sdktfs-sdk

How can I manipulate pending changes window programatically?


I am creating a clone of Merge Wizard of TFS to add new features.

I already merged with workspakce.Merge api. Now I need a way to programatically show the Pending Changes - Conflict Window.

I already have a IVsWindowFrame from PendingChangesExt like:

   GetStatus status = sourceExplorer.Workspace.Merge(sourcePath, targetPath, versionFrom, versionTo, LockLevel.None, RecursionType.Full, MergeOptionsEx.None);

   IVsWindowFrame frame = pendingChanges.VsWindowFrame;
   frame.Show(); 

When I call show(), the Pending Changes Window is refresh with checkout files, but I need to select the last button in this screen (Conflicts), to show the conflicts of Merge.

How could I programatically click on Conflict button on this screen through IVsWindowFrame ?


Solution

  • I found a solution with help of Chad Boles:

    public void refreshPendingChanges()
    {
      Object customIn = null;
      Object customOut = null;
    
      //Show TfsPendingChanges
      m_applicationObject.ExecuteCommand("View.TfsPendingChanges", "");
    
      //Refresh
      m_applicationObject.Commands.Raise("{FFE1131C-8EA1-4D05-9728-34AD4611BDA9}", 4808, ref customIn, ref customOut);
    
      //Activate Source Explorer
      m_applicationObject.DTE.Windows.Item("{99B8FA2F-AB90-4F57-9C32-949F146F1914}").Activate(); //I get this GUID recording a Macro.
      //Show Conflicts
      m_applicationObject.DTE.ExecuteCommand("File.TfsResumeConflictResolution"); 
    }
    

    Thanks for Chad Boles, that said me about File.TfsResumeConflictResolution !