Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit a5ad053

Browse files
committed
Store JoinableTaskContext in TeamExplorerServiceHolder
No need to create a special JoinableTaskCollection and JoinableTaskFactory here.
1 parent c7a9185 commit a5ad053

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

src/GitHub.Exports/Services/ITeamExplorerServiceHolder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public interface ITeamExplorerServiceHolder
3636
/// <summary>
3737
/// A service for avoiding deadlocks and marshaling tasks onto the UI thread.
3838
/// </summary>
39-
JoinableTaskFactory JoinableTaskFactory { get; }
39+
JoinableTaskContext JoinableTaskContext { get; }
4040

4141
IGitAwareItem HomeSection { get; }
4242
}

src/GitHub.TeamFoundation.14/Base/TeamExplorerServiceHolder.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,7 @@ public class TeamExplorerServiceHolder : ITeamExplorerServiceHolder
2323
public TeamExplorerServiceHolder(ITeamExplorerContext teamExplorerContext,
2424
[Import(AllowDefault = true)] JoinableTaskContext joinableTaskContext)
2525
{
26-
joinableTaskContext = joinableTaskContext ?? ThreadHelper.JoinableTaskContext;
27-
28-
JoinableTaskCollection = joinableTaskContext.CreateCollection();
29-
JoinableTaskCollection.DisplayName = nameof(TeamExplorerServiceHolder);
30-
JoinableTaskFactory = joinableTaskContext.CreateFactory(JoinableTaskCollection);
31-
26+
JoinableTaskContext = joinableTaskContext ?? ThreadHelper.JoinableTaskContext;
3227
TeamExplorerContext = teamExplorerContext;
3328
}
3429

@@ -82,8 +77,7 @@ ITeamExplorerPage PageService
8277
get { return ServiceProvider.GetServiceSafe<ITeamExplorerPage>(); }
8378
}
8479

85-
public JoinableTaskCollection JoinableTaskCollection { get; }
86-
public JoinableTaskFactory JoinableTaskFactory { get; }
80+
public JoinableTaskContext JoinableTaskContext { get; }
8781
public ITeamExplorerContext TeamExplorerContext { get; }
8882
}
8983
}

src/GitHub.VisualStudio.UI/Base/TeamExplorerItemBase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ void TeamExplorerContext_PropertyChanged(object sender, PropertyChangedEventArgs
8787

8888
void UpdateRepoOnMainThread(LocalRepositoryModel repo)
8989
{
90-
holder.JoinableTaskFactory.RunAsync(async () =>
90+
holder.JoinableTaskContext.Factory.RunAsync(async () =>
9191
{
92-
await holder.JoinableTaskFactory.SwitchToMainThreadAsync();
92+
await holder.JoinableTaskContext.Factory.SwitchToMainThreadAsync();
9393
UpdateRepo(repo);
9494
}).Task.Forget();
9595
}

0 commit comments

Comments
 (0)