diff --git a/Wabbajack.Lib/LibCefHelpers/Init.cs b/Wabbajack.Lib/LibCefHelpers/Init.cs
index ff75da3f..a5885917 100644
--- a/Wabbajack.Lib/LibCefHelpers/Init.cs
+++ b/Wabbajack.Lib/LibCefHelpers/Init.cs
@@ -19,7 +19,7 @@ namespace Wabbajack.Lib.LibCefHelpers
///
/// We bundle the cef libs inside the .exe, we need to extract them before loading any wpf code that requires them
///
- public static void ExtractLibs()
+ public static async Task ExtractLibs()
{
if (File.Exists("cefglue.7z") && File.Exists("libcef.dll")) return;
@@ -30,8 +30,9 @@ namespace Wabbajack.Lib.LibCefHelpers
Utils.Log("Extracting libCef files");
}
using (var wq = new WorkQueue(1))
- FileExtractor.ExtractAll(wq, "cefglue.7z", ".");
-
+ {
+ await FileExtractor.ExtractAll(wq, "cefglue.7z", ".");
+ }
}
public static HttpClient GetClient(IEnumerable cookies, string referer)
{
diff --git a/Wabbajack.Test/ACompilerTest.cs b/Wabbajack.Test/ACompilerTest.cs
index a0dcd949..9671c281 100644
--- a/Wabbajack.Test/ACompilerTest.cs
+++ b/Wabbajack.Test/ACompilerTest.cs
@@ -13,9 +13,9 @@ namespace Wabbajack.Test
protected TestUtils utils { get; set; }
[TestInitialize]
- public void TestInitialize()
+ public async Task TestInitialize()
{
- Helpers.ExtractLibs();
+ await Helpers.ExtractLibs();
Consts.TestMode = true;
utils = new TestUtils();
diff --git a/Wabbajack.Test/DownloaderTests.cs b/Wabbajack.Test/DownloaderTests.cs
index 961c7338..f72cb650 100644
--- a/Wabbajack.Test/DownloaderTests.cs
+++ b/Wabbajack.Test/DownloaderTests.cs
@@ -24,9 +24,9 @@ namespace Wabbajack.Test
public TestContext TestContext { get; set; }
[TestInitialize]
- public void Setup()
+ public async Task Setup()
{
- Helpers.ExtractLibs();
+ await Helpers.ExtractLibs();
Utils.LogMessages.OfType().Subscribe(onNext: msg => TestContext.WriteLine(msg.ShortDescription));
Utils.LogMessages.OfType().Subscribe(msg =>
TestContext.WriteLine("ERROR: User intervetion required: " + msg.ShortDescription));
diff --git a/Wabbajack/App.xaml.cs b/Wabbajack/App.xaml.cs
index 2fd65720..1daefbf8 100644
--- a/Wabbajack/App.xaml.cs
+++ b/Wabbajack/App.xaml.cs
@@ -4,7 +4,6 @@ using System.Reflection;
using System.Windows;
using MahApps.Metro;
using Wabbajack.Common;
-using Wabbajack.Lib.LibCefHelpers;
namespace Wabbajack
{
@@ -15,7 +14,7 @@ namespace Wabbajack
{
public App()
{
- Helpers.ExtractLibs();
+ // Do initialization in MainWindow ctor
}
}
}
diff --git a/Wabbajack/Views/MainWindow.xaml.cs b/Wabbajack/Views/MainWindow.xaml.cs
index 9c9139aa..6c977944 100644
--- a/Wabbajack/Views/MainWindow.xaml.cs
+++ b/Wabbajack/Views/MainWindow.xaml.cs
@@ -1,8 +1,10 @@
using System;
using System.ComponentModel;
+using System.Threading.Tasks;
using System.Windows;
using MahApps.Metro.Controls;
using Wabbajack.Common;
+using Wabbajack.Lib.LibCefHelpers;
using Application = System.Windows.Application;
using Utils = Wabbajack.Common.Utils;
@@ -25,22 +27,26 @@ namespace Wabbajack
Wabbajack.Common.Utils.Error(((Exception)e.ExceptionObject), "Uncaught error");
};
- var appPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
- try
- {
- if (!ExtensionManager.IsAssociated() || ExtensionManager.NeedsUpdating(appPath))
- {
- ExtensionManager.Associate(appPath);
- }
- }
- catch (Exception e)
- {
- Utils.Log($"ExtensionManager had an exception:\n{e}");
- }
-
-
Wabbajack.Common.Utils.Log($"Wabbajack Build - {ThisAssembly.Git.Sha}");
+ // Run some init tasks in background
+ Task.Run(async () =>
+ {
+ await Helpers.ExtractLibs();
+ var appPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
+ try
+ {
+ if (!ExtensionManager.IsAssociated() || ExtensionManager.NeedsUpdating(appPath))
+ {
+ ExtensionManager.Associate(appPath);
+ }
+ }
+ catch (Exception e)
+ {
+ Utils.Log($"ExtensionManager had an exception:\n{e}");
+ }
+ }).FireAndForget();
+
// Load settings
string[] args = Environment.GetCommandLineArgs();
if ((args.Length > 1 && args[1] == "nosettings")