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
|
||||
{
|
||||
/// <summary>
|
||||
/// Create a new Bootstrapper, which automatically starts and launches
|
||||
/// Create a new Bootstrapper, which automatically starts and launches on application startup
|
||||
/// </summary>
|
||||
public Bootstrapper() : base() { }
|
||||
|
||||
/// <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>
|
||||
/// <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) { }
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace Stylet
|
|||
protected Application Application { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Create a new BootstrapperBase, which automatically start
|
||||
/// Create a new BootstrapperBase, which automatically starts on application startup
|
||||
/// </summary>
|
||||
public BootstrapperBase() : this(true) { }
|
||||
|
||||
|
@ -40,15 +40,17 @@ namespace Stylet
|
|||
// Allows for unit testing
|
||||
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
|
||||
this.Application.Exit += OnExit;
|
||||
this.Application.DispatcherUnhandledException += OnUnhandledExecption;
|
||||
}
|
||||
|
||||
if (autoStart)
|
||||
this.Start();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in New Issue