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 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()); }