Fix cross-thread error on AccoundSettings.Saved event
This commit is contained in:
parent
82a48db57b
commit
29be091a4b
@ -68,7 +68,8 @@ namespace LibationAvalonia.ViewModels
|
|||||||
MainWindow.Loaded += (_, _) =>
|
MainWindow.Loaded += (_, _) =>
|
||||||
{
|
{
|
||||||
refreshImportMenu();
|
refreshImportMenu();
|
||||||
AccountsSettingsPersister.Saved += refreshImportMenu;
|
AccountsSettingsPersister.Saved += (_, _)
|
||||||
|
=> Avalonia.Threading.Dispatcher.UIThread.Invoke(refreshImportMenu);
|
||||||
};
|
};
|
||||||
|
|
||||||
AutoScanChecked = Configuration.Instance.AutoScan;
|
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();
|
using var persister = AudibleApiStorage.GetAccountsSettingsPersister();
|
||||||
AccountsCount = persister.AccountsSettings.Accounts.Count;
|
AccountsCount = persister.AccountsSettings.Accounts.Count;
|
||||||
|
|||||||
@ -16,7 +16,7 @@ namespace LibationWinForms
|
|||||||
private void Configure_ScanManual()
|
private void Configure_ScanManual()
|
||||||
{
|
{
|
||||||
this.Load += refreshImportMenu;
|
this.Load += refreshImportMenu;
|
||||||
AccountsSettingsPersister.Saved += refreshImportMenu;
|
AccountsSettingsPersister.Saved += (_, _) => Invoke(refreshImportMenu, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refreshImportMenu(object _, EventArgs __)
|
private void refreshImportMenu(object _, EventArgs __)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user