Put CopyAddress to AddressViewModel
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/ReceiveTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/ReceiveTabViewModel.cs
@@ -29,7 +29,6 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
private AddressViewModel _selectedAddress;
private SuggestLabelViewModel _labelSuggestion;
- public ReactiveCommand<Unit, Unit> CopyAddress { get; }
public ReactiveCommand<Unit, Unit> CopyLabel { get; }
public ReactiveCommand<Unit, Unit> ChangeLabelCommand { get; }
public ReactiveCommand<Unit, Unit> DisplayAddressOnHwCommand { get; }
@@ -82,17 +81,6 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
await address.TryCopyToClipboardAsync();
});
- CopyAddress = ReactiveCommand.CreateFromTask(async () =>
- {
- var selectedAddress = SelectedAddress;
- if (selectedAddress is null)
- {
- return;
- }
-
- await selectedAddress.TryCopyToClipboardAsync();
- });
-
CopyLabel = ReactiveCommand.CreateFromTask(async () => await Application.Current.Clipboard.SetTextAsync(SelectedAddress?.Label ?? string.Empty));
ChangeLabelCommand = ReactiveCommand.Create(() =>
@@ -130,7 +118,6 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
Observable
.Merge(DisplayAddressOnHwCommand.ThrownExceptions)
.Merge(ChangeLabelCommand.ThrownExceptions)
- .Merge(CopyAddress.ThrownExceptions)
.Merge(CopyLabel.ThrownExceptions)
.Merge(GenerateCommand.ThrownExceptions)
.ObserveOn(RxApp.TaskpoolScheduler)

MODIFY
WalletWasabi.Gui/ViewModels/AddressViewModel.cs
WalletWasabi.Gui/ViewModels/AddressViewModel.cs
@@ -28,6 +28,7 @@ namespace WalletWasabi.Gui.ViewModels
private ObservableAsPropertyHelper<string> _expandMenuCaption;
public ReactiveCommand<Unit, bool> ToggleQrCode { get; }
public ReactiveCommand<Unit, Unit> SaveQRCode { get; }
+ public ReactiveCommand<Unit, Unit> CopyAddress { get; }
public HdPubKey Model { get; }
public Global Global { get; }
@@ -90,9 +91,12 @@ namespace WalletWasabi.Gui.ViewModels
SaveQRCode = ReactiveCommand.CreateFromTask(SaveQRCodeAsync);
+ CopyAddress = ReactiveCommand.CreateFromTask(TryCopyToClipboardAsync);
+
Observable
.Merge(ToggleQrCode.ThrownExceptions)
.Merge(SaveQRCode.ThrownExceptions)
+ .Merge(CopyAddress.ThrownExceptions)
.Subscribe(ex =>
{
NotificationHelpers.Error(ex.ToTypeMessageString());

Put CopyAddress to AddressViewModel