Пример #1
0
        private void cboCollectionURL_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            cboProject.Items.Clear();
            cboBuildController.Items.Clear();

            if (cboCollectionURL.SelectedItem != null)
            {
                ClientCollectionSource source = cboCollectionURL.SelectedItem as ClientCollectionSource;

                Uri collectionUri = null;

                TfsTeamProjectCollection collection = null;

                try
                {
                    collectionUri = new Uri(source.Uri);
                    collection    = new TfsTeamProjectCollection(collectionUri);

                    ICommonStructureService commonStructure = collection.GetService <ICommonStructureService>();

                    foreach (ProjectInfo project in commonStructure.ListProjects())
                    {
                        cboProject.Items.Add(new ComboBoxItem()
                        {
                            Content = project.Name, DataContext = project.Name
                        });
                    }
                }
                catch (Exception ex)
                {
                    cboProject.Items.Clear();
                    cboBuildController.Items.Clear();

                    MessageBox.Show(ex.Message, string.Format("Error retrieving projects from {0}", collectionUri), MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                try
                {
                    IBuildServer buildServer = collection.GetService <IBuildServer>();

                    foreach (IBuildController buildController in buildServer.QueryBuildControllers())
                    {
                        cboBuildController.Items.Add(new ComboBoxItem()
                        {
                            Content = buildController.Name, DataContext = buildController.Name
                        });
                    }
                }
                catch (Exception ex)
                {
                    cboBuildController.Items.Clear();
                    MessageBox.Show(ex.Message, string.Format("Error retrieving build controllers from {0}", collectionUri), MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
            }
        }
Пример #2
0
        private void btnRemove_Click(object sender, RoutedEventArgs e)
        {
            if (MessageBox.Show("Are you sure you want to remove this Team Foundation Server source?", "Confirm remove source",
                                MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
            {
                ClientCollectionSource source = (ClientCollectionSource)DataContext;

                ClientConfiguration.Current.Sources.Remove(source);
                ClientConfiguration.Current.Save();

                ClientConfiguration.Reload();

                NavigationService.Navigate(new Pages.Home(_clientControl));
            }
        }
Пример #3
0
        public AddEditSource(ClientControl clientControl, ClientCollectionSource source)
        {
            _clientControl = clientControl;

            DataContext = source;

            InitializeComponent();

            if (ClientConfiguration.Current.Sources.Contains(source))
            {
                btnRemove.Visibility = Visibility.Visible;
            }

            this.KeyUp += AddEditSource_KeyUp;

            this.Loaded += AddEditSource_Loaded;

            txtCollectionURL.SelectAll();
        }
Пример #4
0
        private void btnSaveChanges_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                ClientCollectionSource source = (ClientCollectionSource)DataContext;
                source.Uri = txtCollectionURL.Text;

                source.Save();

                ClientConfiguration.Reload();

                NavigationService.Navigate(new Pages.Home(_clientControl));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error saving TFS source", MessageBoxButton.OK, MessageBoxImage.Error);

                txtCollectionURL.Focus();

                return;
            }
        }