Apply pattern to OnWalletOpened
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/WalletViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/WalletViewModel.cs
@@ -93,12 +93,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
public void OnWalletOpened()
{
- if (Disposables != null)
- {
- throw new Exception("Wallet was opened before last one closed.");
- }
-
- Disposables = new CompositeDisposable();
+ Disposables = Disposables is null ? new CompositeDisposable() : throw new NotSupportedException($"Cannot open {GetType().Name} before closing it.");
Observable.FromEventPattern(Global.WalletService.Coins, nameof(Global.WalletService.Coins.CollectionChanged))
.Merge(Observable.FromEventPattern(Global.WalletService, nameof(Global.WalletService.CoinSpentOrSpenderConfirmed)))

Apply pattern to OnWalletOpened