This repository was archived by the owner on Jun 21, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +8
-19
lines changed
Expand file tree Collapse file tree 2 files changed +8
-19
lines changed Original file line number Diff line number Diff line change 11using System ;
22using System . Threading ;
33using System . Runtime . InteropServices ;
4+ using GitHub . Helpers ;
45using GitHub . Services ;
56using GitHub . VisualStudio ;
67using GitHub . InlineReviews . Services ;
@@ -11,7 +12,7 @@ namespace GitHub.InlineReviews
1112{
1213 [ Guid ( Guids . PullRequestStatusPackageId ) ]
1314 [ PackageRegistration ( UseManagedResourcesOnly = true , AllowsBackgroundLoading = true ) ]
14- [ ProvideAutoLoad ( Guids . GitSccProviderId , PackageAutoLoadFlags . BackgroundLoad ) ]
15+ [ ProvideAutoLoad ( Guids . UIContext_Git , PackageAutoLoadFlags . BackgroundLoad ) ]
1516 public class PullRequestStatusBarPackage : AsyncPackage
1617 {
1718 /// <summary>
@@ -21,9 +22,11 @@ protected override async Task InitializeAsync(CancellationToken cancellationToke
2122 {
2223 var usageTracker = ( IUsageTracker ) await GetServiceAsync ( typeof ( IUsageTracker ) ) ;
2324 var serviceProvider = ( IGitHubServiceProvider ) await GetServiceAsync ( typeof ( IGitHubServiceProvider ) ) ;
24- var gitExt = ( IVSGitExt ) await GetServiceAsync ( typeof ( IVSGitExt ) ) ;
25+ var barManager = new PullRequestStatusBarManager ( usageTracker , serviceProvider ) ;
2526
26- new PullRequestStatusBarManager ( gitExt , usageTracker , serviceProvider ) ;
27+ // await ThreadingHelper.SwitchToMainThreadAsync() won't return until after a solution
28+ // has been loaded. We're using the following instead as a workaround.
29+ await ThreadingHelper . MainThreadDispatcher . InvokeAsync ( ( ) => barManager . StartShowingStatus ( ) ) ;
2730 }
2831 }
2932}
Original file line number Diff line number Diff line change @@ -21,33 +21,19 @@ public class PullRequestStatusBarManager
2121 static readonly ILogger log = LogManager . ForContext < PullRequestStatusBarManager > ( ) ;
2222 const string StatusBarPartName = "PART_SccStatusBarHost" ;
2323
24- readonly IVSGitExt gitExt ;
2524 readonly IUsageTracker usageTracker ;
2625 readonly IGitHubServiceProvider serviceProvider ;
2726
2827 IPullRequestSessionManager pullRequestSessionManager ;
2928
3029 [ ImportingConstructor ]
31- public PullRequestStatusBarManager ( IVSGitExt gitExt , IUsageTracker usageTracker , IGitHubServiceProvider serviceProvider )
30+ public PullRequestStatusBarManager ( IUsageTracker usageTracker , IGitHubServiceProvider serviceProvider )
3231 {
33- this . gitExt = gitExt ;
3432 this . usageTracker = usageTracker ;
3533 this . serviceProvider = serviceProvider ;
36-
37- OnActiveRepositoriesChanged ( ) ;
38- gitExt . ActiveRepositoriesChanged += OnActiveRepositoriesChanged ;
39- }
40-
41- void OnActiveRepositoriesChanged ( )
42- {
43- if ( gitExt . ActiveRepositories . Count > 0 )
44- {
45- gitExt . ActiveRepositoriesChanged -= OnActiveRepositoriesChanged ;
46- Application . Current . Dispatcher . Invoke ( ( ) => StartShowingStatus ( ) ) ;
47- }
4834 }
4935
50- void StartShowingStatus ( )
36+ public void StartShowingStatus ( )
5137 {
5238 try
5339 {
You can’t perform that action at this time.
0 commit comments