connectReceiver() public method

public connectReceiver ( ) : void
return void
        private void Window_Main_Load(object sender, EventArgs e)
        {
            // Load the Configuration Settings
            Properties.Settings.Default.Reload();

            // Load Controller 1 Configuration
            // Keyboard Type
            xboxControllers[0].configureChatpad(Properties.Settings.Default.ctrl1KeyboardType);
            switch (Properties.Settings.Default.ctrl1KeyboardType)
            {
                case "Q W E RT Y":
                    ctrl1QwertyButton.Checked = true;
                    break;
                case "Q W E R T Z":
                    ctrl1QwertzButton.Checked = true;
                    break;
                case "A Z E R T Y":
                    ctrl1AzertyButton.Checked = true;
                    break;
                default:
                    // Use QWERTY if the configuration file has junk data
                    ctrl1QwertyButton.Checked = true;
                    break;
            }

            // Trigger Type
            xboxControllers[0].configureGamepad(Properties.Settings.Default.ctrl1TriggerAsButton);
            if (Properties.Settings.Default.ctrl1TriggerAsButton)
                ctrl1TriggerTypeBox.Checked = true;
            else
                ctrl1TriggerTypeBox.Checked = false;

            // Mouse Mode
            xboxControllers[0].mouseModeFlag = Properties.Settings.Default.ctrl1MouseMode;
            if (Properties.Settings.Default.ctrl1MouseMode)
                ctrl1MouseModeBox.Checked = true;
            else
                ctrl1MouseModeBox.Checked = false;

            // Deadzones
            ctrl1LeftDeadzone.Value = Properties.Settings.Default.ctrl1DeadzoneL;
            ctrl1RightDeadzone.Value = Properties.Settings.Default.ctrl1DeadzoneR;

            // Load Controller 2 Configuration
            // Keyboard Type
            xboxControllers[1].configureChatpad(Properties.Settings.Default.ctrl2KeyboardType);
            switch (Properties.Settings.Default.ctrl2KeyboardType)
            {
                case "Q W E RT Y":
                    ctrl2QwertyButton.Checked = true;
                    break;
                case "Q W E R T Z":
                    ctrl2QwertzButton.Checked = true;
                    break;
                case "A Z E R T Y":
                    ctrl2AzertyButton.Checked = true;
                    break;
                default:
                    // Use QWERTY if the configuration file has junk data
                    ctrl2QwertyButton.Checked = true;
                    break;
            }

            // Trigger Type
            xboxControllers[1].configureGamepad(Properties.Settings.Default.ctrl2TriggerAsButton);
            if (Properties.Settings.Default.ctrl2TriggerAsButton)
                ctrl2TriggerTypeBox.Checked = true;
            else
                ctrl2TriggerTypeBox.Checked = false;

            // Mouse Mode
            xboxControllers[1].mouseModeFlag = Properties.Settings.Default.ctrl2MouseMode;
            if (Properties.Settings.Default.ctrl2MouseMode)
                ctrl2MouseModeBox.Checked = true;
            else
                ctrl2MouseModeBox.Checked = false;

            // Deadzones
            ctrl2LeftDeadzone.Value = Properties.Settings.Default.ctrl2DeadzoneL;
            ctrl2RightDeadzone.Value = Properties.Settings.Default.ctrl2DeadzoneR;

            // Load Controller 3 Configuration
            // Keyboard Type
            xboxControllers[2].configureChatpad(Properties.Settings.Default.ctrl3KeyboardType);
            switch (Properties.Settings.Default.ctrl3KeyboardType)
            {
                case "Q W E RT Y":
                    ctrl3QwertyButton.Checked = true;
                    break;
                case "Q W E R T Z":
                    ctrl3QwertzButton.Checked = true;
                    break;
                case "A Z E R T Y":
                    ctrl3AzertyButton.Checked = true;
                    break;
                default:
                    // Use QWERTY if the configuration file has junk data
                    ctrl3QwertyButton.Checked = true;
                    break;
            }

            // Trigger Type
            xboxControllers[2].configureGamepad(Properties.Settings.Default.ctrl3TriggerAsButton);
            if (Properties.Settings.Default.ctrl3TriggerAsButton)
                ctrl3TriggerTypeBox.Checked = true;
            else
                ctrl3TriggerTypeBox.Checked = false;

            // Mouse Mode
            xboxControllers[2].mouseModeFlag = Properties.Settings.Default.ctrl3MouseMode;
            if (Properties.Settings.Default.ctrl3MouseMode)
                ctrl3MouseModeBox.Checked = true;
            else
                ctrl3MouseModeBox.Checked = false;

            // Deadzones
            ctrl3LeftDeadzone.Value = Properties.Settings.Default.ctrl3DeadzoneL;
            ctrl3RightDeadzone.Value = Properties.Settings.Default.ctrl3DeadzoneR;

            // Load Controller 4 Configuration
            // Keyboard Type
            xboxControllers[3].configureChatpad(Properties.Settings.Default.ctrl4KeyboardType);
            switch (Properties.Settings.Default.ctrl4KeyboardType)
            {
                case "Q W E RT Y":
                    ctrl4QwertyButton.Checked = true;
                    break;
                case "Q W E R T Z":
                    ctrl4QwertzButton.Checked = true;
                    break;
                case "A Z E R T Y":
                    ctrl4AzertyButton.Checked = true;
                    break;
                default:
                    // Use QWERTY if the configuration file has junk data
                    ctrl4QwertyButton.Checked = true;
                    break;
            }

            // Trigger Type
            xboxControllers[3].configureGamepad(Properties.Settings.Default.ctrl4TriggerAsButton);
            if (Properties.Settings.Default.ctrl4TriggerAsButton)
                ctrl4TriggerTypeBox.Checked = true;
            else
                ctrl4TriggerTypeBox.Checked = false;

            // Mouse Mode
            xboxControllers[3].mouseModeFlag = Properties.Settings.Default.ctrl4MouseMode;
            if (Properties.Settings.Default.ctrl4MouseMode)
                ctrl4MouseModeBox.Checked = true;
            else
                ctrl4MouseModeBox.Checked = false;

            // Deadzones
            ctrl4LeftDeadzone.Value = Properties.Settings.Default.ctrl4DeadzoneL;
            ctrl4RightDeadzone.Value = Properties.Settings.Default.ctrl4DeadzoneR;

            // Register each Controller to a vJoy Joystick
            xboxControllers[0].registerJoystick(1);
            xboxControllers[1].registerJoystick(2);
            xboxControllers[2].registerJoystick(3);
            xboxControllers[3].registerJoystick(4);

            // Instantiate and Connect to the Receiver
            xboxReceiver = new Receiver(xboxControllers, this);
            xboxReceiver.connectReceiver();
        }
