private void importFromTeamProjectButton_Click(object sender, RoutedEventArgs e)
        {
            using (var dialog = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, false))
            {
                var result = dialog.ShowDialog(Application.Current.MainWindow.GetIWin32Window());
                if (result == System.Windows.Forms.DialogResult.OK && dialog.SelectedProjects != null && dialog.SelectedProjects.Length > 0)
                {
                    try
                    {
                        this.IsEnabled = false;

                        var teamProjectCollection = dialog.SelectedTeamProjectCollection;
                        var teamProject           = dialog.SelectedProjects.First();
                        var tfs     = TfsTeamProjectCollectionCache.GetTfsTeamProjectCollection(teamProjectCollection.Uri);
                        var store   = tfs.GetService <WorkItemStore>();
                        var project = store.Projects[teamProject.Name];

                        this.Configuration = WorkItemConfiguration.FromTeamProject(tfs, project);
                    }
                    finally
                    {
                        this.IsEnabled = true;
                    }
                }
            }
        }
Beispiel #2
0
 protected override void OnExit(ExitEventArgs e)
 {
     TfsTeamProjectCollectionCache.ClearCache();
     this.logger.Log("Application exited", TraceEventType.Information);
     base.OnExit(e);
 }
 /// <summary>
 /// Gets the Team Project Collection instance for the specified URI.
 /// </summary>
 /// <param name="uri">The URI of the Team Project Collection.</param>
 /// <returns>The Team Project Collection instance for the specified URI.</returns>
 protected TfsTeamProjectCollection GetTfsTeamProjectCollection(Uri uri)
 {
     return(TfsTeamProjectCollectionCache.GetTfsTeamProjectCollection(uri));
 }