do not allow save when empty
MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Receive/AddressLabelEditViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Receive/AddressLabelEditViewModel.cs
+using System;
using System.Collections.ObjectModel;
+using System.Reactive.Linq;
using ReactiveUI;
using WalletWasabi.Blockchain.Analysis.Clustering;
using WalletWasabi.Blockchain.Keys;
@@ -10,6 +12,7 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Receive
public partial class AddressLabelEditViewModel : RoutableViewModel
{
[AutoNotify] private ObservableCollection<string> _labels;
+ [AutoNotify] private SmartLabel? _finalLabel;
public AddressLabelEditViewModel(ReceiveAddressesViewModel owner, HdPubKey hdPubKey, KeyManager keyManager)
{
@@ -17,12 +20,19 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Receive
SetupCancel(enableCancel: true, enableCancelOnEscape: true, enableCancelOnPressed: true);
+ Labels
+ .WhenAnyValue(x => x.Count)
+ .ObserveOn(RxApp.MainThreadScheduler)
+ .Subscribe(_ => { FinalLabel = new SmartLabel(Labels); });
+
+ var canExecute = this.WhenAnyValue(x => x.FinalLabel).Select(x => x is {IsEmpty: false});
+
NextCommand = ReactiveCommand.Create(() =>
{
hdPubKey.SetLabel(new SmartLabel(Labels), kmToFile: keyManager);
owner.InitializeAddresses();
Navigate().Back();
- });
+ }, canExecute);
}
}
}

do not allow save when empty