Exemplo n.º 1
0
 private void Window_OnKeyUp(object sender, KeyEventArgs e)
 {
     if (e.KeyCode != Keys.Escape)
     {
         return;
     }
     Markable?.Mark(MarkerDefinitions.UserExitMarker);
     TrialTrigger?.Stop();
     UserInterrupted = true;
     SpellerController.CancelTrial();
     SpellerController.Stop();
     if (!ExperimentStarted)
     {
         Stop();
     }
 }
Exemplo n.º 2
0
        private void Tick(object state)
        {
            var position = _gazePointHandler.CurrentPosition;

            if (position == null)
            {
                _point = null;
                return;
            }
            var now = _clock.Time;

            if (_point == null)
            {
                _point = new Timestamped <Point>(now, position.Value);
                return;
            }
            var p1 = _point.Value.Value;
            var p2 = position.Value;

            if (Math.Abs(p1.X - p2.X) + Math.Abs(p1.Y - p2.Y) > _cursorMovementTolerance)
            {
                _point = new Timestamped <Point>(now, position.Value);
                if (_cancellable && _inTrial)
                {
                    _spellerController.CancelTrial();
                }
                return;
            }
            if (_inTrial)
            {
                return;
            }
            if (_clock.Unit.ToMilliseconds(Math.Abs(now - _startAt)) < _minTrialInterval)
            {
                return;
            }
            if (_clock.Unit.ToMilliseconds(Math.Abs(now - _point.Value.TimeStamp)) < _hoverToSelectDuration)
            {
                return;
            }
            _point   = new Timestamped <Point>(now, position.Value);
            _inTrial = true;
            _spellerController.CreateTrial();
        }
Exemplo n.º 3
0
        private void Tick(object state)
        {
            var position = _gazePointHandler.CurrentPosition;

            if (position == null)
            {
                Reset();
                return;
            }
            var now    = _clock.Time;
            var button = _findButtonFunc(position.Value);

            if (button != _previousHover)
            {
                _previousHover = button;
                _hoverStartAt  = now;
                if (_cancellable && _inTrial)
                {
                    _spellerController.CancelTrial();
                    Reset();
                }
                return;
            }
            if (button == null || _inTrial)
            {
                return;
            }
            if (_clock.Unit.ToMilliseconds(Math.Abs(now - _startAt)) < _minTrialInterval)
            {
                return;
            }
            if (_clock.Unit.ToMilliseconds(Math.Abs(now - _hoverStartAt)) < _hoverToSelectDuration)
            {
                return;
            }
            _inTrial = true;
            _spellerController.CreateTrial();
        }