Interaction logic for TaskServiceProviderWindow.xaml
Inheritance: System.Windows.Window, INotifyPropertyChanged
示例#1
0
        private void SelectProjectButtonClick(object sender, RoutedEventArgs e)
        {
            Logger.Write("Entering SelectProjectButtonClick method");

            var dlg = new TaskServiceProviderWindow {
                Owner = this
            };

            foreach (var s in serviceProviders)
            {
                dlg.TaskServerServices.Add(s);
                if (s.IsInstalled && dlg.SelectedTaskServerService == null)
                {
                    dlg.SelectedTaskServerService = s;
                }
            }

            var r = dlg.ShowDialog();

            if (r.HasValue && r.Value)
            {
                var taskServerService = dlg.SelectedTaskServerService;
                if (taskServerService != null)
                {
                    simpleTracker.TrackEventAsync("Service", taskServerService.Name);

                    var project = taskServerService.ConnectToProject(this);

                    if (project != null)
                    {
                        var wiTypes = project.WorkItemTypeCollection;

                        var supportedReports = from rep in reports
                                               where rep.IsSupported(wiTypes)
                                               select rep;

                        // Create tab
                        var uc  = project.CreateUserControl(supportedReports, reports);
                        var tab = new TabItem {
                            Header = string.Format("Query #{0}", queryNumber), Content = uc
                        };
                        queryNumber++;
                        TabControl.Items.Insert(1, tab);
                        TabControl.SelectedItem = tab;

                        projects[tab] = project;
                    }
                }
            }
        }
    private void SelectProjectButtonClick(object sender, RoutedEventArgs e)
    {
      Logger.Write("Entering SelectProjectButtonClick method");

      var dlg = new TaskServiceProviderWindow { Owner = this };
      foreach (var s in teamFoundationServerServices)
      {
        dlg.TaskServerServices.Add(s);
        if (s.IsInstalled && dlg.SelectedTaskServerService == null)
          dlg.SelectedTaskServerService = s;
      }

      var r = dlg.ShowDialog();
      if (r.HasValue && r.Value)
      {
        var taskServerService = dlg.SelectedTaskServerService;
        if (taskServerService != null)
        {
          simpleTracker.TrackEventAsync("Service", taskServerService.Name);

          var project = taskServerService.ConnectToProject(this);

          if (project != null)
          {
            var wiTypes = project.WorkItemTypeCollection;

            var supportedReports = from rep in reports
                                   where rep.IsSupported(wiTypes)
                                   select rep;

            // Create tab
            var uc = project.CreateUserControl(supportedReports, reports);
            var tab = new TabItem { Header = string.Format("Report #{0}", reportNumber), Content = uc };
            reportNumber++;
            TabControl.Items.Insert(1, tab);
            TabControl.SelectedItem = tab;

            projects[tab] = project;
          }
        }
      }
    }