Fix wallet load
MODIFY
WalletWasabi.Gui/Tabs/WalletManager/LoadWalletViewModel.cs
WalletWasabi.Gui/Tabs/WalletManager/LoadWalletViewModel.cs
@@ -262,6 +262,28 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
public ReactiveCommand<Unit, Unit> LoadCommand { get; }
public ReactiveCommand<Unit, KeyManager> TestPasswordCommand { get; }
+ private static List<HardwareWalletInfo> LastHardwareWalletEnumeration { get; } = new List<HardwareWalletInfo>();
+ private static object LastHardwareWalletEnumerationLock { get; set; } = new object();
+
+ public static IEnumerable<HardwareWalletInfo> CloneLastHardwareWalletEnumeration()
+ {
+ IEnumerable<HardwareWalletInfo> res = null;
+ lock (LastHardwareWalletEnumerationLock)
+ {
+ res = LastHardwareWalletEnumeration.ToList();
+ }
+ return res;
+ }
+
+ public static void ReplaceLastHardwareWalletEnumeration(IEnumerable<HardwareWalletInfo> hardwareWalletInfos)
+ {
+ lock (LastHardwareWalletEnumerationLock)
+ {
+ LastHardwareWalletEnumeration.Clear();
+ LastHardwareWalletEnumeration.AddRange(hardwareWalletInfos);
+ }
+ }
+
public async Task<KeyManager> LoadKeyManagerAsync(bool requirePassword, bool isHardwareWallet)
{
try
@@ -280,7 +302,7 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
HardwareWalletInfo selectedHwi = null;
if (isHardwareWallet)
{
- var lastEnumerationClone = Enumerable.Empty<HardwareWalletInfo>();//LastHardwareWalletEnumeration.ToList();
+ var lastEnumerationClone = CloneLastHardwareWalletEnumeration();
if (lastEnumerationClone.Any())
{
var trimmedSelectedWallet = SelectedWallet.Trim();

MODIFY
WalletWasabi.Gui/Tabs/WalletManager/WalletManagerViewModel.cs
WalletWasabi.Gui/Tabs/WalletManager/WalletManagerViewModel.cs
@@ -100,7 +100,6 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
});
}
- private List<HardwareWalletInfo> LastHardwareWalletEnumeration { get; set; }
private CancellationTokenSource HardwareWalletRefreshCancel { get; }
private async Task RefreshHardwareWalletListAsync()
@@ -112,6 +111,7 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
try
{
var hwis = await HwiProcessManager.EnumerateAsync();
+ LoadWalletViewModel.ReplaceLastHardwareWalletEnumeration(hwis);
var hwlist = hwis.ToList();
if (hwis.Any())
@@ -124,7 +124,7 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
}
catch (Exception ex)
{
- Logging.Logger.LogWarning<MainWindow>(ex);
+ Logger.LogWarning<MainWindow>(ex);
}
break;
@@ -138,8 +138,9 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
await Task.Delay(3000, HardwareWalletRefreshCancel.Token);
}
}
- catch (TaskCanceledException)
+ catch (TaskCanceledException ex)
{
+ Logger.LogTrace<WalletManagerViewModel>(ex);
}
}

Fix wallet load