Make sure selection work properly
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/HistoryTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/HistoryTabViewModel.cs
@@ -9,6 +9,7 @@ using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
+using System.Threading;
using System.Threading.Tasks;
using WalletWasabi.Models;
using WalletWasabi.Services;
@@ -21,21 +22,25 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
private TransactionViewModel _selectedTransaction;
private double _clipboardNotificationOpacity;
private bool _clipboardNotificationVisible;
+ private long _disableClipboard;
public HistoryTabViewModel(WalletViewModel walletViewModel)
: base("History", walletViewModel)
{
+ Interlocked.Exchange(ref _disableClipboard, 0);
Transactions = new ObservableCollection<TransactionViewModel>();
RewriteTable();
Global.WalletService.NewBlockProcessed += WalletService_NewBlockProcessed;
Global.WalletService.Coins.CollectionChanged += Coins_CollectionChanged;
- this.WhenAnyValue(x => x.SelectedTransaction).Subscribe(async address =>
+ this.WhenAnyValue(x => x.SelectedTransaction).Subscribe(async transaction =>
{
- if (address != null)
+ if (Interlocked.Read(ref _disableClipboard) == 0)
{
- await Application.Current.Clipboard.SetTextAsync(address.TransactionId);
+ if (transaction != null)
+ {
+ await Application.Current.Clipboard.SetTextAsync(transaction.TransactionId);
ClipboardNotificationVisible = true;
ClipboardNotificationOpacity = 1;
@@ -45,6 +50,11 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
ClipboardNotificationOpacity = 0;
});
}
+ }
+ else
+ {
+ Interlocked.Exchange(ref _disableClipboard, 0);
+ }
});
}
@@ -71,6 +81,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
}
}
+ var rememberSelectedTransactionId = SelectedTransaction?.TransactionId;
Transactions?.Clear();
foreach (var txr in txRecordList)
{
@@ -83,6 +94,16 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
};
Transactions.Add(new TransactionViewModel(txinfo));
}
+
+ if (Transactions.Count > 0 && rememberSelectedTransactionId != null)
+ {
+ var txToSelect = Transactions.FirstOrDefault(x => x.TransactionId == rememberSelectedTransactionId);
+ if (txToSelect != default)
+ {
+ Interlocked.Exchange(ref _disableClipboard, 1);
+ SelectedTransaction = txToSelect;
+ }
+ }
}
private void WalletService_NewBlockProcessed(object sender, Block e)

Make sure selection work properly