【问题标题】:Open standard dialogs in Visual Studio extension在 Visual Studio 扩展中打开标准对话框
【发布时间】:2012-11-02 17:16:43
【问题描述】:

我正在编写一个 Visual Studio 扩展,并希望在单击时打开 连接到 Team Foundation Server 标准对话框。

我可以使用DTE2.ExecuteCommand 方法(如DTE2.ExecuteCommand("Team.ConnecttoTeamFoundationServer"))来做到这一点,但我觉得必须有比使用 Visual Studio 宏更好的方法。

非常感谢任何帮助。提前致谢!

【问题讨论】:

    标签: c# visual-studio-2012 visual-studio-extensions vsix


    【解决方案1】:

    您可以使用Team Project Picker 类的Microsoft.TeamFoundation.Client 程序集。这个blog 给出了如何使用它的完整细节。我在下面粘贴上面博客文章中的示例代码,它将帮助您显示对话框。

    private static TfsTeamProjectCollection _tfs;
    private static ProjectInfo _selectedTeamProject;
    
    // Connect to TFS Using Team Project Picker
    public static void ConnectToTfsUsingTeamProjectPicker()
    {
         // The  user is allowed to select only one project
         var tfsPp = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, false);
    
         tfsPp.ShowDialog();
    
         // The TFS project collection
         _tfs = tfsPp.SelectedTeamProjectCollection;
    
         if (tfsPp.SelectedProjects.Any())
         {
              //  The selected Team Project
              _selectedTeamProject = tfsPp.SelectedProjects[0];
         }
     }
    

    【讨论】:

      猜你喜欢
      • 2012-07-11
      • 1970-01-01
      • 1970-01-01
      • 2022-08-03
      • 1970-01-01
      • 1970-01-01
      • 2014-04-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多