Ejemplo n.º 1
0
        public SpeedControlViewModel(IWheel Wheel)
        {
            _wheel = Wheel;

            this.WhenAnyValue(x => x.Speed,
                              speed => _wheel.Speed = speed)
                .Subscribe(s => _wheel.Speed = s);

            _wheel.Milage
                  .ToProperty(this, w => w.Disstance, out _disstance);

            ReactiveCommand<object> resetDisstanceCommand = ReactiveCommand.Create(_wheel.Milage.Select(m => m > 0).ObserveOnDispatcher());
            resetDisstanceCommand.Subscribe(_ => _wheel.Reset());
            ResetDisstance = resetDisstanceCommand;
        }