diff --git a/Source/LibationAvalonia/ViewModels/MainVM.Import.cs b/Source/LibationAvalonia/ViewModels/MainVM.Import.cs index fa8b6377..9947a488 100644 --- a/Source/LibationAvalonia/ViewModels/MainVM.Import.cs +++ b/Source/LibationAvalonia/ViewModels/MainVM.Import.cs @@ -68,7 +68,8 @@ namespace LibationAvalonia.ViewModels MainWindow.Loaded += (_, _) => { refreshImportMenu(); - AccountsSettingsPersister.Saved += refreshImportMenu; + AccountsSettingsPersister.Saved += (_, _) + => Avalonia.Threading.Dispatcher.UIThread.Invoke(refreshImportMenu); }; AutoScanChecked = Configuration.Instance.AutoScan; @@ -222,7 +223,7 @@ namespace LibationAvalonia.ViewModels } } - private void refreshImportMenu(object? _ = null, EventArgs? __ = null) + private void refreshImportMenu() { using var persister = AudibleApiStorage.GetAccountsSettingsPersister(); AccountsCount = persister.AccountsSettings.Accounts.Count; diff --git a/Source/LibationWinForms/Form1.ScanManual.cs b/Source/LibationWinForms/Form1.ScanManual.cs index 3aebb56d..93214d63 100644 --- a/Source/LibationWinForms/Form1.ScanManual.cs +++ b/Source/LibationWinForms/Form1.ScanManual.cs @@ -16,7 +16,7 @@ namespace LibationWinForms private void Configure_ScanManual() { this.Load += refreshImportMenu; - AccountsSettingsPersister.Saved += refreshImportMenu; + AccountsSettingsPersister.Saved += (_, _) => Invoke(refreshImportMenu, null, null); } private void refreshImportMenu(object _, EventArgs __)