Exemplo n.º 1
0
        protected void btnStart_Click(object sender, EventArgs e)
        {
            cbP1.Enabled = cbP2.Enabled = cbP3.Enabled = cbP4.Enabled = btnLoadConfig.Enabled = btnStart.Enabled = cbVib.Enabled = false;
            config.ffb   = cbVib.Checked;

            if (vJP.Start(selectedPads, config, devManLevel))
            {
                gps       = new DXPadState(vJP, config);
                gps.Proxy = scpProxy;
                if ((devManLevel & DeviceManagement.Xinput_XI) == DeviceManagement.Xinput_XI)
                {
                    //TODO
                    //Is this even doable with the bugged ScpProxy.Stop()?

                    //    //SCP X360 Controller can only be disabled when
                    //    //the SCP service isn't running, so we have to
                    //    //restart the service (done in Lock_XI_Devices).
                    //    //However, ScpProxy dosn't like the service
                    //    //restart, so we need create a new instance.
                    //    dxLocker.Lock_XI_Devices();
                    //    //TODO Reinit ScpProxy (if needed)
                    //    //
                    //    gps.Proxy = scpProxy;
                }
                if ((devManLevel & DeviceManagement.Xinput_DX) == DeviceManagement.Xinput_DX)
                {
                    dxLocker.Lock_DX_Devices();
                }
                if (StandardScpStart())
                {
                    btnStop.Enabled = true;
                }
                else
                {
                    dxLocker.UnlockDevices();
                    vJP.Stop(selectedPads, devManLevel);

                    cbP1.Enabled = cbP2.Enabled = cbP3.Enabled = cbP4.Enabled = btnLoadConfig.Enabled = btnStart.Enabled = cbVib.Enabled = true;
                    MessageBox.Show(this, "Native Feed is not available", Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            else
            {
                cbP1.Enabled = cbP2.Enabled = cbP3.Enabled = cbP4.Enabled = btnLoadConfig.Enabled = btnStart.Enabled = cbVib.Enabled = true;
                MessageBox.Show(this, "Vjoy pad is not available", Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }