Correctly capture SynchronizationContext

This commit is contained in:
Antony Male 2014-04-22 14:36:54 +01:00
parent 562722328e
commit 8e571dc4c6
1 changed files with 3 additions and 3 deletions

View File

@ -34,9 +34,6 @@ namespace Stylet
{
this.Application = Application.Current;
// Use the current SynchronizationContext for the Execute helper
Execute.SynchronizationContext = SynchronizationContext.Current;
// Make life nice for the app - they can handle these by overriding Bootstrapper methods, rather than adding event handlers
this.Application.Startup += OnStartup;
this.Application.Exit += OnExit;
@ -45,6 +42,9 @@ namespace Stylet
// The magic which actually displays
this.Application.Startup += (o, e) =>
{
// Use the current SynchronizationContext for the Execute helper
Execute.SynchronizationContext = SynchronizationContext.Current;
IoC.Get<IWindowManager>().ShowWindow(IoC.Get<TRootViewModel>());
};