示例#1
0
 private void BtnStopClick(object sender, RoutedEventArgs e)
 {
     StopClicked?.Invoke(sender, e);
 }
示例#2
0
 private void cmdStop_Click(object sender, EventArgs e)
 {
     StopClicked?.Invoke(this, e);
     UpdateStatus("Cancelled!");
 }
示例#3
0
        public void StateChanged(object sender, XboxControllerStateChangedEventArgs e)
        {
            #region INTPUT_MAPPINGS
            //analogs
            _gamepadModel.LeftThumbstick.X  = _rangeConverter.ScaleThumbstick(e.CurrentInputState.Gamepad.sThumbLX);
            _gamepadModel.LeftThumbstick.Y  = _rangeConverter.ScaleThumbstick(e.CurrentInputState.Gamepad.sThumbLY);
            _gamepadModel.RightThumbstick.X = _rangeConverter.ScaleThumbstick(e.CurrentInputState.Gamepad.sThumbRX);
            _gamepadModel.RightThumbstick.Y = _rangeConverter.ScaleThumbstick(e.CurrentInputState.Gamepad.sThumbRY);

            //triggers are already in 0-255 range
            _gamepadModel.LeftTrigger  = e.CurrentInputState.Gamepad.bLeftTrigger;
            _gamepadModel.RightTrigger = e.CurrentInputState.Gamepad.bRightTrigger;

            //buttons - on thumbstick
            _gamepadModel.LeftThumbstick.IsPressed =
                e.CurrentInputState.Gamepad.IsButtonPressed((int)ButtonFlags.XINPUT_GAMEPAD_LEFT_THUMB);
            _gamepadModel.RightThumbstick.IsPressed =
                e.CurrentInputState.Gamepad.IsButtonPressed((int)ButtonFlags.XINPUT_GAMEPAD_RIGHT_THUMB);

            //buttons - on cross
            _gamepadModel.Cross.IsLeftPressed =
                e.CurrentInputState.Gamepad.IsButtonPressed((int)ButtonFlags.XINPUT_GAMEPAD_DPAD_LEFT);
            _gamepadModel.Cross.IsRightPressed =
                e.CurrentInputState.Gamepad.IsButtonPressed((int)ButtonFlags.XINPUT_GAMEPAD_DPAD_RIGHT);
            _gamepadModel.Cross.IsUpPressed =
                e.CurrentInputState.Gamepad.IsButtonPressed((int)ButtonFlags.XINPUT_GAMEPAD_DPAD_UP);
            _gamepadModel.Cross.IsDownPressed =
                e.CurrentInputState.Gamepad.IsButtonPressed((int)ButtonFlags.XINPUT_GAMEPAD_DPAD_DOWN);

            //buttons - on shoulder (above triggers)
            _gamepadModel.IsLeftPressed =
                e.CurrentInputState.Gamepad.IsButtonPressed((int)ButtonFlags.XINPUT_GAMEPAD_LEFT_SHOULDER);
            _gamepadModel.IsRightPressed =
                e.CurrentInputState.Gamepad.IsButtonPressed((int)ButtonFlags.XINPUT_GAMEPAD_RIGHT_SHOULDER);

            //button - colored
            _gamepadModel.ActionButtons.IsAPressed =
                e.CurrentInputState.Gamepad.IsButtonPressed((int)ButtonFlags.XINPUT_GAMEPAD_A);
            _gamepadModel.ActionButtons.IsBPressed =
                e.CurrentInputState.Gamepad.IsButtonPressed((int)ButtonFlags.XINPUT_GAMEPAD_B);
            _gamepadModel.ActionButtons.IsXPressed =
                e.CurrentInputState.Gamepad.IsButtonPressed((int)ButtonFlags.XINPUT_GAMEPAD_X);
            _gamepadModel.ActionButtons.IsYPressed =
                e.CurrentInputState.Gamepad.IsButtonPressed((int)ButtonFlags.XINPUT_GAMEPAD_Y);

            //buttons - start & back
            _gamepadModel.IsStartPressed =
                e.CurrentInputState.Gamepad.IsButtonPressed((int)ButtonFlags.XINPUT_GAMEPAD_START);
            _gamepadModel.IsBackPressed =
                e.CurrentInputState.Gamepad.IsButtonPressed((int)ButtonFlags.XINPUT_GAMEPAD_BACK);
            #endregion

            if (_gamepadModel.ActionButtons.IsBPressed)
            {
                StopClicked?.Invoke(this, EventArgs.Empty);
            }
            if (_gamepadModel.ActionButtons.IsXPressed)
            {
                AllowFullSpeedClicked?.Invoke(this, EventArgs.Empty);
            }
            if (_gamepadModel.ActionButtons.IsAPressed)
            {
                LimitSpeedClicked?.Invoke(this, EventArgs.Empty);
            }
            if (_gamepadModel.IsStartPressed)
            {
                StartClicked?.Invoke(this, EventArgs.Empty);
            }
            if (_gamepadModel.ActionButtons.IsYPressed)
            {
                BeginExperimentClicked?.Invoke(this, EventArgs.Empty);
            }

            GamepadStateChanged?.Invoke(this, new GamepadEventArgs {
                GamepadModel = _gamepadModel
            });
        }
示例#4
0
 private void HandleStopClicked(object sender, RoutedEventArgs e)
 {
     StopClicked?.Invoke(this, null);
 }
示例#5
0
 private void WhileRunningView_StopClicked(object sender, EventArgs e)
 {
     StopClicked?.Invoke(this, null);
 }