public VSGitExt(IGitHubServiceProvider serviceProvider, IVSUIContextFactory factory, ILocalRepositoryModelFactory repositoryFactory) { this.serviceProvider = serviceProvider; this.repositoryFactory = repositoryFactory; // The IGitExt service isn't available when a TFS based solution is opened directly. // It will become available when moving to a Git based solution (cause a UIContext event to fire). context = factory.GetUIContext(new Guid(Guids.GitSccProviderId)); // Start with empty array until we have a change to initialize. ActiveRepositories = Array.Empty <ILocalRepositoryModel>(); if (context.IsActive && TryInitialize()) { // Refresh ActiveRepositories on background thread so we don't delay startup. InitializeTask = Task.Run(() => RefreshActiveRepositories()); } else { // If we're not in the UIContext or TryInitialize fails, have another go when the UIContext changes. context.UIContextChanged += ContextChanged; log.Debug("VSGitExt will be initialized later"); InitializeTask = Task.CompletedTask; } }
public VSGitExt(IAsyncServiceProvider asyncServiceProvider, IVSUIContextFactory factory, ILocalRepositoryModelFactory repositoryFactory) { this.asyncServiceProvider = asyncServiceProvider; this.repositoryFactory = repositoryFactory; // Start with empty array until we have a chance to initialize. ActiveRepositories = Array.Empty <ILocalRepositoryModel>(); // The IGitExt service isn't available when a TFS based solution is opened directly. // It will become available when moving to a Git based solution (and cause a UIContext event to fire). var context = factory.GetUIContext(new Guid(Guids.GitSccProviderId)); context.WhenActivated(() => Initialize()); }
public VSGitExt(IAsyncServiceProvider asyncServiceProvider, IVSUIContextFactory factory, ILocalRepositoryModelFactory repositoryFactory, JoinableTaskContext joinableTaskContext) { JoinableTaskCollection = joinableTaskContext.CreateCollection(); JoinableTaskCollection.DisplayName = nameof(VSGitExt); JoinableTaskFactory = joinableTaskContext.CreateFactory(JoinableTaskCollection); this.asyncServiceProvider = asyncServiceProvider; this.repositoryFactory = repositoryFactory; // Start with empty array until we have a chance to initialize. ActiveRepositories = Array.Empty <ILocalRepositoryModel>(); // Initialize when we enter the context of a Git repository var context = factory.GetUIContext(UICONTEXT.RepositoryOpen_guid); context.WhenActivated(() => JoinableTaskFactory.RunAsync(InitializeAsync).Task.Forget(log)); }
public VSGitExt(IAsyncServiceProvider asyncServiceProvider, IVSUIContextFactory factory, ILocalRepositoryModelFactory repositoryFactory, JoinableTaskContext joinableTaskContext) { JoinableTaskCollection = joinableTaskContext.CreateCollection(); JoinableTaskCollection.DisplayName = nameof(VSGitExt); JoinableTaskFactory = joinableTaskContext.CreateFactory(JoinableTaskCollection); this.asyncServiceProvider = asyncServiceProvider; this.repositoryFactory = repositoryFactory; // Start with empty array until we have a chance to initialize. ActiveRepositories = Array.Empty <ILocalRepositoryModel>(); // The IGitExt service isn't available when a TFS based solution is opened directly. // It will become available when moving to a Git based solution (and cause a UIContext event to fire). var context = factory.GetUIContext(new Guid(Guids.GitSccProviderId)); context.WhenActivated(() => JoinableTaskFactory.RunAsync(InitializeAsync).Task.Forget(log)); }
public VSGitExt(IServiceProvider serviceProvider, IVSUIContextFactory factory, IGitService gitService, JoinableTaskContext joinableTaskContext) { JoinableTaskCollection = joinableTaskContext.CreateCollection(); JoinableTaskCollection.DisplayName = nameof(VSGitExt); JoinableTaskFactory = joinableTaskContext.CreateFactory(JoinableTaskCollection); this.serviceProvider = serviceProvider; this.gitService = gitService; // Start with empty array until we have a chance to initialize. ActiveRepositories = Array.Empty <LocalRepositoryModel>(); // The IGitExt service isn't available when a TFS based solution is opened directly. // It will become available when moving to a Git based solution (and cause a UIContext event to fire). // NOTE: I tried using the RepositoryOpen context, but it didn't work consistently. var context = factory.GetUIContext(new Guid(Guids.GitSccProviderId)); context.WhenActivated(() => { log.Debug("WhenActivated"); JoinableTaskFactory.RunAsync(InitializeAsync).Task.Forget(log); }); }