Exemplo n.º 2
0
        private void Window_Main_Load(object sender, EventArgs e)
        {
            // Load the Configuration Settings
            Properties.Settings.Default.Reload();

            // Load Controller 1 Configuration
            // Keyboard Type
            xboxControllers[0].configureChatpad(Properties.Settings.Default.ctrl1KeyboardType);
            switch (Properties.Settings.Default.ctrl1KeyboardType)
            {
            case "Q W E RT Y":
                ctrl1QwertyButton.Checked = true;
                break;

            case "Q W E R T Z":
                ctrl1QwertzButton.Checked = true;
                break;

            case "A Z E R T Y":
                ctrl1AzertyButton.Checked = true;
                break;

            default:
                // Use QWERTY if the configuration file has junk data
                ctrl1QwertyButton.Checked = true;
                break;
            }

            // Trigger Type
            xboxControllers[0].configureGamepad(Properties.Settings.Default.ctrl1TriggerAsButton);
            if (Properties.Settings.Default.ctrl1TriggerAsButton)
            {
                ctrl1TriggerTypeBox.Checked = true;
            }
            else
            {
                ctrl1TriggerTypeBox.Checked = false;
            }

            // Mouse Mode
            xboxControllers[0].mouseModeFlag = Properties.Settings.Default.ctrl1MouseMode;
            if (Properties.Settings.Default.ctrl1MouseMode)
            {
                ctrl1MouseModeBox.Checked = true;
            }
            else
            {
                ctrl1MouseModeBox.Checked = false;
            }

            // Deadzones
            ctrl1LeftDeadzone.Value  = Properties.Settings.Default.ctrl1DeadzoneL;
            ctrl1RightDeadzone.Value = Properties.Settings.Default.ctrl1DeadzoneR;


            // Load Controller 2 Configuration
            // Keyboard Type
            xboxControllers[1].configureChatpad(Properties.Settings.Default.ctrl2KeyboardType);
            switch (Properties.Settings.Default.ctrl2KeyboardType)
            {
            case "Q W E RT Y":
                ctrl2QwertyButton.Checked = true;
                break;

            case "Q W E R T Z":
                ctrl2QwertzButton.Checked = true;
                break;

            case "A Z E R T Y":
                ctrl2AzertyButton.Checked = true;
                break;

            default:
                // Use QWERTY if the configuration file has junk data
                ctrl2QwertyButton.Checked = true;
                break;
            }

            // Trigger Type
            xboxControllers[1].configureGamepad(Properties.Settings.Default.ctrl2TriggerAsButton);
            if (Properties.Settings.Default.ctrl2TriggerAsButton)
            {
                ctrl2TriggerTypeBox.Checked = true;
            }
            else
            {
                ctrl2TriggerTypeBox.Checked = false;
            }

            // Mouse Mode
            xboxControllers[1].mouseModeFlag = Properties.Settings.Default.ctrl2MouseMode;
            if (Properties.Settings.Default.ctrl2MouseMode)
            {
                ctrl2MouseModeBox.Checked = true;
            }
            else
            {
                ctrl2MouseModeBox.Checked = false;
            }

            // Deadzones
            ctrl2LeftDeadzone.Value  = Properties.Settings.Default.ctrl2DeadzoneL;
            ctrl2RightDeadzone.Value = Properties.Settings.Default.ctrl2DeadzoneR;

            // Load Controller 3 Configuration
            // Keyboard Type
            xboxControllers[2].configureChatpad(Properties.Settings.Default.ctrl3KeyboardType);
            switch (Properties.Settings.Default.ctrl3KeyboardType)
            {
            case "Q W E RT Y":
                ctrl3QwertyButton.Checked = true;
                break;

            case "Q W E R T Z":
                ctrl3QwertzButton.Checked = true;
                break;

            case "A Z E R T Y":
                ctrl3AzertyButton.Checked = true;
                break;

            default:
                // Use QWERTY if the configuration file has junk data
                ctrl3QwertyButton.Checked = true;
                break;
            }

            // Trigger Type
            xboxControllers[2].configureGamepad(Properties.Settings.Default.ctrl3TriggerAsButton);
            if (Properties.Settings.Default.ctrl3TriggerAsButton)
            {
                ctrl3TriggerTypeBox.Checked = true;
            }
            else
            {
                ctrl3TriggerTypeBox.Checked = false;
            }

            // Mouse Mode
            xboxControllers[2].mouseModeFlag = Properties.Settings.Default.ctrl3MouseMode;
            if (Properties.Settings.Default.ctrl3MouseMode)
            {
                ctrl3MouseModeBox.Checked = true;
            }
            else
            {
                ctrl3MouseModeBox.Checked = false;
            }

            // Deadzones
            ctrl3LeftDeadzone.Value  = Properties.Settings.Default.ctrl3DeadzoneL;
            ctrl3RightDeadzone.Value = Properties.Settings.Default.ctrl3DeadzoneR;

            // Load Controller 4 Configuration
            // Keyboard Type
            xboxControllers[3].configureChatpad(Properties.Settings.Default.ctrl4KeyboardType);
            switch (Properties.Settings.Default.ctrl4KeyboardType)
            {
            case "Q W E RT Y":
                ctrl4QwertyButton.Checked = true;
                break;

            case "Q W E R T Z":
                ctrl4QwertzButton.Checked = true;
                break;

            case "A Z E R T Y":
                ctrl4AzertyButton.Checked = true;
                break;

            default:
                // Use QWERTY if the configuration file has junk data
                ctrl4QwertyButton.Checked = true;
                break;
            }

            // Trigger Type
            xboxControllers[3].configureGamepad(Properties.Settings.Default.ctrl4TriggerAsButton);
            if (Properties.Settings.Default.ctrl4TriggerAsButton)
            {
                ctrl4TriggerTypeBox.Checked = true;
            }
            else
            {
                ctrl4TriggerTypeBox.Checked = false;
            }

            // Mouse Mode
            xboxControllers[3].mouseModeFlag = Properties.Settings.Default.ctrl4MouseMode;
            if (Properties.Settings.Default.ctrl4MouseMode)
            {
                ctrl4MouseModeBox.Checked = true;
            }
            else
            {
                ctrl4MouseModeBox.Checked = false;
            }

            // Deadzones
            ctrl4LeftDeadzone.Value  = Properties.Settings.Default.ctrl4DeadzoneL;
            ctrl4RightDeadzone.Value = Properties.Settings.Default.ctrl4DeadzoneR;

            // Register each Controller to a vJoy Joystick
            xboxControllers[0].registerJoystick(1);
            xboxControllers[1].registerJoystick(2);
            xboxControllers[2].registerJoystick(3);
            xboxControllers[3].registerJoystick(4);

            // Instantiate and Connect to the Receiver
            xboxReceiver = new Receiver(xboxControllers, this);
            xboxReceiver.connectReceiver();
        }