Move SaveQRCode into AddressViewModel
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/ReceiveTabView.xaml
WalletWasabi.Gui/Controls/WalletExplorer/ReceiveTabView.xaml
<DrawingPresenter HorizontalAlignment="Left" Height="16" Width="16" Stretch="Fill" Drawing="{StaticResource ReceiveTabView_ToggleQrCode}" />
</MenuItem.Icon>
</MenuItem>
- <MenuItem Header="Save QR Code" Command="{Binding SaveQRCodeCommand}" IsVisible="{Binding SelectedAddress.IsExpanded}">
+ <MenuItem Header="Save QR Code" Command="{Binding SaveQRCode}" IsVisible="{Binding IsExpanded}">
<MenuItem.Icon>
<Path HorizontalAlignment="Left" Data="M13,9V3.5L18.5,9M6,2C4.89,2 4,2.89 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2H6Z" Stretch="Fill" Fill="#22B14C" />
</MenuItem.Icon>

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/ReceiveTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/ReceiveTabViewModel.cs
@@ -34,7 +34,6 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
public ReactiveCommand<Unit, Unit> ChangeLabelCommand { get; }
public ReactiveCommand<Unit, Unit> DisplayAddressOnHwCommand { get; }
public ReactiveCommand<Unit, Unit> GenerateCommand { get; }
- public ReactiveCommand<Unit, Unit> SaveQRCodeCommand { get; }
public ReceiveTabViewModel(WalletViewModel walletViewModel)
: base("Receive", walletViewModel)
@@ -128,24 +127,12 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
}
});
- SaveQRCodeCommand = ReactiveCommand.CreateFromTask(async () =>
- {
- var selectedAddress = SelectedAddress;
- if (selectedAddress is null)
- {
- return;
- }
-
- await selectedAddress.SaveQRCodeAsync();
- });
-
Observable
.Merge(DisplayAddressOnHwCommand.ThrownExceptions)
.Merge(ChangeLabelCommand.ThrownExceptions)
.Merge(CopyAddress.ThrownExceptions)
.Merge(CopyLabel.ThrownExceptions)
.Merge(GenerateCommand.ThrownExceptions)
- .Merge(SaveQRCodeCommand.ThrownExceptions)
.ObserveOn(RxApp.TaskpoolScheduler)
.Subscribe(ex =>
{

MODIFY
WalletWasabi.Gui/ViewModels/AddressViewModel.cs
WalletWasabi.Gui/ViewModels/AddressViewModel.cs
@@ -27,6 +27,7 @@ namespace WalletWasabi.Gui.ViewModels
private bool _inEditMode;
private ObservableAsPropertyHelper<string> _expandMenuCaption;
public ReactiveCommand<Unit, bool> ToggleQrCode { get; }
+ public ReactiveCommand<Unit, Unit> SaveQRCode { get; }
public HdPubKey Model { get; }
public Global Global { get; }
@@ -87,8 +88,11 @@ namespace WalletWasabi.Gui.ViewModels
ToggleQrCode = ReactiveCommand.Create(() => IsExpanded = !IsExpanded);
+ SaveQRCode = ReactiveCommand.CreateFromTask(SaveQRCodeAsync);
+
Observable
.Merge(ToggleQrCode.ThrownExceptions)
+ .Merge(SaveQRCode.ThrownExceptions)
.Subscribe(ex =>
{
NotificationHelpers.Error(ex.ToTypeMessageString());

Move SaveQRCode into AddressViewModel