This repository was archived by the owner on Jun 21, 2023. It is now read-only.
File tree 2 files changed +7
-1
lines changed
GitHub.VisualStudio/Services
2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change 7
7
using System . Windows ;
8
8
using static Microsoft . VisualStudio . Threading . JoinableTaskFactory ;
9
9
using static Microsoft . VisualStudio . Threading . AwaitExtensions ;
10
+ using System . Windows . Threading ;
10
11
11
12
namespace GitHub . Helpers
12
13
{
@@ -25,6 +26,11 @@ public static class ThreadingHelper
25
26
{
26
27
public static bool InUIThread => ( ! Guard . InUnitTestRunner && Application . Current . Dispatcher . CheckAccess ( ) ) || ! ( Guard . InUnitTestRunner ) ;
27
28
29
+ /// <summary>
30
+ /// Gets the Dispatcher for the main thread.
31
+ /// </summary>
32
+ public static Dispatcher MainThreadDispatcher => Application . Current . Dispatcher ;
33
+
28
34
/// <summary>
29
35
/// Switch to the UI thread using ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync
30
36
/// 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)
65
65
TimeSpan . FromMinutes ( 3 ) ,
66
66
DispatcherPriority . Background ,
67
67
TimerTick ,
68
- Dispatcher . CurrentDispatcher ) ;
68
+ ThreadingHelper . MainThreadDispatcher ) ;
69
69
70
70
RunTimer ( ) ;
71
71
}
You can’t perform that action at this time.
0 commit comments