Simplify ctor of CoinControlItemViewModel
MODIFY
WalletWasabi.Fluent/ViewModels/CoinControl/Core/CoinCoinControlItemViewModel.cs
WalletWasabi.Fluent/ViewModels/CoinControl/Core/CoinCoinControlItemViewModel.cs
+using System.Collections.Generic;
+using System.Collections.Immutable;
using NBitcoin;
using WalletWasabi.Blockchain.Analysis.Clustering;
using WalletWasabi.Blockchain.TransactionOutputs;
@@ -17,9 +19,11 @@ internal class CoinCoinControlItemViewModel : CoinControlItemViewModelBase
AnonymityScore = (int) smartCoin.HdPubKey.AnonymitySet;
Labels = smartCoin.HdPubKey.Label;
BannedUntilUtc = smartCoin.BannedUntilUtc;
+ Children = ImmutableList<CoinControlItemViewModelBase>.Empty;
}
public override DateTimeOffset? BannedUntilUtc { get; }
+ public override IReadOnlyCollection<CoinControlItemViewModelBase> Children { get; }
public override bool IsConfirmed { get; }
public override bool IsCoinjoining { get; }
public override bool IsBanned { get; }

MODIFY
WalletWasabi.Fluent/ViewModels/CoinControl/Core/CoinControlItemViewModelBase.cs
WalletWasabi.Fluent/ViewModels/CoinControl/Core/CoinControlItemViewModelBase.cs
@@ -7,20 +7,13 @@ namespace WalletWasabi.Fluent.ViewModels.CoinControl.Core;
public abstract class CoinControlItemViewModelBase
{
- protected CoinControlItemViewModelBase() : this(new List<CoinControlItemViewModelBase>()) { }
-
- protected CoinControlItemViewModelBase(IReadOnlyCollection<CoinControlItemViewModelBase> children)
- {
- Children = children;
- }
-
public bool IsPrivate => Labels == CoinPocketHelper.PrivateFundsText;
public bool IsSemiPrivate => Labels == CoinPocketHelper.SemiPrivateFundsText;
public bool IsNonPrivate => !IsSemiPrivate && !IsPrivate;
- public IReadOnlyCollection<CoinControlItemViewModelBase> Children { get; }
+ public abstract IReadOnlyCollection<CoinControlItemViewModelBase> Children { get; }
public abstract bool IsConfirmed { get; }

MODIFY
WalletWasabi.Fluent/ViewModels/CoinControl/Core/PocketCoinControlItemViewModel.cs
WalletWasabi.Fluent/ViewModels/CoinControl/Core/PocketCoinControlItemViewModel.cs
+using System.Collections.Generic;
using System.Linq;
using NBitcoin;
using WalletWasabi.Blockchain.Analysis.Clustering;
@@ -7,7 +8,7 @@ namespace WalletWasabi.Fluent.ViewModels.CoinControl.Core;
internal class PocketCoinControlItemViewModel : CoinControlItemViewModelBase
{
- public PocketCoinControlItemViewModel(Pocket pocket) : base(pocket.Coins.OrderByDescending(x => x.Amount).Select(coin => new CoinCoinControlItemViewModel(coin)).ToList())
+ public PocketCoinControlItemViewModel(Pocket pocket)
{
var confirmationCount = pocket.Coins.Count();
var unconfirmedCount = pocket.Coins.Count(x => !x.Confirmed);
@@ -18,8 +19,10 @@ internal class PocketCoinControlItemViewModel : CoinControlItemViewModelBase
IsCoinjoining = pocket.Coins.Any(x => x.CoinJoinInProgress);
AnonymityScore = (int) pocket.Coins.Max(x => x.HdPubKey.AnonymitySet);
Labels = pocket.Labels;
+ Children = pocket.Coins.OrderByDescending(x => x.Amount).Select(coin => new CoinCoinControlItemViewModel(coin)).ToList();
}
+ public override IReadOnlyCollection<CoinControlItemViewModelBase> Children { get; }
public override bool IsConfirmed { get; }
public override bool IsCoinjoining { get; }
public override bool IsBanned => false;

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Advanced/WalletCoins/WalletCoinsViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Advanced/WalletCoins/WalletCoinsViewModel.cs
@@ -131,7 +131,7 @@ public partial class WalletCoinsViewModel : RoutableViewModel
IsFixedAmount = true,
};
- Navigate().To(new TransactionPreviewViewModel(wallet, _walletVm, info));
+ Navigate().To(new TransactionPreviewViewModel(_walletVm, info));
}
private FlatTreeDataGridSource<WalletCoinViewModel> CreateGridSource(IEnumerable<WalletCoinViewModel> coins)

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/SendViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/SendViewModel.cs
@@ -117,7 +117,7 @@ public partial class SendViewModel : RoutableViewModel
IsFixedAmount = _isFixedAmount
};
- Navigate().To(new TransactionPreviewViewModel(_wallet, walletVm, transactionInfo));
+ Navigate().To(new TransactionPreviewViewModel(walletVm, transactionInfo));
},
nextCommandCanExecute);

Simplify ctor of CoinControlItemViewModel