Esempio n. 1
0
 public bool SetAxisRangeMaximum(int value)
 {
     if (value < 0 + 1 || value > AxisDefaultRange.GetAxisDefaultMaximum())
     {
         return(false);
     }
     _axisMaximum = value;
     return(true);
 }
 public AxisSetLimitsEditor(IControlProcessor processor)
 {
     InitializeComponent();
     _assignedControlProcessor = processor;
     _axisMinimum = ((AxisRangeProcessor)_assignedControlProcessor).GetAxisMinimum();
     _axisMaximum = ((AxisRangeProcessor)_assignedControlProcessor).GetAxisMaximum();
     _axisCurrentPosition.Minimum = AxisDefaultRange.GetAxisDefaultMinimum();
     _axisCurrentPosition.Maximum = AxisDefaultRange.GetAxisDefaultMaximum();
     Localize();
 }
 private void ResetLimitsClick(object sender, System.Windows.RoutedEventArgs e)
 {
     if (_initializationModeOn)
     {
         _axisMinimum = (int)_axisCurrentPosition.Value;
         _axisMaximum = (int)_axisCurrentPosition.Value;
     }
     else
     {
         _axisMaximum = AxisDefaultRange.GetAxisDefaultMaximum();
         _axisMinimum = AxisDefaultRange.GetAxisDefaultMinimum();
     }
     ShowData();
 }
        /// <summary>
        /// Функция обрабатывает нажатие кнопки или кручение энкодера
        /// Для того, чтобы корректно обрабатывать галетники, функция реагирует преимущестенно на состояние "включено"
        /// </summary>
        /// <param name="controlEvent">Структура, описывающая произошедшее событие</param>
        public void OnNewControlEvent(ControlEventBase controlEvent)
        {
            var ev = controlEvent as AxisEvent;

            if (ev == null)
            {
                return;
            }
            var axisControlProcessor = _assignedControlProcessor as AxisRangeProcessor;

            if (axisControlProcessor == null)
            {
                return;
            }

            if (!_axisDebouncer.IsNeedToProcessAxisEvent(ev, 10))
            {
                return;
            }

            // Приводим 0-1023 arcc к 0-1000 роутера
            var position = axisControlProcessor.CalculateRelativeAxisPosition(AxisDefaultRange.GetAxisDefaultMinimum(), AxisDefaultRange.GetAxisDefaultMaximum(), controlEvent);

            if (_initializationModeOn)
            {
                if (position < _axisMinimum)
                {
                    _axisMinimum = position;
                    ShowData();
                }
                if (position > _axisMaximum)
                {
                    _axisMaximum = position;
                    ShowData();
                }
            }
            else
            {
                if (position < _axisMinimum)
                {
                    position = _axisMinimum;
                }
                if (position > _axisMaximum)
                {
                    position = _axisMaximum;
                }
            }
            _axisCurrentPosition.Value = position;
        }
Esempio n. 5
0
        protected override void OnNewControlEvent(ControlEventBase controlEvent)
        {
            var relativePosition   = CalculateRelativeAxisPosition(AxisDefaultRange.GetAxisDefaultMinimum(), AxisDefaultRange.GetAxisDefaultMaximum(), controlEvent);
            var positionPercentage = GetPercent(relativePosition, _axisMinimum, _axisMaximum);

            AccessDescriptor.SetPositionInPercents(positionPercentage);
        }
Esempio n. 6
0
 public void SetAxisRangeDefaults()
 {
     _axisMaximum = AxisDefaultRange.GetAxisDefaultMaximum();
     _axisMinimum = AxisDefaultRange.GetAxisDefaultMinimum();
 }