Do not set IsBusy from outside in WalletViewModel
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/ClosedWalletViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/ClosedWalletViewModel.cs
@@ -18,8 +18,6 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
{
OpenWalletCommand = ReactiveCommand.CreateFromTask(async () =>
{
- IsBusy = true;
-
try
{
var global = Locator.Current.GetService<Global>();
@@ -31,10 +29,6 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
NotificationHelpers.Error($"Error loading Wallet: {Title}");
Logger.LogError(e.Message);
}
- finally
- {
- IsBusy = false;
- }
}, this.WhenAnyValue(x => x.IsBusy).Select(x => !x));
}

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/WalletViewModelBase.cs
WalletWasabi.Gui/Controls/WalletExplorer/WalletViewModelBase.cs
@@ -77,7 +77,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
public bool IsBusy
{
get => _isBusy;
- set => this.RaiseAndSetIfChanged(ref _isBusy, value);
+ private set => this.RaiseAndSetIfChanged(ref _isBusy, value);
}
public int CompareTo([AllowNull] WalletViewModelBase other)

MODIFY
WalletWasabi/Wallets/Wallet.cs
WalletWasabi/Wallets/Wallet.cs
@@ -149,11 +149,13 @@ namespace WalletWasabi.Wallets
IFeeProvider feeProvider,
CoreNode coreNode = null)
{
- if (State >= WalletState.WaitingForInit)
+ if (State > WalletState.WaitingForInit)
{
throw new InvalidOperationException($"{nameof(State)} must be {WalletState.Uninitialized} or {WalletState.WaitingForInit}. Current state: {State}.");
}
+ try
+ {
BitcoinStore = Guard.NotNull(nameof(bitcoinStore), bitcoinStore);
Nodes = Guard.NotNull(nameof(nodes), nodes);
Synchronizer = Guard.NotNull(nameof(syncer), syncer);
@@ -175,6 +177,12 @@ namespace WalletWasabi.Wallets
State = WalletState.Initialized;
}
+ catch
+ {
+ State = WalletState.Uninitialized;
+ throw;
+ }
+ }
/// <inheritdoc/>
public override async Task StartAsync(CancellationToken cancel)

MODIFY
WalletWasabi/Wallets/WalletManager.cs
WalletWasabi/Wallets/WalletManager.cs
@@ -445,7 +445,7 @@ namespace WalletWasabi.Wallets
FeeProvider = feeProvider;
BitcoinCoreNode = bitcoinCoreNode;
- foreach (var wallet in GetWallets().Where(w => w.State <= WalletState.WaitingForInit))
+ foreach (var wallet in GetWallets().Where(w => w.State == WalletState.WaitingForInit))
{
wallet.RegisterServices(BitcoinStore, Synchronizer, Nodes, ServiceConfiguration, FeeProvider, BitcoinCoreNode);
}

Do not set IsBusy from outside in WalletViewModel