Remove observable
MODIFY
WalletWasabi.Fluent/ViewModels/CoinControl/CoinSelectorViewModel.cs
WalletWasabi.Fluent/ViewModels/CoinControl/CoinSelectorViewModel.cs
@@ -47,19 +47,16 @@ public partial class CoinSelectorViewModel : ViewModelBase, IDisposable
var coins = GetAllCoinItems(pocketItems);
- SelectedCoinsChanged = coins
+ coins
.AsObservableChangeSet(x => x.SmartCoin)
.AutoRefresh(x => x.IsSelected, TimeSpan.FromMilliseconds(100), scheduler: RxApp.MainThreadScheduler)
.ToCollection()
.Select(x => x.Where(m => m.IsSelected == true))
.Select(models => models.Select(x => x.SmartCoin).ToImmutableList())
- .ReplayLastActive();
-
- SelectedCoinsChanged.BindTo(this, model => model.SelectedCoins);
+ .ReplayLastActive()
+ .BindTo(this, model => model.SelectedCoins);
}
- public IObservable<IReadOnlyCollection<SmartCoin>> SelectedCoinsChanged { get; }
-
public HierarchicalTreeDataGridSource<CoinControlItemViewModelBase> TreeDataGridSource { get; }
public void Dispose()

MODIFY
WalletWasabi.Fluent/ViewModels/CoinControl/SelectCoinsDialogViewModel.cs
WalletWasabi.Fluent/ViewModels/CoinControl/SelectCoinsDialogViewModel.cs
@@ -31,8 +31,10 @@ public partial class SelectCoinsDialogViewModel : DialogViewModelBase<IEnumerabl
CoinSelector = new CoinSelectorViewModel(walletViewModel, selectedCoins);
- var requiredAmount = CoinSelector.SelectedCoinsChanged.Select(GetRequiredAmount);
- var selectedAmount = CoinSelector.SelectedCoinsChanged.Select(c => new Money(c.Sum(x => x.Amount)));
+ var coinsChanged = CoinSelector.WhenAnyValue(x => x.SelectedCoins);
+
+ var requiredAmount = coinsChanged.Select(GetRequiredAmount);
+ var selectedAmount = coinsChanged.Select(c => new Money(c.Sum(x => x.Amount)));
var remainingAmount = selectedAmount.CombineLatest(requiredAmount, (selected, required) => required - selected);
EnoughSelected = remainingAmount.Select(remaining => remaining <= Money.Zero).ReplayLastActive();

Remove observable