async Task ShowTeamExplorerPage(IGitHubServiceProvider gitHubServiceProvider) { var te = gitHubServiceProvider?.GetService(typeof(ITeamExplorer)) as ITeamExplorer; if (te != null) { var page = te.NavigateToPage(new Guid(TeamExplorerPageIds.Connect), null); if (page == null) { var tcs = new TaskCompletionSource <ITeamExplorerPage>(); PropertyChangedEventHandler handler = null; handler = new PropertyChangedEventHandler((s, e) => { if (e.PropertyName == "CurrentPage") { tcs.SetResult(te.CurrentPage); te.PropertyChanged -= handler; } }); te.PropertyChanged += handler; page = await tcs.Task; } } }
bool TryInitialize() { gitService = serviceProvider.GetService <IGitExt>(); if (gitService != null) { gitService.PropertyChanged += (s, e) => { if (e.PropertyName == nameof(gitService.ActiveRepositories)) { RefreshActiveRepositories(); } }; log.Debug("Found IGitExt service and initialized VSGitExt"); return(true); } log.Error("Couldn't find IGitExt service"); return(false); }
public RepositoryCloneService( IOperatingSystem operatingSystem, IVSGitServices vsGitServices, ITeamExplorerServices teamExplorerServices, IGraphQLClientFactory graphqlFactory, IGitHubContextService gitHubContextService, IUsageTracker usageTracker, IGitHubServiceProvider sp, [Import(AllowDefault = true)] JoinableTaskContext joinableTaskContext) { this.operatingSystem = operatingSystem; this.vsGitServices = vsGitServices; this.teamExplorerServices = teamExplorerServices; this.graphqlFactory = graphqlFactory; this.gitHubContextService = gitHubContextService; this.usageTracker = usageTracker; dte = new Lazy <EnvDTE.DTE>(() => sp.GetService <EnvDTE.DTE>()); JoinableTaskContext = joinableTaskContext ?? ThreadHelper.JoinableTaskContext; defaultClonePath = GetLocalClonePathFromGitProvider(operatingSystem.Environment.GetUserRepositoriesPath()); }
CloneRequest ShowCloneDialog(IGitHubServiceProvider gitHubServiceProvider, IGitRepositoriesExt gitRepositories, IRepositoryModel repository = null) { string basePath = null; gitHubServiceProvider.AddService(this, gitRepositories); var uiProvider = gitHubServiceProvider.GetService <IUIProvider>(); var controller = uiProvider.Configure(repository == null ? UIControllerFlow.Clone : UIControllerFlow.StartPageClone, null //TODO: set the connection corresponding to the repository if the repository is not null ); controller.TransitionSignal.Subscribe(x => { if ((repository == null && x.Data.ViewType == Exports.UIViewType.Clone) || // fire the normal clone dialog (repository != null && x.Data.ViewType == Exports.UIViewType.StartPageClone) // fire the clone dialog for re-acquiring a repo ) { var vm = x.View.ViewModel as IBaseCloneViewModel; if (repository != null) { vm.SelectedRepository = repository; } x.View.Done.Subscribe(_ => { basePath = vm.BaseRepositoryPath; if (repository == null) { repository = vm.SelectedRepository; } }); } }); uiProvider.RunInDialog(controller); gitHubServiceProvider.RemoveService(typeof(IGitRepositoriesExt), this); return(repository != null && basePath != null ? new CloneRequest(basePath, repository) : null); }
public VSGitServices(IGitHubServiceProvider serviceProvider) { this.serviceProvider = serviceProvider; this.statusBar = serviceProvider.GetService <IVsStatusbar>(); }
public GitHubContextService(IGitHubServiceProvider serviceProvider, IGitService gitService) { this.serviceProvider = serviceProvider; this.gitService = gitService; textManager = new Lazy <IVsTextManager2>(() => serviceProvider.GetService <SVsTextManager, IVsTextManager2>()); }
IGitHubDialogWindowViewModel CreateViewModel() { return(serviceProvider.GetService <IGitHubDialogWindowViewModel>()); }
public T GetService <T>() where T : class => theRealProvider.GetService <T>();
public void ShowMessage(string message) { manager = serviceProvider.GetService <ITeamExplorer, ITeamExplorerNotificationManager>(); manager?.ShowNotification(message, NotificationType.Information, NotificationFlags.None, null, default(Guid)); }
public void Clone(string cloneUrl, string clonePath, bool recurseSubmodules) { var gitExt = serviceProvider.GetService <IGitRepositoriesExt>(); gitExt.Clone(cloneUrl, clonePath, recurseSubmodules ? CloneOptions.RecurseSubmodule : CloneOptions.None); }
public VSGitExtFactory(IGitHubServiceProvider serviceProvider) { VSGitExt = serviceProvider.GetService <IVSGitExt>(); }