Exemplo n.º 1
0
        private void checkBox_EnableJoystick_CheckedChanged(object sender, EventArgs e)
        {
            // Start joystick emulator.

            try
            {
                joyDevice = new VJoy();
                joyDevice.Initialize();
                joyDevice.Reset();
                joyDevice.Update(0);
            }
            catch (Exception ex)
            {
                // VJoy.DLL missing from .EXE folder or project built as 'Any CPU' and DLL is 32-bit only.

                infoUpdateTimer.Enabled = false;
                MessageBox.Show(ex.Message, "VJoy Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            joyResetTimer.Enabled = true;

            // Show reminder ( if not being changed by load settings ) and save settings.

            var isChecked = ((CheckBox)sender).Checked;

            if (isChecked)
            {
                if (Properties.Settings.Default.EnableJoystick == false)
                {
                    MessageBox.Show("Actions still apply! Set 'Do Nothing' for any movement conflicts.\r\n\r\nRequires Headsoft VJoy driver to be installed.", "Reminder", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            Properties.Settings.Default.EnableJoystick = isChecked;
            Properties.Settings.Default.Save();
        }
 public override void KeyReleased(KeyPayload payload)
 {
     if (!Toggle)
     {
         CurrentState = false;
         VJoy.SetBtn(CurrentState, JoystickId, ButtonId);
         DrawState(CurrentState);
     }
 }
 public override void KeyPressed(KeyPayload payload)
 {
     if (!Toggle)
     {
         CurrentState = true;
     }
     else
     {
         CurrentState = !CurrentState;
     }
     VJoy.SetBtn(CurrentState, JoystickId, ButtonId);
     DrawState(CurrentState);
 }
        private void checkBox_EnableJoystick_CheckedChanged(object sender, EventArgs e)
        {
            try
            {
                joyDevice = new VJoy();
                joyDevice.Initialize();
                joyDevice.Reset();
                joyDevice.Update(0);
            }
            catch (Exception ex)
            {
                // VJoy.DLL missing from .EXE folder or project built as 'Any CPU' and DLL is 32-bit only.

                infoUpdateTimer.Enabled         = false;
                tray.BalloonTipTitle            = "VJoy Error";
                checkBox_EnableJoystick.Checked = false;
                tray.BalloonTipText             = ex.Message;
                tray.ShowBalloonTip(5000);
            }

            joyResetTimer.Enabled = true;

            // Show reminder ( if not being changed by load settings ) and save settings.

            var isChecked = checkBox_EnableJoystick.Checked;

            if (isChecked)
            {
                if (Properties.Settings.Default.EnableJoystick == false)
                {
                    tray.BalloonTipTitle = "Reminder";
                    tray.BalloonTipText  = "Actions still apply! Set 'Do Nothing' for any movement conflicts.\r\n\r\nRequires Headsoft VJoy driver to be installed.";
                    tray.ShowBalloonTip(5000);
                }
            }

            // Start joystick emulator.

            Properties.Settings.Default.EnableJoystick = checkBox_DisableActions.Checked;
            Properties.Settings.Default.Save();
        }