WalletExplorer manages items itself.
# Conflicts:
#	WalletWasabi.Gui/Controls/WalletExplorer/WalletExplorerViewModel.cs
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/ClosedWalletViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/ClosedWalletViewModel.cs
@@ -35,20 +35,6 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
Logger.LogError(e.Message);
}
}, this.WhenAnyValue(x => x.IsBusy).Select(x => !x));
-
- this.WhenAnyValue(x => x.WalletState)
- .Where(x => x == WalletState.Started)
- .Take(1)
- .Subscribe(x =>
- {
- var walletExplorer = IoC.Get<WalletExplorerViewModel>();
-
- var select = walletExplorer.SelectedItem == this;
-
- walletExplorer.RemoveWallet(this);
-
- walletExplorer.OpenClosedWallet(this);
- });
}
public ReactiveCommand<Unit, Unit> OpenWalletCommand { get; }

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/WalletExplorerViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/WalletExplorerViewModel.cs
@@ -44,9 +44,30 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
if (wallet is { } && _walletDictionary.ContainsKey(wallet))
{
- _walletDictionary[wallet].WalletState = x.EventArgs;
+ if (_walletDictionary[wallet] is ClosedWalletViewModel cwvm && x.EventArgs == WalletState.Started)
+ {
+ OpenClosedWallet(cwvm);
+ }
}
});
+
+ var shell = IoC.Get<IShell>();
+
+ shell.WhenAnyValue(x => x.SelectedDocument)
+ .Subscribe(x =>
+ {
+ if (x is ViewModelBase vmb)
+ {
+ SelectedItem = vmb;
+ }
+ });
+
+ this.WhenAnyValue(x => x.SelectedItem)
+ .OfType<WasabiDocumentTabViewModel>()
+ .Subscribe(x =>
+ {
+ shell.AddOrSelectDocument(x);
+ });
}
private WalletManager WalletManager { get; }
@@ -82,10 +103,12 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
}
}
- internal void OpenClosedWallet(ClosedWalletViewModel closedWalletViewModel)
+ private void OpenClosedWallet(ClosedWalletViewModel closedWalletViewModel)
{
var select = SelectedItem == closedWalletViewModel;
+ RemoveWallet(closedWalletViewModel);
+
var walletViewModel = OpenWallet(closedWalletViewModel.Wallet);
if (select)
@@ -112,6 +135,8 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
internal void RemoveWallet(WalletViewModelBase walletVM)
{
+ walletVM.Dispose();
+
Wallets.Remove(walletVM);
_walletDictionary.Remove(walletVM.Wallet);
}

WalletExplorer manages items itself.

# Conflicts:
#	WalletWasabi.Gui/Controls/WalletExplorer/WalletExplorerViewModel.cs