Ejemplo n.º 1
0
        public LedBindingEditorViewModel(IServiceProvider serviceProvider, LedActionBinding actionBinding, IDeviceLed?deviceLed) : base(actionBinding, deviceLed)
        {
            _bindingActionRepository = serviceProvider.GetRequiredService <BindingActionRepository>();
            _actionBinding           = actionBinding;
            AvailableDataSources     = _bindingActionRepository.GetAll <ISimBoolSourceAction>().Select(a => new SimBoolSourceActionViewModel((ISimBoolSourceAction)a.CreateNew())).ToList();
            CommandClearDataSource   = new NotifiedRelayCommand(o => SelectedDataSource = null, o => DataSource != null, this, nameof(DataSource));

            LoadFromModel();
            EnableTouchedTracking();
        }
        public ButtonBindingEditorViewModel(IServiceProvider serviceProvider, ButtonActionBinding buttonBinding, IDeviceButton?deviceButton) : base(buttonBinding, deviceButton)
        {
            _bindingActionRepository      = serviceProvider.GetRequiredService <BindingActionRepository>();
            _buttonBinding                = buttonBinding;
            AvailableActions              = _bindingActionRepository.GetAll <ISimpleBindableAction>().Select(b => new SimpleBindableActionEditorViewModel((ISimpleBindableAction)b.CreateNew())).ToList();
            CommandClearButtonPressAction = new NotifiedRelayCommand(o => SelectedAction = null, o => ButtonPressAction != null, this, nameof(ButtonPressAction));

            LoadFromModel();
            EnableTouchedTracking();
        }
        public EncoderBindingEditorViewModel(IServiceProvider serviceProvider, EncoderActionBinding encoderBinding, IDeviceEncoder?deviceEncoder) : base(encoderBinding, deviceEncoder)
        {
            _bindingActionRepository = serviceProvider.GetRequiredService <BindingActionRepository>();
            _encoderBinding          = encoderBinding;
            IEnumerable <SimpleBindableActionEditorViewModel> availableActions = _bindingActionRepository.GetAll <ISimpleBindableAction>().Select(b => new SimpleBindableActionEditorViewModel((ISimpleBindableAction)b.CreateNew()));

            AvailableClockwiseActions       = availableActions.ToList();
            AvailableAntiClockwiseActions   = availableActions.ToList();
            CommandClearClockwiseAction     = new NotifiedRelayCommand(o => SelectedClockwiseAction = null, o => EncoderClockwiseAction != null, this, nameof(EncoderClockwiseAction));
            CommandClearAntiClockwiseAction = new NotifiedRelayCommand(o => SelectedAntiClockwiseAction = null, o => EncoderAntiClockwiseAction != null, this, nameof(EncoderAntiClockwiseAction));

            LoadFromModel();
            EnableTouchedTracking();
        }