File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
src/VsChromium/Features/AutoUpdate Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,10 @@ namespace VsChromium.Features.AutoUpdate {
4
4
/// available" event.
5
5
/// </summary>
6
6
public interface IUpdateNotificationListener {
7
+ /// <summary>
8
+ /// Method invoked when there is a new update available. The method is called
9
+ /// on a background thread.
10
+ /// </summary>
7
11
void NotifyUpdate ( UpdateInfo updateInfo ) ;
8
12
}
9
13
}
Original file line number Diff line number Diff line change 1
1
using System . ComponentModel . Composition ;
2
2
using VsChromium . Features . ToolWindows ;
3
+ using VsChromium . Threads ;
3
4
4
5
namespace VsChromium . Features . AutoUpdate {
5
6
[ Export ( typeof ( IUpdateNotificationListener ) ) ]
6
7
public class UpdateNotificationListener : IUpdateNotificationListener {
7
8
private readonly IToolWindowAccessor _toolWindowAccessor ;
9
+ private readonly ISynchronizationContextProvider _synchronizationContextProvider ;
8
10
9
11
[ ImportingConstructor ]
10
- public UpdateNotificationListener ( IToolWindowAccessor toolWindowAccessor ) {
12
+ public UpdateNotificationListener ( IToolWindowAccessor toolWindowAccessor , ISynchronizationContextProvider synchronizationContextProvider ) {
11
13
_toolWindowAccessor = toolWindowAccessor ;
14
+ _synchronizationContextProvider = synchronizationContextProvider ;
12
15
}
13
16
14
17
public void NotifyUpdate ( UpdateInfo updateInfo ) {
15
- _toolWindowAccessor . CodeSearch . NotifyPackageUpdate ( updateInfo ) ;
18
+ // We have to run this on the UI thread since we are accessing UI components
19
+ _synchronizationContextProvider . DispatchThreadContext . Post ( ( ) => {
20
+ _toolWindowAccessor . CodeSearch . NotifyPackageUpdate ( updateInfo ) ;
21
+ } ) ;
16
22
}
17
23
}
18
24
}
You can’t perform that action at this time.
0 commit comments