Пример #1
0
        public CombineLatestValuesAreAllViewModel(CombineLatestValuesAreAllModel _model)
        {
            Model = _model.AddTo(DisposeCollection);

            #region
            SampleNameInput =
                Model.SampleName
                .Select(n => n.Name)
                .ToReactiveProperty(null, Reactive.Bindings.ReactivePropertyMode.Default | Reactive.Bindings.ReactivePropertyMode.IgnoreInitialValidationError)
                .SetValidateNotifyError(new Func <string, string>(sampleNameValidate))
                .AddTo(DisposeCollection);

            ViewNameInput =
                Model.ViewName
                .Select(n => n.Name)
                .ToReactiveProperty(null, Reactive.Bindings.ReactivePropertyMode.Default | Reactive.Bindings.ReactivePropertyMode.IgnoreInitialValidationError)
                .SetValidateNotifyError(new Func <string, string>(viewNameValidate))
                .AddTo(DisposeCollection);

            ExecuteCommand = new ReactiveCommand().AddTo(DisposeCollection);

            ExecuteCommand
            .ObserveOnUIDispatcher()
            .Where(confirmation)
            .Where(validate)
            .Subscribe(_ => {
            }).AddTo(DisposeCollection);
            #endregion

            #region
            SampleNameInput2 =
                Model.SampleName
                .Select(n => n.Name)
                .ToReactiveProperty()
                .SetValidateNotifyError(new Func <string, string>(sampleNameValidate))
                .AddTo(DisposeCollection);

            ViewNameInput2 =
                Model.ViewName
                .Select(n => n.Name)
                .ToReactiveProperty()
                .SetValidateNotifyError(new Func <string, string>(viewNameValidate))
                .AddTo(DisposeCollection);

            ExecuteCommand2 =
                canExecuteParameters2()
                .Select(r => r.ObserveHasErrors)
                .CombineLatestValuesAreAllFalse()
                .ToReactiveCommand()
                .AddTo(DisposeCollection);

            ExecuteCommand2
            .ObserveOnUIDispatcher()
            .Where(confirmation)
            .Subscribe(_ => {
            }).AddTo(DisposeCollection);
            #endregion
        }