public MissingMiniPrivateKeyViewModel()
        {
            // Don't move this line, service must be instantiated here
            InputService inServ = new InputService();

            miniService = new MiniKeyService(Result);

            IObservable <bool> isFindEnabled = this.WhenAnyValue(
                x => x.Input,
                x => x.ExtraInput,
                x => x.MissingChar,
                x => x.Result.CurrentState, (miniKey, addr, c, state) =>
                !string.IsNullOrEmpty(miniKey) &&
                !string.IsNullOrEmpty(addr) &&
                inServ.IsMissingCharValid(c) &&
                state != State.Working);

            FindCommand = ReactiveCommand.Create(Find, isFindEnabled);

            HasExample = true;
            IObservable <bool> isExampleVisible = this.WhenAnyValue(
                x => x.Result.CurrentState,
                (state) => state != State.Working);

            ExampleCommand = ReactiveCommand.Create(Example, isExampleVisible);

            ExtraInputTypeList     = ListHelper.GetEnumDescItems(InputType.PrivateKey).ToArray();
            SelectedExtraInputType = ExtraInputTypeList.First();
        }
        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());
        }
Example #3
0
        public MissingArmoryViewModel()
        {
            service = new ArmoryService(Result);
            InputService inServ = new();

            IObservable <bool> isFindEnabled = this.WhenAnyValue(
                x => x.Input,
                x => x.MissingChar,
                x => x.AdditionalInput,
                x => x.Result.CurrentState,
                (b58, c, extra, state) =>
                !string.IsNullOrEmpty(b58) &&
                inServ.IsMissingCharValid(c) &&
                !string.IsNullOrEmpty(extra) &&
                state != State.Working);

            FindCommand            = ReactiveCommand.Create(Find, isFindEnabled);
            ExtraInputTypeList     = ListHelper.GetEnumDescItems <InputType>().ToArray();
            SelectedExtraInputType = ExtraInputTypeList.First();

            HasExample = true;
            IObservable <bool> isExampleEnable = this.WhenAnyValue(
                x => x.Result.CurrentState,
                (state) => state != State.Working);

            ExampleCommand = ReactiveCommand.Create(Example, isExampleEnable);

            SetExamples(GetExampleData());
        }
        public MissingBase58ViewModel()
        {
            // Don't move this line, service must be instantiated here
            var inServ = new InputService();

            b58Service = new Base58Sevice(Result);

            IObservable <bool> isFindEnabled = this.WhenAnyValue(
                x => x.Input, x => x.MissingChar,
                x => x.Result.CurrentState, (b58, c, state) =>
                !string.IsNullOrEmpty(b58) &&
                inServ.IsMissingCharValid(c) &&
                state != State.Working);

            FindCommand            = ReactiveCommand.Create(Find, isFindEnabled);
            InputTypeList          = ListHelper.GetAllEnumValues <Base58Sevice.InputType>();
            ExtraInputTypeList     = ListHelper.GetEnumDescItems(InputType.PrivateKey).ToArray();
            SelectedExtraInputType = ExtraInputTypeList.First();

            HasExample = true;
            IObservable <bool> isExampleVisible = this.WhenAnyValue(
                x => x.Result.CurrentState,
                (state) => state != State.Working);

            ExampleCommand = ReactiveCommand.Create(Example, isExampleVisible);

            SetExamples(GetExampleData());
        }