From 9be8242976098c8d8dec5283c2fa380a1073a9cb Mon Sep 17 00:00:00 2001 From: A-tG Date: Sun, 24 Apr 2022 21:01:33 +0300 Subject: [PATCH] initializing static field --- VoicemeeterOsdProgram/App.xaml.cs | 2 ++ VoicemeeterOsdProgram/Globals.cs | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/VoicemeeterOsdProgram/App.xaml.cs b/VoicemeeterOsdProgram/App.xaml.cs index 8726a39..e4a20be 100644 --- a/VoicemeeterOsdProgram/App.xaml.cs +++ b/VoicemeeterOsdProgram/App.xaml.cs @@ -44,6 +44,8 @@ async void OnAppStartup(object sender, StartupEventArgs e) await ArgsHandler.HandleAsync(AppLifeManager.appArgs); // start to recieve command-line arguments from other launched instance AppLifeManager.StartArgsPipeServer(); + + Globals.Init(); // to initialize static fields } } } diff --git a/VoicemeeterOsdProgram/Globals.cs b/VoicemeeterOsdProgram/Globals.cs index 34e4648..0d34f2b 100644 --- a/VoicemeeterOsdProgram/Globals.cs +++ b/VoicemeeterOsdProgram/Globals.cs @@ -7,7 +7,7 @@ namespace VoicemeeterOsdProgram; public static class Globals { - public static readonly AutostartManager autostartManager = UtilsFactory.GetAutostartManager(); + public static readonly AutostartManager autostartManager; public static class Osd { @@ -15,4 +15,11 @@ public static class Osd public static readonly ScreenProvider screenProvider = UtilsFactory.GetOsdScreenProvider(); public static readonly ScrWorkingAreaProvider workingAreaProvider = new(screenProvider); } + + static Globals() + { + autostartManager = UtilsFactory.GetAutostartManager(); + } + + static public void Init() { } }