Skip to content

Commit

Permalink
Fixed the order in which services start when the application starts
Browse files Browse the repository at this point in the history
  • Loading branch information
TTLC198 committed Dec 7, 2023
1 parent 17f1a27 commit ad1a326
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions HSMonitor/Utils/Bootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@ namespace HSMonitor.Utils;
public class Bootstrapper : Bootstrapper<MainWindowViewModel>
{
private T GetInstance<T>() => (T) base.GetInstance(typeof(T));


protected override void OnStart()
{
Stylet.Logging.LogManager.LoggerFactory = _ => new FileLogger<Bootstrapper>();
Stylet.Logging.LogManager.Enabled = false;
base.OnStart();
}

protected override void ConfigureIoC(IStyletIoCBuilder builder)
{
base.ConfigureIoC(builder);
Expand All @@ -32,22 +39,21 @@ protected override void ConfigureIoC(IStyletIoCBuilder builder)
builder.Bind<SettingsViewModel>().ToSelf().InSingletonScope();
builder.Bind<ISettingsTabViewModel>().ToAllImplementations().InSingletonScope();
}
protected override void Launch()

protected override void Configure()
{
GetInstance<HardwareMonitorService>().HardwareInformationUpdate(this, EventArgs.Empty);
_ = GetInstance<DialogManager>().GetViewForDialogScreen(GetInstance<SettingsViewModel>());
GetInstance<SettingsService>().Load();
base.Launch();
base.Configure();
}

protected override void OnStart()
protected override void Launch()
{
Stylet.Logging.LogManager.LoggerFactory = _ => new FileLogger<Bootstrapper>();
Stylet.Logging.LogManager.Enabled = false;
base.OnStart();
GetInstance<HardwareMonitorService>().HardwareInformationUpdate(this, EventArgs.Empty);
_ = GetInstance<DialogManager>().GetViewForDialogScreen(GetInstance<SettingsViewModel>());

base.Launch();
}

protected override void OnExit(ExitEventArgs e)
{
GetInstance<SerialMonitorService>().Dispose();
Expand Down

0 comments on commit ad1a326

Please sign in to comment.