Put HistoryTabView context menu under DataTemplate. Put CopyTransactionId into TransactionViewModel
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/HistoryTabView.xaml
WalletWasabi.Gui/Controls/WalletExplorer/HistoryTabView.xaml
<controls:SortingArrow Grid.Column="3" Command="{Binding SortCommand}" Text="Transaction ID" SortDirection="{Binding TransactionSortDirection}" />
</Grid>
<controls:ExtendedListBox Items="{Binding Transactions}" SelectedItem="{Binding SelectedTransaction, Mode=TwoWay}">
- <controls:ExtendedListBox.ContextMenu>
+ <controls:ExtendedListBox.ItemTemplate>
+ <DataTemplate>
+ <Grid ColumnDefinitions="40, 160, 150, *">
+ <Grid.ContextMenu>
<ContextMenu>
<MenuItem Header="Copy transaction ID" Command="{Binding CopyTransactionId}">
<MenuItem.Icon>
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
- </controls:ExtendedListBox.ContextMenu>
- <controls:ExtendedListBox.ItemTemplate>
- <DataTemplate>
- <Grid ColumnDefinitions="40, 160, 150, *">
+ </Grid.ContextMenu>
<Grid.Styles>
<Style Selector="TextBlock">
<Setter Property="VerticalAlignment" Value="Center" />

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/HistoryTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/HistoryTabViewModel.cs
@@ -24,7 +24,6 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
private SortOrder _dateSortDirection;
private SortOrder _amountSortDirection;
private SortOrder _transactionSortDirection;
- public ReactiveCommand<Unit, Unit> CopyTransactionId { get; }
public ReactiveCommand<Unit, Unit> SortCommand { get; }
public HistoryTabViewModel(WalletViewModel walletViewModel)
@@ -35,20 +34,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
SortCommand = ReactiveCommand.Create(RefreshOrdering);
DateSortDirection = SortOrder.Decreasing;
- CopyTransactionId = ReactiveCommand.CreateFromTask(async () =>
- {
- var selectedTransaction = SelectedTransaction;
- if (selectedTransaction is null)
- {
- return;
- }
-
- await selectedTransaction.TryCopyTxIdToClipboardAsync();
- });
-
- Observable
- .Merge(SortCommand.ThrownExceptions)
- .Merge(CopyTransactionId.ThrownExceptions)
+ SortCommand.ThrownExceptions
.ObserveOn(RxApp.TaskpoolScheduler)
.Subscribe(ex =>
{

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/TransactionViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/TransactionViewModel.cs
@@ -4,8 +4,11 @@ using NBitcoin;
using ReactiveUI;
using System;
using System.Globalization;
+using System.Reactive;
+using System.Reactive.Linq;
using System.Threading;
using System.Threading.Tasks;
+using WalletWasabi.Gui.Helpers;
using WalletWasabi.Gui.ViewModels;
using WalletWasabi.Logging;
@@ -16,12 +19,23 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
private TransactionInfo Model { get; }
private bool _clipboardNotificationVisible;
private double _clipboardNotificationOpacity;
+ public ReactiveCommand<Unit, Unit> CopyTransactionId { get; }
public TransactionViewModel(TransactionInfo model)
{
Model = model;
ClipboardNotificationVisible = false;
ClipboardNotificationOpacity = 0;
+
+ CopyTransactionId = ReactiveCommand.CreateFromTask(TryCopyTxIdToClipboardAsync);
+
+ CopyTransactionId.ThrownExceptions
+ .ObserveOn(RxApp.TaskpoolScheduler)
+ .Subscribe(ex =>
+ {
+ NotificationHelpers.Error(ex.ToTypeMessageString());
+ Logger.LogWarning(ex);
+ });
}
public void Refresh()

Put HistoryTabView context menu under DataTemplate. Put CopyTransactionId into TransactionViewModel