Ejemplo n.º 1
0
        private void mainForm_Load(object sender, EventArgs e)
        {
            try
            {
                evaDataSet.BeginInit();
                evaDataSet.EnforceConstraints = true;
                evaDataSet.ReadXml("EventAction.xml", XmlReadMode.IgnoreSchema);
                evaDataSet.EndInit();
            }
            catch
            {
                updateApplicationStatus(ApplicationState.Alert, @"Unable to read EventAction XML database.");
            }

            try
            {
                configDataSet = new DataSet();
                configDataSet.BeginInit();
                configDataSet.ReadXml("Configuration.xml");
                configDataSet.EndInit();
            }
            catch
            {
                updateApplicationStatus(ApplicationState.Alert, @"Unable to read Configuration XML database.");
            }

            try
            {
                DataTable dataTable = configDataSet.Tables["GamepadController"];
                DataRow dataRow = dataTable.Rows[0];
                int playerIndex = Convert.ToInt32(dataRow["player"]);
                gamepadController = new PG3B.Interface.GamepadController(playerIndex);
            }
            catch
            {
                updateApplicationStatus(ApplicationState.Warning, @"Unable to initialize GamePad.");
            }

            try
            {
                DataTable dataTable = configDataSet.Tables["XBoxController"];
                DataRow dataRow = dataTable.Rows[0];
                string portName = Convert.ToString(dataRow["port"]);
                xboxController = new PG3B.Interface.XBoxController(portName);
                switch (Convert.ToString(dataRow["model"]))
                {
                    case "WiredCommonLine":
                        xboxController.IsWireless = false;
                        break;
                    case "WirelessCommonGround":
                        xboxController.IsWireless = true;
                        break;
                }
            }
            catch
            {
                updateApplicationStatus(ApplicationState.Alert, @"Unable to initialize PG3B using Config.xml file.");
            }

            UpdateControllerStatus();
            InitializeSubForms();
        }
Ejemplo n.º 2
0
 private void GraphAnalogControl_Load(object sender, EventArgs e)
 {
     MainForm mainForm = Parent.Parent as MainForm;
     xboxController = mainForm.SharedXBoxController();
     gamepadController = mainForm.SharedGamepadController();
 }
Ejemplo n.º 3
0
 private void TestAndDiagnostics_Load(object sender, EventArgs e)
 {
     MainForm mainForm = Parent.Parent as MainForm;
     xboxController = mainForm.SharedXBoxController();
     gamepadController = mainForm.SharedGamepadController();
 }