Remove use of base class for expanding wallets.
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/CoinJoinTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/CoinJoinTabViewModel.cs
@@ -25,7 +25,7 @@ using WalletWasabi.Wallets;
namespace WalletWasabi.Gui.Controls.WalletExplorer
{
- public class CoinJoinTabViewModel : WasabiDocumentTabViewModel
+ public class CoinJoinTabViewModel : WasabiDocumentTabViewModel, IWalletViewModel
{
private long _roundId;
private RoundPhaseState _roundPhaseState;
@@ -133,6 +133,8 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
private Wallet Wallet { get; }
+ Wallet IWalletViewModel.Wallet => Wallet;
+
[ValidateMethod(nameof(ValidatePassword))]
public string Password
{

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/HistoryTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/HistoryTabViewModel.cs
@@ -16,7 +16,7 @@ using WalletWasabi.Wallets;
namespace WalletWasabi.Gui.Controls.WalletExplorer
{
- public class HistoryTabViewModel : WasabiDocumentTabViewModel
+ public class HistoryTabViewModel : WasabiDocumentTabViewModel, IWalletViewModel
{
private ObservableCollection<TransactionViewModel> _transactions;
private TransactionViewModel _selectedTransaction;
@@ -50,6 +50,8 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
private Wallet Wallet { get; }
+ Wallet IWalletViewModel.Wallet => Wallet;
+
public ReactiveCommand<Unit, Unit> SortCommand { get; }
public override void OnOpen(CompositeDisposable disposables)

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/ReceiveTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/ReceiveTabViewModel.cs
using Avalonia;
using Avalonia.Threading;
using ReactiveUI;
+using Splat;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -8,23 +9,17 @@ using System.Linq;
using System.Reactive;
using System.Reactive.Disposables;
using System.Reactive.Linq;
-using System.Threading;
-using System.Threading.Tasks;
using WalletWasabi.Blockchain.Analysis.Clustering;
using WalletWasabi.Blockchain.Keys;
using WalletWasabi.Gui.Helpers;
-using WalletWasabi.Gui.Tabs.WalletManager;
+using WalletWasabi.Gui.Suggestions;
using WalletWasabi.Gui.ViewModels;
using WalletWasabi.Logging;
-using WalletWasabi.Hwi;
-using WalletWasabi.Hwi.Exceptions;
-using Splat;
-using WalletWasabi.Gui.Suggestions;
using WalletWasabi.Wallets;
namespace WalletWasabi.Gui.Controls.WalletExplorer
{
- public class ReceiveTabViewModel : WasabiDocumentTabViewModel
+ public class ReceiveTabViewModel : WasabiDocumentTabViewModel, IWalletViewModel
{
private ObservableCollection<AddressViewModel> _addresses;
private AddressViewModel _selectedAddress;
@@ -95,6 +90,8 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
private Wallet Wallet { get; }
+ Wallet IWalletViewModel.Wallet => Wallet;
+
public SuggestLabelViewModel LabelSuggestion { get; }
public bool IsHardwareWallet => Wallet.KeyManager.IsHardwareWallet;

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/SendControlViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/SendControlViewModel.cs
@@ -41,11 +41,14 @@ using WalletWasabi.Wallets;
namespace WalletWasabi.Gui.Controls.WalletExplorer
{
- public abstract class SendControlViewModel : WasabiDocumentTabViewModel
+ public abstract class SendControlViewModel : WasabiDocumentTabViewModel, IWalletViewModel
{
protected Global Global { get; }
+
private Wallet Wallet { get; }
+ Wallet IWalletViewModel.Wallet => Wallet;
+
private string _buildTransactionButtonText;
private bool _isMax;
private string _amountText;

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/WalletExplorerViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/WalletExplorerViewModel.cs
@@ -93,9 +93,9 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
{
SelectedItem = x;
- if (x is WasabiWalletDocumentTabViewModel wwdtvm)
+ if (x is IWalletViewModel wvm && _walletDictionary.ContainsKey(wvm.Wallet))
{
- wwdtvm.ExpandWallet();
+ _walletDictionary[wvm.Wallet].IsExpanded = true;
}
});

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/WalletInfoViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/WalletInfoViewModel.cs
@@ -18,7 +18,7 @@ using WalletWasabi.Wallets;
namespace WalletWasabi.Gui.Controls.WalletExplorer
{
- public class WalletInfoViewModel : WasabiDocumentTabViewModel
+ public class WalletInfoViewModel : WasabiDocumentTabViewModel, IWalletViewModel
{
private bool _showSensitiveKeys;
private string _password;
@@ -71,6 +71,8 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
private Wallet Wallet { get; }
+ Wallet IWalletViewModel.Wallet => Wallet;
+
public CancellationTokenSource Closing { get; private set; }
public string ExtendedAccountPublicKey => Wallet.KeyManager.ExtPubKey.ToString(Global.Network);

MODIFY
WalletWasabi.Gui/ViewModels/WasabiDocumentTabViewModel.cs
WalletWasabi.Gui/ViewModels/WasabiDocumentTabViewModel.cs
-using Avalonia.Threading;
using AvalonStudio.Documents;
using AvalonStudio.Extensibility;
using AvalonStudio.MVVM;
@@ -6,14 +5,8 @@ using AvalonStudio.Shell;
using Dock.Model;
using ReactiveUI;
using System;
-using System.Linq;
-using System.Reactive;
using System.Reactive.Disposables;
-using System.Reactive.Linq;
using System.Threading.Tasks;
-using WalletWasabi.Gui.Tabs;
-using WalletWasabi.Helpers;
-using WalletWasabi.Logging;
namespace WalletWasabi.Gui.ViewModels
{

Remove use of base class for expanding wallets.