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 +7
-1
lines changed
GitHub.VisualStudio/Services Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change 77using System . Windows ;
88using static Microsoft . VisualStudio . Threading . JoinableTaskFactory ;
99using static Microsoft . VisualStudio . Threading . AwaitExtensions ;
10+ using System . Windows . Threading ;
1011
1112namespace GitHub . Helpers
1213{
@@ -25,6 +26,11 @@ public static class ThreadingHelper
2526 {
2627 public static bool InUIThread => ( ! Guard . InUnitTestRunner && Application . Current . Dispatcher . CheckAccess ( ) ) || ! ( Guard . InUnitTestRunner ) ;
2728
29+ /// <summary>
30+ /// Gets the Dispatcher for the main thread.
31+ /// </summary>
32+ public static Dispatcher MainThreadDispatcher => Application . Current . Dispatcher ;
33+
2834 /// <summary>
2935 /// Switch to the UI thread using ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync
3036 /// Auto-disables switching when running in unit test mode
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ public UsageTracker(IGitHubServiceProvider gitHubServiceProvider)
6565 TimeSpan . FromMinutes ( 3 ) ,
6666 DispatcherPriority . Background ,
6767 TimerTick ,
68- Dispatcher . CurrentDispatcher ) ;
68+ ThreadingHelper . MainThreadDispatcher ) ;
6969
7070 RunTimer ( ) ;
7171 }
You can’t perform that action at this time.
0 commit comments