public MissingMnemonicViewModel() { WordListsList = ListHelper.GetAllEnumValues <BIP0039.WordLists>().ToArray(); MnemonicTypesList = ListHelper.GetAllEnumValues <MnemonicTypes>().ToArray(); InputTypeList = ListHelper.GetEnumDescItems <InputType>().ToArray(); SelectedInputType = InputTypeList.First(); MnService = new MnemonicSevice(Result); IObservable <bool> isFindEnabled = this.WhenAnyValue( x => x.Mnemonic, x => x.AdditionalInfo, x => x.KeyPath, x => x.Result.CurrentState, (mn, extra, path, state) => !string.IsNullOrEmpty(mn) && !string.IsNullOrEmpty(extra) && !string.IsNullOrEmpty(path) && state != State.Working); FindCommand = ReactiveCommand.Create(Find, isFindEnabled); HasExample = true; IObservable <bool> isExampleVisible = this.WhenAnyValue( x => x.Result.CurrentState, (state) => state != State.Working && HasExample); ExampleCommand = ReactiveCommand.Create(Example, isExampleVisible); }
public MissingBip38PassViewModel() { Bip38Service = new(Result); InputTypeList = ListHelper.GetEnumDescItems(new InputType[] { InputType.PrivateKey }).ToArray(); SelectedInputType = InputTypeList.First(); PassRecoveryModeList = ListHelper.GetEnumDescItems <PassRecoveryMode>().ToArray(); SelectedPassRecoveryMode = PassRecoveryModeList.First(); IObservable <bool> isFindEnabled = this.WhenAnyValue( x => x.Bip38, x => x.CompareString, x => x.Result.CurrentState, (mn, extra, state) => !string.IsNullOrEmpty(mn) && !string.IsNullOrEmpty(extra) && state != State.Working); FindCommand = ReactiveCommand.Create(Find, isFindEnabled); this.WhenAnyValue(x => x.SelectedPassRecoveryMode.Value) .Subscribe(x => IsCheckBoxVisible = x == PassRecoveryMode.Alphanumeric); HasExample = true; IObservable <bool> isExampleVisible = this.WhenAnyValue( x => x.Result.CurrentState, (state) => state != State.Working && HasExample); ExampleCommand = ReactiveCommand.Create(Example, isExampleVisible); SetExamples(GetExampleData()); }
public MissingMnemonicPassViewModel() { WordListsList = ListHelper.GetAllEnumValues <BIP0039.WordLists>().ToArray(); MnemonicTypesList = ListHelper.GetAllEnumValues <MnemonicTypes>().ToArray(); InputTypeList = ListHelper.GetEnumDescItems <InputType>().ToArray(); SelectedInputType = InputTypeList.First(); MnService = new MnemonicExtensionService(Result); PassRecoveryModeList = ListHelper.GetEnumDescItems <PassRecoveryMode>().ToArray(); SelectedPassRecoveryMode = PassRecoveryModeList.First(); IObservable <bool> isFindEnabled = this.WhenAnyValue( x => x.Mnemonic, x => x.AdditionalInfo, x => x.KeyPath, x => x.Result.CurrentState, (mn, extra, path, state) => !string.IsNullOrEmpty(mn) && !string.IsNullOrEmpty(extra) && !string.IsNullOrEmpty(path) && state != State.Working); FindCommand = ReactiveCommand.Create(Find, isFindEnabled); this.WhenAnyValue(x => x.SelectedPassRecoveryMode.Value) .Subscribe(x => IsCheckBoxVisible = x == PassRecoveryMode.Alphanumeric); HasExample = true; IObservable <bool> isExampleVisible = this.WhenAnyValue( x => x.Result.CurrentState, (state) => state != State.Working && HasExample); ExampleCommand = ReactiveCommand.Create(Example, isExampleVisible); SetExamples(GetExampleData()); }
public MissingBip32PathViewModel() { InputTypeList = ListHelper.GetEnumDescItems <Bip32PathService.SeedType>().ToArray(); WordListsList = Enum.GetValues(typeof(BIP0039.WordLists)).Cast <BIP0039.WordLists>(); ExtraInputTypeList = ListHelper.GetEnumDescItems <InputType>(InputType.PrivateKey).ToArray(); SelectedInputType = InputTypeList.First(); SelectedExtraInputType = ExtraInputTypeList.First(); IObservable <bool> isFindEnabled = this.WhenAnyValue( x => x.Input, x => x.ExtraInput, x => x.Result.CurrentState, (input1, input2, state) => !string.IsNullOrEmpty(input1) && !string.IsNullOrEmpty(input2) && state != State.Working); FindCommand = ReactiveCommand.Create(Find, isFindEnabled); this.WhenAnyValue(x => x.SelectedInputType) .Subscribe(x => IsMnemonic = x.Value == Bip32PathService.SeedType.BIP39 || x.Value == Bip32PathService.SeedType.Electrum); PathService = new Bip32PathService(Result); HasExample = true; IObservable <bool> isExampleVisible = this.WhenAnyValue( x => x.Result.CurrentState, (state) => state != State.Working && HasExample); ExampleCommand = ReactiveCommand.Create(Example, isExampleVisible); SetExamples(GetExampleData()); }