Try async config in OnActivated
MODIFY
WalletWasabi.Gui/Global.cs
WalletWasabi.Gui/Global.cs
@@ -76,12 +76,12 @@ namespace WalletWasabi.Gui
public static Config Config { get; private set; }
public static UiConfig UiConfig { get; private set; }
- public static void InitializeConfigs(Config config)
+ public static void InitializeConfig(Config config)
{
Config = Guard.NotNull(nameof(config), config);
}
- public static void InitializeUiConfigs(UiConfig uiConfig)
+ public static void InitializeUiConfig(UiConfig uiConfig)
{
UiConfig = Guard.NotNull(nameof(uiConfig), uiConfig);
}

MODIFY
WalletWasabi.Gui/MainWindow.xaml.cs
WalletWasabi.Gui/MainWindow.xaml.cs
@@ -51,10 +51,18 @@ namespace WalletWasabi.Gui
await conf.ToFileAsync();
}
- private void OnActivated(object sender, EventArgs e)
+#pragma warning disable IDE1006 // Naming Styles
+
+ private async void OnActivated(object sender, EventArgs e)
+#pragma warning restore IDE1006 // Naming Styles
{
Activated -= OnActivated;
DisplayWalletManager();
+ var uiConfigFilePath = Path.Combine(Global.DataDir, "UiConfig.json");
+ var uiConfig = new UiConfig(uiConfigFilePath);
+ await uiConfig.LoadOrCreateDefaultFileAsync();
+ Logging.Logger.LogInfo<UiConfig>("UiConfig is successfully initialized.");
+ Global.InitializeUiConfig(uiConfig);
MainWindowViewModel.Instance.RefreshUiFromConfig(Global.UiConfig);
}

MODIFY
WalletWasabi.Gui/Program.cs
WalletWasabi.Gui/Program.cs
@@ -23,13 +23,8 @@ namespace WalletWasabi.Gui
{
Platform.BaseDirectory = Path.Combine(Global.DataDir, "Gui");
- var uiConfigFilePath = Path.Combine(Global.DataDir, "UiConfig.json");
- var uiConfig = new UiConfig(uiConfigFilePath);
- uiConfig.LoadOrCreateDefaultFile();
- Logger.LogInfo<UiConfig>("UiConfig is successfully initialized.");
- Global.InitializeUiConfigs(uiConfig);
-
- BuildAvaloniaApp().BeforeStarting(async builder =>
+ BuildAvaloniaApp()
+ .BeforeStarting(async builder =>
{
MainWindowViewModel.Instance = new MainWindowViewModel();
@@ -38,8 +33,7 @@ namespace WalletWasabi.Gui
await config.LoadOrCreateDefaultFileAsync();
Logger.LogInfo<Config>("Config is successfully initialized.");
- Global.InitializeConfigs(config);
- MainWindowViewModel.Instance.RefreshUiFromConfig(uiConfig);
+ Global.InitializeConfig(config);
if (!File.Exists(Global.IndexFilePath)) // Load the index file from working folder if we have it.
{

Try async config in OnActivated