mirror of https://github.com/AMT-Cheif/Stylet.git
Fix bug where Stylet would launch before resources were loaded
This commit is contained in:
parent
9e0cfa0ea5
commit
9f59c21f51
|
@ -16,14 +16,14 @@ namespace Stylet
|
||||||
public class Bootstrapper<TRootViewModel> : BootstrapperBase<TRootViewModel> where TRootViewModel : class
|
public class Bootstrapper<TRootViewModel> : BootstrapperBase<TRootViewModel> where TRootViewModel : class
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a new Bootstrapper, which automatically starts and launches
|
/// Create a new Bootstrapper, which automatically starts and launches on application startup
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Bootstrapper() : base() { }
|
public Bootstrapper() : base() { }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a new Bootstrapper, and specify whether to auto-start and auto-launhc
|
/// Create a new Bootstrapper, and specify whether to auto-start and auto-launch
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="autoStart">True to call this.Start() at the end of this constructor</param>
|
/// <param name="autoStart">True to call this.Start() on Application.Startup. If false, call this.Start() in your OnStartup override</param>
|
||||||
public Bootstrapper(bool autoStart) : base(autoStart) { }
|
public Bootstrapper(bool autoStart) : base(autoStart) { }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -24,7 +24,7 @@ namespace Stylet
|
||||||
protected Application Application { get; private set; }
|
protected Application Application { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a new BootstrapperBase, which automatically start
|
/// Create a new BootstrapperBase, which automatically starts on application startup
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public BootstrapperBase() : this(true) { }
|
public BootstrapperBase() : this(true) { }
|
||||||
|
|
||||||
|
@ -40,15 +40,17 @@ namespace Stylet
|
||||||
// Allows for unit testing
|
// Allows for unit testing
|
||||||
if (this.Application != null)
|
if (this.Application != null)
|
||||||
{
|
{
|
||||||
this.Application.Startup += this.OnStartup;
|
this.Application.Startup += (o, e) =>
|
||||||
|
{
|
||||||
|
this.OnStartup(o, e);
|
||||||
|
if (autoStart)
|
||||||
|
this.Start();
|
||||||
|
};
|
||||||
|
|
||||||
// Make life nice for the app - they can handle these by overriding Bootstrapper methods, rather than adding event handlers
|
// Make life nice for the app - they can handle these by overriding Bootstrapper methods, rather than adding event handlers
|
||||||
this.Application.Exit += OnExit;
|
this.Application.Exit += OnExit;
|
||||||
this.Application.DispatcherUnhandledException += OnUnhandledExecption;
|
this.Application.DispatcherUnhandledException += OnUnhandledExecption;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (autoStart)
|
|
||||||
this.Start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Reference in New Issue