Esempio n. 1
0
        public AddressLabelEditViewModel(ReceiveAddressesViewModel owner, HdPubKey hdPubKey, KeyManager keyManager, HashSet <string> suggestions)
        {
            Suggestions = suggestions;
            _labels     = new(hdPubKey.Label);

            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 });
Esempio n. 2
0
        public AddressViewModel(ReceiveAddressesViewModel parent, Wallet wallet, HdPubKey model, Network network)
        {
            _address = model.GetP2wpkhAddress(network).ToString();
            _label   = model.Label;

            CopyAddressCommand =
                ReactiveCommand.CreateFromTask(async() => await Application.Current.Clipboard.SetTextAsync(Address));
            HideAddressCommand =
                ReactiveCommand.CreateFromTask(async() => await parent.HideAddressAsync(model, Address));
            EditLabelCommand =
                ReactiveCommand.Create(() => parent.NavigateToAddressEdit(model, parent.Wallet.KeyManager));

            NavigateCommand = ReactiveCommand.Create(() =>
            {
                parent.Navigate().To(new ReceiveAddressViewModel(wallet, model));
            });
        }