select the new pending transaction
MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryViewModel.cs
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
+using System.Linq;
using System.Reactive;
using System.Reactive.Concurrency;
using System.Reactive.Disposables;
@@ -24,8 +25,11 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Home.History
private readonly IObservable<Unit> _updateTrigger;
private readonly ObservableCollectionExtended<HistoryItemViewModel> _transactions;
private readonly ObservableCollectionExtended<HistoryItemViewModel> _unfilteredTransactions;
+ private readonly object _updateLock = new();
[AutoNotify] private bool _showCoinJoin;
+ [AutoNotify] private HistoryItemViewModel? _selectedItem;
+
public HistoryViewModel(WalletViewModel walletViewModel, UiConfig uiConfig, IObservable<Unit> updateTrigger)
{
@@ -43,7 +47,17 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Home.History
CollectionView = new DataGridCollectionView(Transactions);
CollectionView.SortDescriptions.Add(sortDescription);
- RxApp.MainThreadScheduler.Schedule(async () => await UpdateAsync());
+ var coinJoinFilter = this.WhenAnyValue(x => x.ShowCoinJoin)
+ .Select(CoinJoinFilter);
+
+ _transactionSourceList
+ .Connect()
+ .ObserveOn(RxApp.MainThreadScheduler)
+ .Sort(SortExpressionComparer<HistoryItemViewModel>.Descending(x => x.OrderIndex))
+ .Bind(_unfilteredTransactions)
+ .Filter(coinJoinFilter)
+ .Bind(_transactions)
+ .Subscribe();
}
public DataGridCollectionView CollectionView { get; }
@@ -56,22 +70,29 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Home.History
{
base.OnActivated(disposables);
- var coinJoinFilter = this.WhenAnyValue(x => x.ShowCoinJoin)
- .Select(CoinJoinFilter);
+ RxApp.MainThreadScheduler.Schedule(async () =>
+ {
+ await UpdateAsync();
_transactionSourceList
.Connect()
- .ObserveOn(RxApp.MainThreadScheduler)
- .Sort(SortExpressionComparer<HistoryItemViewModel>.Descending(x => x.OrderIndex))
- .Bind(_unfilteredTransactions)
- .Filter(coinJoinFilter)
- .Bind(_transactions)
+ .Throttle(TimeSpan.FromMilliseconds(100))
+ .Skip(1)
+ .OnItemAdded(_ =>
+ {
+ Console.WriteLine("Item added");
+ var newPendingItem = Transactions.OrderByDescending(x => x.OrderIndex).FirstOrDefault(x => !x.IsConfirmed);
+ SelectedItem = newPendingItem;
+ })
.Subscribe()
.DisposeWith(disposables);
+ });
_updateTrigger
.Subscribe(async _ => await UpdateAsync())
.DisposeWith(disposables);
+
+ disposables.Add(Disposable.Create(() => _transactionSourceList.Clear()));
}
private static Func<HistoryItemViewModel, bool> CoinJoinFilter(bool showCoinJoin)
@@ -93,6 +114,9 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Home.History
{
var historyBuilder = new TransactionHistoryBuilder(_walletViewModel.Wallet);
var txRecordList = await Task.Run(historyBuilder.BuildHistorySummary);
+
+ lock (_updateLock)
+ {
_transactionSourceList.Clear();
Money balance = Money.Zero;
@@ -103,6 +127,7 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Home.History
_transactionSourceList.Add(new HistoryItemViewModel(i, transactionSummary, _walletViewModel, balance, _updateTrigger));
}
}
+ }
catch (Exception ex)
{
Logger.LogError(ex);

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/WalletViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/WalletViewModel.cs
@@ -28,11 +28,11 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets
Wallet.TransactionProcessor,
nameof(Wallet.TransactionProcessor.WalletRelevantTransactionProcessed))
.Select(_ => Unit.Default)
- .Throttle(TimeSpan.FromSeconds(0.1))
.Merge(Observable.FromEventPattern(Wallet, nameof(Wallet.NewFilterProcessed))
.Select(_ => Unit.Default))
.Merge(uiConfig.WhenAnyValue(x => x.PrivacyMode).Select(_ => Unit.Default))
.Merge(Wallet.Synchronizer.WhenAnyValue(x => x.UsdExchangeRate).Select(_ => Unit.Default))
+ .Throttle(TimeSpan.FromSeconds(0.1))
.ObserveOn(RxApp.MainThreadScheduler);
History = new HistoryViewModel(this, uiConfig, balanceChanged);

MODIFY
WalletWasabi.Fluent/Views/Wallets/Home/History/HistoryTable.axaml
WalletWasabi.Fluent/Views/Wallets/Home/History/HistoryTable.axaml
</DockPanel>
<DataGrid Items="{Binding CollectionView}"
+ SelectedItem="{Binding SelectedItem}"
CanUserResizeColumns="False"
DockPanel.Dock="Bottom">
<DataGrid.Styles>

select the new pending transaction