private void PeripheralCtrl_Load(object sender, EventArgs e) { UInt16 LastErrCode; byte[] byLibVersion = new byte[PeripheralCtrl_API.IMC_LIB_VERSION_SIZE]; LastErrCode = PeripheralCtrl_API.PeripheralCtrl_GetLibVersion(byLibVersion); if (LastErrCode != IMC_ERR_NO_ERROR) { MessageBox.Show("Fails to get library version"); return; } int nRealSize; StaticLibVersionValue.Text = ConvertByte2String(byLibVersion, byLibVersion.Length, out nRealSize); // Initialize the Peripheral Control library. LastErrCode = PeripheralCtrl_API.PeripheralCtrl_Initialize(); if (LastErrCode != IMC_ERR_NO_ERROR) { MessageBox.Show("Fails to start up the PeripheralCtrl library"); return; } for (int i = 0; i < (int)PeripheralCtrl_API.PERIPHERAL_TYPE.PERIPHERAL_SIZE; i++) { ComboPeripheralCtrl.Items.Add(peripheralCtrlItemTable[i].name); } ComboPeripheralCtrl.SelectedIndex = 0; ComboPeripheralCtrlValue.Items.Add(strPeripheralCtrlValue[0]); ComboPeripheralCtrlValue.Items.Add(strPeripheralCtrlValue[1]); ComboPeripheralCtrlValue.SelectedIndex = 0; }
private void RearViewForm_Load(object sender, EventArgs e) { UInt16 LastErrCode; byte[] byLibVersion = new byte[PeripheralCtrl_API.IMC_LIB_VERSION_SIZE]; LastErrCode = PeripheralCtrl_API.PeripheralCtrl_GetLibVersion(byLibVersion); if (LastErrCode != IMC_ERR_NO_ERROR) { MessageBox.Show("Fails to get library version " + LastErrCode.ToString("X4")); return; } tbLibVersion.Text = System.Text.Encoding.Default.GetString(byLibVersion); // Initialize the Peripheral Control library. LastErrCode = PeripheralCtrl_API.PeripheralCtrl_Initialize(); if (LastErrCode != IMC_ERR_NO_ERROR) { MessageBox.Show("Fails to start up the PeripheralCtrl library " + LastErrCode.ToString("X4")); return; } byte curr_source; LastErrCode = PeripheralCtrl_API.PeripheralCtrl_GetRearViewSource(out curr_source); if (LastErrCode != IMC_ERR_NO_ERROR) { MessageBox.Show("Fails to get RearView Source " + LastErrCode.ToString("X4")); return; } SetRearViewSource(PeripheralCtrl_API.REAR_VIEW_SRC_SYSTEM); cbAutoSwitchTime.SelectedIndex = 0; int auto_switch = 0; LastErrCode = PeripheralCtrl_API.PeripheralCtrl_GetAutoRearView(out auto_switch); if (LastErrCode != IMC_ERR_NO_ERROR) { MessageBox.Show("Fails to get auto RearView " + LastErrCode.ToString("X4")); return; } if (auto_switch == 0) { checkBoxAutoSwitchBaseDI.Checked = false; } else { checkBoxAutoSwitchBaseDI.Checked = true; } init_once = true; }