public ConnectHardwareWalletViewModel(string walletName, Network network, WalletManager walletManager) { IsBusy = true; WalletName = walletName; HardwareWalletOperations = new HardwareWalletOperations(walletManager, network); HardwareWalletOperations.NoHardwareWalletFound += OnNoHardwareWalletFound; BackCommand = ReactiveCommand.Create(() => { HardwareWalletOperations.Dispose(); Navigate().Back(); }); CancelCommand = ReactiveCommand.Create(() => { HardwareWalletOperations.Dispose(); Navigate().Clear(); }); NextCommand = ReactiveCommand.Create(() => { HardwareWalletOperations.StartDetection(); ContinueButtonEnable = false; Message = ""; }); _message = ""; }
public ConnectHardwareWalletViewModel(string walletName, Network network, WalletManager walletManager) { Title = "Hardware Wallet"; _message = ""; IsBusy = true; WalletName = walletName; HardwareWalletOperations = new HardwareWalletOperations(walletManager, network); HardwareWalletOperations.NoHardwareWalletFound += OnNoHardwareWalletFound; BackCommand = ReactiveCommand.Create(() => { HardwareWalletOperations.Dispose(); Navigate().Back(); }); CancelCommand = ReactiveCommand.Create(() => { HardwareWalletOperations.Dispose(); Navigate().Clear(); }); NextCommand = ReactiveCommand.Create(() => { HardwareWalletOperations.StartDetection(); ContinueButtonEnable = false; Message = ""; }); // TODO: Create an up-to-date article OpenBrowserCommand = ReactiveCommand.CreateFromTask(async() => await IoHelpers.OpenBrowserAsync("https://docs.wasabiwallet.io/using-wasabi/ColdWasabi.html#using-hardware-wallet-step-by-step")); }
public DetectedHardwareWalletViewModel(HardwareWalletOperations hardwareWalletOperations, string walletName) { Title = "Hardware Wallet"; WalletName = walletName; Type = hardwareWalletOperations.SelectedDevice !.Model switch { HardwareWalletModels.Coldcard or HardwareWalletModels.Coldcard_Simulator => WalletType.Coldcard, HardwareWalletModels.Ledger_Nano_S => WalletType.Ledger, HardwareWalletModels.Trezor_1 or HardwareWalletModels.Trezor_1_Simulator or HardwareWalletModels.Trezor_T or HardwareWalletModels.Trezor_T_Simulator => WalletType.Trezor, _ => WalletType.Hardware, }; TypeName = hardwareWalletOperations.SelectedDevice.Model.FriendlyName(); NextCommand = ReactiveCommand.CreateFromTask(async() => { IsBusy = true; try { var km = await hardwareWalletOperations.GenerateWalletAsync(WalletName); var walletManager = hardwareWalletOperations.WalletManager; hardwareWalletOperations.Dispose(); km.SetIcon(Type); Navigate().To(new AddedWalletPageViewModel(walletManager, km)); } catch (Exception ex) { Logger.LogError(ex); await ShowErrorAsync(ex.ToUserFriendlyString(), "Error occured during adding your wallet."); Navigate().Back(); } IsBusy = false; }); NoCommand = ReactiveCommand.Create(() => Navigate().Back()); }