Beispiel #1
0
 public override IMigrationSourceView GetMigrationSourceView()
 {
     if (m_migrationSourceView == null)
     {
         m_migrationSourceView = new MigrationSourceView("Connect", s_providerId, null, PopulateMigrationSource, GetMigrationSourceProperties);
     }
     return(m_migrationSourceView);
 }
Beispiel #2
0
 public IMigrationSourceView GetMigrationSourceView()
 {
     if (m_migrationSourceView == null)
     {
         MigrationSourceCommand command = new MigrationSourceCommand();
         m_migrationSourceView = new MigrationSourceView(command.CommandName, Guid.Empty, command.ButtonImage, command.Execute, GetMigrationSourceProperties);
     }
     return(m_migrationSourceView);
 }
Beispiel #3
0
        private void providerButton_Click(object sender, RoutedEventArgs e)
        {
            MigrationProviderView providerView = providerListBox.SelectedItem as MigrationProviderView;

            Microsoft.TeamFoundation.Migration.Shell.Tfs.Shell shell = this.DataContext as Microsoft.TeamFoundation.Migration.Shell.Tfs.Shell;

            if (providerView != null && shell != null)
            {
                // TODO: This hack disables the button unless a doc is open
                if (shell.ViewModel.DataModel != null)
                {
                    ICollection <ProviderElement> providers = shell.ViewModel.DataModel.Configuration.Providers.Provider;
                    ProviderElement provider = providers.FirstOrDefault(x => string.Equals(x.ReferenceName, providerView.ProviderId, StringComparison.OrdinalIgnoreCase));

                    if (provider == null)
                    {
                        provider = new ProviderElement();
                        provider.FriendlyName  = providerView.Name;
                        provider.ReferenceName = providerView.ProviderId;
                        providers.Add(provider);

                        shell.ViewModel.DataModel.Configuration.SessionGroup.Linking.CreationTime = DateTime.Now;
                    }

                    // TODO: Hack, look it up by provider id
                    //MigrationSourceCommand command = shell.ViewModel.ExtensibileViewModel.MigrationServerViews[0].Command.Target as MigrationSourceCommand;
                    //bool b = shell.ViewModel.ExtensibileViewModel.MigrationServerViews[0].Command.Target is MigrationSourceCommand;
                    //MigrationSourceView serverView = shell.ViewModel.ExtensibileViewModel.MigrationServerViews.FirstOrDefault(x => string.Equals((x.Command.Target as MigrationSourceCommand).ProviderReferenceName, provider.ReferenceName));
                    MigrationSourceView serverView      = shell.ViewModel.ExtensibileViewModel.MigrationServerViews[0];
                    MigrationSource     migrationSource = new MigrationSource();

                    serverView.Command(migrationSource);

                    if (migrationSource.InternalUniqueId != null)
                    {
                        shell.ViewModel.DataModel.Configuration.SessionGroup.MigrationSources.MigrationSource.Add(migrationSource);
                    }
                }
            }
        }