From ad1a326e3194f307d55c44984ebd4db9e032765c Mon Sep 17 00:00:00 2001 From: TTLC198 <41226242+TTLC198@users.noreply.github.com> Date: Thu, 7 Dec 2023 15:50:40 +0300 Subject: [PATCH] Fixed the order in which services start when the application starts --- HSMonitor/Utils/Bootstrapper.cs | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/HSMonitor/Utils/Bootstrapper.cs b/HSMonitor/Utils/Bootstrapper.cs index ab3b64b..cfbb125 100644 --- a/HSMonitor/Utils/Bootstrapper.cs +++ b/HSMonitor/Utils/Bootstrapper.cs @@ -13,7 +13,14 @@ namespace HSMonitor.Utils; public class Bootstrapper : Bootstrapper { private T GetInstance() => (T) base.GetInstance(typeof(T)); - + + protected override void OnStart() + { + Stylet.Logging.LogManager.LoggerFactory = _ => new FileLogger(); + Stylet.Logging.LogManager.Enabled = false; + base.OnStart(); + } + protected override void ConfigureIoC(IStyletIoCBuilder builder) { base.ConfigureIoC(builder); @@ -32,22 +39,21 @@ protected override void ConfigureIoC(IStyletIoCBuilder builder) builder.Bind().ToSelf().InSingletonScope(); builder.Bind().ToAllImplementations().InSingletonScope(); } - - protected override void Launch() + + protected override void Configure() { - GetInstance().HardwareInformationUpdate(this, EventArgs.Empty); - _ = GetInstance().GetViewForDialogScreen(GetInstance()); GetInstance().Load(); - base.Launch(); + base.Configure(); } - protected override void OnStart() + protected override void Launch() { - Stylet.Logging.LogManager.LoggerFactory = _ => new FileLogger(); - Stylet.Logging.LogManager.Enabled = false; - base.OnStart(); + GetInstance().HardwareInformationUpdate(this, EventArgs.Empty); + _ = GetInstance().GetViewForDialogScreen(GetInstance()); + + base.Launch(); } - + protected override void OnExit(ExitEventArgs e) { GetInstance().Dispose();