/// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { // Clear up RR3s and their resources. RedRat3USBImpl.DisposeOfAll(); if (components != null) { components.Dispose(); } } base.Dispose(disposing); }
// == Создаем объект AV-устройства, чтобы мы могли хранить данные сигнала в файле XML. //private AVDeviceDB avDeviceDB; private IRedRat3 FindRedRat3() { try { var devices = RedRat3USBImpl.FindRedRat3s(); if (devices.Length > 0) { //Возьмем первое найденное устройство. redRat3 = (IRedRat3)devices[0].GetRedRat(); //MessageBox.Show("Подключено устройство: \n\n\"" + redRat3.LocationInformation + "\"", "Проверка подключения", MessageBoxButtons.OK); } } catch (Exception ex) { new EntryPointNotFoundException("Error in search", ex).Throw(); } return(redRat3); }
/// <summary> /// Просто находит первый RedRat3, подключенный к этому компьютеру. /// </summary> public IRedRat3 FindRedRat3() { try { var devices = RedRat3USBImpl.FindDevices(); if (devices.Count > 0) { //Возьмем первое найденное устройство. redRat3 = (IRedRat3)devices[0].GetRedRat(); //MessageBox.Show("Подключено устройство: \n\n\"" + redRat3.LocationInformation + "\"", "Проверка подключения", MessageBoxButtons.OK); } } catch (Exception ex) { MessageBox.Show("Ошибка в поиске RedRat.\n" + ex.Message, "Ошибка в поиске RedRat.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } return(redRat3); }
// Просто находит первый RedRat3, подключенный к этому компьютеру. + выводит информацию public IRedRat3 FindRedRatInfo() { try { // Поис RedRat3 var devices = RedRat3USBImpl.FindDevices(); //Экземпляр метода добавления к другой строке var RedRatInfo = new StringBuilder(); if (devices.Count > 0) { // Возьмем первое найденное устройство. RedRat3 = (IRedRat3)devices[0].GetRedRat(); // Физическая информация об оборудовании USB var devInfo = (USBDeviceInfo)RedRat3.DeviceInformation; RedRatInfo.Append("RedRat подключен!"); RedRatInfo.Append("\n\nОписание:"); // Физическая позиция возвращается в объекте LocationInfo RedRatInfo.Append("\n- Location: " + RedRat3.LocationInformation); RedRatInfo.Append("\n- Info: " + devInfo); RedRatInfo.Append("\n- Hardware Version: " + devInfo.ProductName + "." + devInfo.ProductDescriptor.Version); // Информация о версии прошивки читается напрямую с RedRat3 RedRatInfo.Append("\n- Firmware Version: " + RedRat3.FirmwareVersion); RedRatInfo.Append("\n- Serial Number: " + devInfo.SerialNumber); MessageBox.Show(RedRatInfo.ToString(), "Поиск RedRat", MessageBoxButtons.OK); } else { MessageBox.Show("RedRat не найден.", "Поиск RedRat", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } catch (Exception ex) { MessageBox.Show("Ошибка поиска RedRat.\n" + ex.Message, "Поиск RedRat", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } return(RedRat3); }
protected void OpenRedRat3() { try { // Find the no. of RR3s connected. var devices = RedRat3USBImpl.FindDevices(); if (devices.Count > 0) { // Just take the first device found. redRat3 = (IRedRat3)devices[0].GetRedRat(); } else { MessageBox.Show("No RedRat3 devices found.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
// Просто находит первый RedRat3, подключенный к этому компьютеру. public IRedRat3 FindRedRat() { try { var devices = RedRat3USBImpl.FindDevices(); if (devices.Count > 0) { //Возьмем первое найденное устройство или пустоту RedRat3 = (IRedRat3)devices[0].GetRedRat(); } else { RedRat3 = null; MessageBox.Show("RedRat не найден.", "Поиск RedRat", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } catch (Exception ex) { MessageBox.Show("Ошибка поиска RedRat.\n" + ex.Message, "Поиск RedRat", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } return(RedRat3); }
/// <summary> /// Просто находит первый RedRat3, подключенный к этому компьютеру. /// </summary> public IRedRat3 FindRedRat3() { //logger.Trace("start"); try { //var devices = RedRat3USBImpl.FindDevices(); var devices = RedRat3USBImpl.FindRedRat3s(); redRat3 = (devices.Length > 0) ? (IRedRat3)devices[0].GetRedRat() : null; } catch (Exception ex) { //MessageBox.Show("Ошибка в поиске RedRat.\n" + ex.Info(), "Ошибка в поиске RedRat.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); logger.Info($"Ошибка {ex.Message}"); PublicData.write_info($"Не найден RedRat: {ex.Message}"); if (RestartRedratDevice()) { var devices = RedRat3USBImpl.FindRedRat3s(); logger.Trace($"Попытка after WinApi restart found Redrat {nameof(devices)}={devices?.Length}"); redRat3 = (devices.Length > 0) ? (IRedRat3)devices[0].GetRedRat() : null; logger.Trace("Успешно"); } } //logger.Trace("end"); return(redRat3); }
public string OpenRedRat3() { try { // Найти нет. Связанных с RedRat3 var devices = RedRat3USBImpl.FindDevices(); if (devices.Count > 0) { // Возьмем первое найденное устройство. redRat3 = (IRedRat3)devices[0].GetRedRat(); MessageBox.Show("Подключено устройство: \n\n\"" + redRat3.LocationInformation + "\"", "Проверка подключения", MessageBoxButtons.OK); } else { MessageBox.Show("Нет подключенных устройств RedRat3.", "Проверка подключения", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } catch (Exception ex) { MessageBox.Show("Ошибка в поиске RedRat.\n" + ex.Message, "Ошибка в поиске RedRat.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } return(RedRatInfo()); }
private void Setting_Load(object sender, EventArgs e) { //Image欄位// if (Directory.Exists(ini12.INIRead(MainSettingPath, "Record", "VideoPath", ""))) { textBox_ImagePath.Text = ini12.INIRead(MainSettingPath, "Record", "VideoPath", ""); } else if (ini12.INIRead(MainSettingPath, "Record", "VideoPath", "") == "") { Directory.CreateDirectory(System.Windows.Forms.Application.StartupPath + "\\Image"); textBox_ImagePath.Text = System.Windows.Forms.Application.StartupPath + "\\Image"; ini12.INIWrite(MainSettingPath, "Record", "VideoPath", textBox_ImagePath.Text.Trim()); } else { textBox_ImagePath.Text = ""; ini12.INIWrite(MainSettingPath, "Record", "VideoPath", textBox_ImagePath.Text.Trim()); pictureBox_ImagePath.Image = Properties.Resources.ERROR; } //Log欄位// if (Directory.Exists(ini12.INIRead(MainSettingPath, "Record", "LogPath", ""))) { textBox_LogPath.Text = ini12.INIRead(MainSettingPath, "Record", "LogPath", ""); } else if (ini12.INIRead(MainSettingPath, "Record", "LogPath", "") == "") { Directory.CreateDirectory(System.Windows.Forms.Application.StartupPath + "\\Log"); textBox_LogPath.Text = System.Windows.Forms.Application.StartupPath + "\\Log"; ini12.INIWrite(MainSettingPath, "Record", "LogPath", textBox_LogPath.Text.Trim()); } else { textBox_LogPath.Text = ""; ini12.INIWrite(MainSettingPath, "Record", "LogPath", textBox_LogPath.Text.Trim()); pictureBox_LogPath.Image = Properties.Resources.ERROR; } //RC DB欄位// if (File.Exists(ini12.INIRead(MainSettingPath, "RedRat", "DBFile", ""))) { textBox_RcDbPath.Text = ini12.INIRead(MainSettingPath, "RedRat", "DBFile", ""); } else { textBox_RcDbPath.Text = ""; pictureBox_RcDbPath.Image = Properties.Resources.ERROR; } //Generator欄位// if (File.Exists(ini12.INIRead(MainSettingPath, "Record", "Generator", ""))) { textBox_GeneratorPath.Text = ini12.INIRead(MainSettingPath, "Record", "Generator", ""); } else { textBox_GeneratorPath.Text = ""; pictureBox_GeneratorPath.Image = Properties.Resources.ERROR; } //DOS欄位// if (Directory.Exists(ini12.INIRead(MainSettingPath, "Device", "DOS", ""))) { textBox_DosPath.Text = ini12.INIRead(MainSettingPath, "Device", "DOS", ""); } else { textBox_DosPath.Text = ""; pictureBox_DosPath.Image = Properties.Resources.ERROR; } if (ini12.INIRead(MainSettingPath, "Record", "CANbusLog", "") == "1") { checkBox_canbus.Checked = true; } else { checkBox_canbus.Checked = false; } #region -- SerialPort -- if (ini12.INIRead(MainSettingPath, "Device", "AutoboxExist", "") == "1") { GroupBox_Rs232.Text = ini12.INIRead(MainSettingPath, "Device", "AutoboxPort", "") + " IS USING"; comboBox_SerialPort1_PortName_Value.DataSource = System.IO.Ports.SerialPort.GetPortNames(); comboBox_SerialPort2_PortName_Value.DataSource = System.IO.Ports.SerialPort.GetPortNames(); comboBox_SerialPort3_PortName_Value.DataSource = System.IO.Ports.SerialPort.GetPortNames(); comboBox_KlinePort_PortName_Value.DataSource = System.IO.Ports.SerialPort.GetPortNames(); if (ini12.INIRead(MainSettingPath, "Comport", "Checked", "") == "1") { checkBox_SerialPort1.Checked = true; comboBox_SerialPort1_VirtualPortName_Value.Enabled = true; comboBox_SerialPort1_BaudRate_Value.Enabled = true; comboBox_SerialPort1_PortName_Value.Enabled = true; } else if (ini12.INIRead(MainSettingPath, "Comport", "Checked", "") == "0") { checkBox_SerialPort1.Checked = false; comboBox_SerialPort1_VirtualPortName_Value.Enabled = false; comboBox_SerialPort1_BaudRate_Value.Enabled = false; comboBox_SerialPort1_PortName_Value.Enabled = false; } if (ini12.INIRead(MainSettingPath, "ExtComport", "Checked", "") == "1") { checkBox_SerialPort2.Checked = true; comboBox_SerialPort2_VirtualPortName_Value.Enabled = true; comboBox_SerialPort2_BaudRate_Value.Enabled = true; comboBox_SerialPort2_PortName_Value.Enabled = true; } else if (ini12.INIRead(MainSettingPath, "ExtComport", "Checked", "") == "0") { checkBox_SerialPort2.Checked = false; comboBox_SerialPort2_VirtualPortName_Value.Enabled = false; comboBox_SerialPort2_BaudRate_Value.Enabled = false; comboBox_SerialPort2_PortName_Value.Enabled = false; } if (ini12.INIRead(MainSettingPath, "TriComport", "Checked", "") == "1") { checkBox_SerialPort3.Checked = true; comboBox_SerialPort3_VirtualPortName_Value.Enabled = true; comboBox_SerialPort3_BaudRate_Value.Enabled = true; comboBox_SerialPort3_PortName_Value.Enabled = true; } else if (ini12.INIRead(MainSettingPath, "TriComport", "Checked", "") == "0") { checkBox_SerialPort3.Checked = false; comboBox_SerialPort3_VirtualPortName_Value.Enabled = false; comboBox_SerialPort3_BaudRate_Value.Enabled = false; comboBox_SerialPort3_PortName_Value.Enabled = false; } if (ini12.INIRead(MainSettingPath, "ExtComport", "Checked", "") == "1") { if (ini12.INIRead(MainSettingPath, "Displayhex", "Checked", "") == "1") { checkBox_Displayhex.Checked = true; } else if (ini12.INIRead(MainSettingPath, "Displayhex", "Checked", "") == "0") { checkBox_Displayhex.Checked = false; } } else if (ini12.INIRead(MainSettingPath, "ExtComport", "Checked", "") == "0") { checkBox_Displayhex.Checked = false; } } else if (ini12.INIRead(MainSettingPath, "Device", "AutoboxExist", "") == "0") { checkBox_SerialPort1.Checked = false; checkBox_SerialPort1.Enabled = false; comboBox_SerialPort1_VirtualPortName_Value.Enabled = false; comboBox_SerialPort1_BaudRate_Value.Enabled = false; comboBox_SerialPort1_PortName_Value.Enabled = false; checkBox_SerialPort2.Checked = false; checkBox_SerialPort2.Enabled = false; comboBox_SerialPort2_VirtualPortName_Value.Enabled = false; comboBox_SerialPort2_BaudRate_Value.Enabled = false; comboBox_SerialPort2_PortName_Value.Enabled = false; checkBox_SerialPort3.Checked = false; checkBox_SerialPort3.Enabled = false; comboBox_SerialPort3_VirtualPortName_Value.Enabled = false; comboBox_SerialPort3_BaudRate_Value.Enabled = false; comboBox_SerialPort3_PortName_Value.Enabled = false; } if (ini12.INIRead(MainSettingPath, "Kline", "Checked", "") == "1") { checkBox_Kline.Checked = true; comboBox_KlinePort_PortName_Value.Enabled = true; } else if (ini12.INIRead(MainSettingPath, "Kline", "Checked", "") == "0") { checkBox_Kline.Checked = false; comboBox_KlinePort_PortName_Value.Enabled = false; } comboBox_SerialPort1_VirtualPortName_Value.Text = ini12.INIRead(MainSettingPath, "Comport", "VirtualName", ""); comboBox_SerialPort1_BaudRate_Value.Text = ini12.INIRead(MainSettingPath, "Comport", "BaudRate", ""); comboBox_SerialPort1_PortName_Value.Text = ini12.INIRead(MainSettingPath, "Comport", "PortName", ""); comboBox_SerialPort2_VirtualPortName_Value.Text = ini12.INIRead(MainSettingPath, "ExtComport", "VirtualName", ""); comboBox_SerialPort2_BaudRate_Value.Text = ini12.INIRead(MainSettingPath, "ExtComport", "BaudRate", ""); comboBox_SerialPort2_PortName_Value.Text = ini12.INIRead(MainSettingPath, "ExtComport", "PortName", ""); comboBox_SerialPort3_VirtualPortName_Value.Text = ini12.INIRead(MainSettingPath, "TriComport", "VirtualName", ""); comboBox_SerialPort3_BaudRate_Value.Text = ini12.INIRead(MainSettingPath, "TriComport", "BaudRate", ""); comboBox_SerialPort3_PortName_Value.Text = ini12.INIRead(MainSettingPath, "TriComport", "PortName", ""); comboBox_KlinePort_PortName_Value.Text = ini12.INIRead(MainSettingPath, "Kline", "PortName", ""); #endregion #region -- Redrat -- IRedRat3 redRat3; if (ini12.INIRead(MainSettingPath, "Device", "RedRatExist", "") == "1")//Redrat存在// { for (int i = 0; i < RedRat3USBImpl.FindDevices().Count; i++) { redRat3 = (IRedRat3)RedRat3USBImpl.FindDevices()[i].GetRedRat(); comboBox__SelectRedrat.Items.Add(redRat3.DeviceInformation.ProductName + " - " + redRat3.DeviceInformation.SerialNumber.ToString()); if (ini12.INIRead(MainSettingPath, "RedRat", "SerialNumber", "") == "") { comboBox__SelectRedrat.Text = comboBox__SelectRedrat.Items[0].ToString(); } if (redRat3.DeviceInformation.ProductName + " - " + redRat3.DeviceInformation.SerialNumber.ToString() == ini12.INIRead(MainSettingPath, "RedRat", "SerialNumber", "")) { comboBox__SelectRedrat.Text = redRat3.DeviceInformation.ProductName + " - " + redRat3.DeviceInformation.SerialNumber.ToString(); } } comboBox_TvBrands.Enabled = true; comboBox__SelectRedrat.Enabled = true; } else { comboBox_TvBrands.Enabled = false; comboBox__SelectRedrat.Enabled = false; } comboBox_TvBrands.Text = ini12.INIRead(MainSettingPath, "RedRat", "Brands", ""); loadxml(); #endregion #region -- Camera -- if (ini12.INIRead(MainSettingPath, "Device", "CameraExist", "") == "1")//Camera存在// { comboBox_CameraDevice.Enabled = true; comboBox_CameraAudio.Enabled = true; Filters filters = new Filters(); Filter f; ini12.INIWrite(MainSettingPath, "Camera", "VideoNumber", filters.VideoInputDevices.Count.ToString()); ini12.INIWrite(MainSettingPath, "Camera", "AudioNumber", filters.AudioInputDevices.Count.ToString()); for (int c = 0; c < filters.VideoInputDevices.Count; c++) { f = filters.VideoInputDevices[c]; comboBox_CameraDevice.Items.Add(f.Name); if (f.Name == ini12.INIRead(MainSettingPath, "Camera", "VideoName", "")) { comboBox_CameraDevice.Text = ini12.INIRead(MainSettingPath, "Camera", "VideoName", ""); } } if (comboBox_CameraDevice.Text == "" && filters.VideoInputDevices.Count > 0) { comboBox_CameraDevice.SelectedIndex = filters.VideoInputDevices.Count - 1; ini12.INIWrite(MainSettingPath, "Camera", "VideoIndex", comboBox_CameraDevice.SelectedIndex.ToString()); ini12.INIWrite(MainSettingPath, "Camera", "VideoName", comboBox_CameraDevice.Text); } for (int j = 0; j < filters.AudioInputDevices.Count; j++) { f = filters.AudioInputDevices[j]; comboBox_CameraAudio.Items.Add(f.Name); if (f.Name == ini12.INIRead(MainSettingPath, "Camera", "AudioName", "")) { comboBox_CameraAudio.Text = ini12.INIRead(MainSettingPath, "Camera", "AudioName", ""); } } if (comboBox_CameraAudio.Text == "" && filters.AudioInputDevices.Count > 0) { comboBox_CameraAudio.SelectedIndex = filters.AudioInputDevices.Count - 1; ini12.INIWrite(MainSettingPath, "Camera", "AudioIndex", comboBox_CameraAudio.SelectedIndex.ToString()); ini12.INIWrite(MainSettingPath, "Camera", "AudioName", comboBox_CameraAudio.Text); } label_resolution.Text = ini12.INIRead(MainSettingPath, "Camera", "Resolution", ""); } else { comboBox_CameraDevice.Enabled = false; comboBox_CameraAudio.Enabled = false; } #endregion if (ini12.INIRead(MainSettingPath, "LogSearch", "TextNum", "") == "") { ini12.INIWrite(MainSettingPath, "LogSearch", "TextNum", "0"); } }
private void Setting_Load(object sender, EventArgs e) { //表單戴入時 // 設定INI檔路徑 String sPath = Application.StartupPath + "\\Config.ini"; // 讀取ini中的路徑 textBox1.Text = ini12.INIRead(sPath, "Video", "Path", ""); textBox3.Text = ini12.INIRead(sPath, "RedRatCmd", "Path", ""); string[] port1 = System.IO.Ports.SerialPort.GetPortNames(); //偵測comport>>>>>>>>>>>>>> cmbCOM.DataSource = port1; cmbCOM.Text = port1.Last(); string[] port2 = System.IO.Ports.SerialPort.GetPortNames(); extcmbCOM.DataSource = port2; extcmbCOM.Text = port2.Last(); //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< string[] devices = RedRat3USBImpl.FindRedRat3s(); if (devices.Length == 2) { comboBox5.Items.Add("1"); } else if (devices.Length == 3) { comboBox5.Items.Add("1"); comboBox5.Items.Add("2"); } if (int.Parse(ini12.INIRead(sPath, "Comport", "value", "")) == 1) { checkBox1.Checked = true; baudratebox.Enabled = true; cmbCOM.Enabled = true; } else { checkBox1.Checked = false; baudratebox.Enabled = false; cmbCOM.Enabled = false; } baudratebox.Text = ini12.INIRead(sPath, "Comport", "BaudRate", ""); cmbCOM.Text = ini12.INIRead(sPath, "Comport", "PortName", ""); if (int.Parse(ini12.INIRead(sPath, "ExtComport", "value", "")) == 1) { checkBox2.Checked = true; extbaudratebox.Enabled = true; extcmbCOM.Enabled = true; } else { checkBox2.Checked = false; extbaudratebox.Enabled = false; extcmbCOM.Enabled = false; } extbaudratebox.Text = ini12.INIRead(sPath, "ExtComport", "BaudRate", ""); extcmbCOM.Text = ini12.INIRead(sPath, "ExtComport", "PortName", ""); comboBox3.Text = ini12.INIRead(sPath, "RedCon", "value", ""); comboBox4.Text = ini12.INIRead(sPath, "camera", "value", ""); comboBox5.Text = ini12.INIRead(sPath, "RedRat", "value", ""); comboBox6.Text = ini12.INIRead(sPath, "audio", "value", ""); textBox5.Text = ini12.INIRead(sPath, "Log", "Path", ""); VIDTextBox.Text = ini12.INIRead(sPath, "camera", "VID", ""); PIDTextBox.Text = ini12.INIRead(sPath, "camera", "PID", ""); String Text; Text = ini12.INIRead(sPath, "RedRatDev", "value", ""); if (Text == "0") { label16.Text = "Disable"; comboBox3.Enabled = false; comboBox5.Enabled = false; } else { label16.Text = "Enable"; comboBox3.Enabled = true; comboBox5.Enabled = true; } Text = ini12.INIRead(sPath, "CameraDev", "value", ""); if (Text == "0") { label17.Text = "Disable"; comboBox4.Enabled = false; comboBox6.Enabled = false; } else { label17.Text = "Enable"; comboBox4.Enabled = true; comboBox6.Enabled = true; } loadxml(); if (ini12.INIRead(Application.StartupPath + "\\Config.ini", "CameraDev", "value", "") == "1") { Filters filters = new Filters(); Filter f; // 取得攝影機 for (int c = 0; c < filters.VideoInputDevices.Count; c++) { f = filters.VideoInputDevices[c]; comboBox4.Items.Add(f.Name); // if (comboBox4.Text == "") comboBox4.Text = f.Name; } for (int j = 0; j < filters.AudioInputDevices.Count; j++) { f = filters.AudioInputDevices[j]; comboBox6.Items.Add(f.Name); // if (comboBox6.Text == "") comboBox6.Text = f.Name; } } if (ini12.INIRead(Application.StartupPath + "\\Config.ini", "CameraDev", "value", "") == "1" && ini12.INIRead(Application.StartupPath + "\\Config.ini", "camera", "UserDefine", "") == "0") { VIDTextBox.Enabled = false; PIDTextBox.Enabled = false; } }
private void Setting_Load(object sender, EventArgs e) { //表單戴入時 // 設定INI檔路徑 String sPath = Application.StartupPath + "\\Config.ini"; // 讀取ini中的路徑 textBox1.Text = ini12.INIRead(sPath, "Record", "VideoPath", ""); textBox2.Text = ini12.INIRead(sPath, "Record", "Generator", ""); textBox3.Text = ini12.INIRead(sPath, "RedRat", "DBFile", ""); textBox5.Text = ini12.INIRead(sPath, "Record", "LogPath", ""); if (ini12.INIRead(Application.StartupPath + "\\Config.ini", "Device", "Autobox", "") == "1")//偵測comport>>>>>>>>>>>>>> { string[] port1 = System.IO.Ports.SerialPort.GetPortNames(); cmbCOM.DataSource = port1; cmbCOM.Text = port1.Last(); string[] port2 = System.IO.Ports.SerialPort.GetPortNames(); extcmbCOM.DataSource = port2; extcmbCOM.Text = port2.Last(); if (ini12.INIRead(sPath, "Comport", "Choose", "") != "") { if (int.Parse(ini12.INIRead(sPath, "Comport", "Choose", "")) == 1) { checkBox1.Checked = true; baudratebox.Enabled = true; cmbCOM.Enabled = true; } else { checkBox1.Checked = false; baudratebox.Enabled = false; cmbCOM.Enabled = false; } } else { ini12.INIWrite(sPath, "Comport", "Choose", "0"); ini12.INIWrite(sPath, "Comport", "BaudRate", "38400"); checkBox1.Checked = false; baudratebox.Enabled = false; cmbCOM.Enabled = false; } if (ini12.INIRead(sPath, "ExtComport", "Choose", "") != "") { if (int.Parse(ini12.INIRead(sPath, "ExtComport", "Choose", "")) == 1) { checkBox2.Checked = true; extbaudratebox.Enabled = true; extcmbCOM.Enabled = true; } else { checkBox2.Checked = false; extbaudratebox.Enabled = false; extcmbCOM.Enabled = false; } } else { ini12.INIWrite(sPath, "ExtComport", "Choose", "0"); ini12.INIWrite(sPath, "ExtComport", "BaudRate", "115200"); checkBox2.Checked = false; extbaudratebox.Enabled = false; extcmbCOM.Enabled = false; } } else if (ini12.INIRead(Application.StartupPath + "\\Config.ini", "Device", "Autobox", "") == "0") { checkBox1.Checked = false; checkBox1.Enabled = false; checkBox2.Checked = false; checkBox2.Enabled = false; }//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< string[] devices = RedRat3USBImpl.FindRedRat3s(); //偵測redrat>>>>>>>>>>>>>> if (devices.Length == 2) { comboBox5.Items.Add("1"); } else if (devices.Length == 3) { comboBox5.Items.Add("1"); comboBox5.Items.Add("2"); }//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< if (ini12.INIRead(sPath, "RedRat", "Choose", "") == "" && ini12.INIRead(sPath, "Device", "RedRat", "") == "1") { ini12.INIWrite(sPath, "RedRat", "Choose", "0"); } baudratebox.Text = ini12.INIRead(sPath, "Comport", "BaudRate", ""); cmbCOM.Text = ini12.INIRead(sPath, "Comport", "PortName", ""); extbaudratebox.Text = ini12.INIRead(sPath, "ExtComport", "BaudRate", ""); extcmbCOM.Text = ini12.INIRead(sPath, "ExtComport", "PortName", ""); comboBox3.Text = ini12.INIRead(sPath, "RedRat", "Brands", ""); comboBox5.Text = ini12.INIRead(sPath, "RedRat", "Choose", ""); comboBox4.Text = ini12.INIRead(sPath, "Camera", "Choose", ""); comboBox6.Text = ini12.INIRead(sPath, "Camera", "Audio", ""); //VIDTextlabel.Text = ini12.INIRead(sPath, "Camera", "VID", ""); //PIDTextlabel.Text = ini12.INIRead(sPath, "Camera", "PID", ""); String Text; Text = ini12.INIRead(sPath, "Device", "RedRat", ""); if (Text == "0") { label16.Text = "Disable"; comboBox3.Enabled = false; comboBox5.Enabled = false; } else { label16.Text = "Enable"; comboBox3.Enabled = true; comboBox5.Enabled = true; } Text = ini12.INIRead(sPath, "Device", "Camera", ""); if (Text == "0") { label17.Text = "Disable"; comboBox4.Enabled = false; comboBox6.Enabled = false; //comboBox1.Enabled = true; } else { label17.Text = "Enable"; comboBox4.Enabled = true; comboBox6.Enabled = true; //comboBox1.Enabled = false; } loadxml(); if (ini12.INIRead(Application.StartupPath + "\\Config.ini", "Device", "Camera", "") == "1") { Filters filters = new Filters(); Filter f; // 取得攝影機 for (int c = 0; c < filters.VideoInputDevices.Count; c++) { f = filters.VideoInputDevices[c]; comboBox4.Items.Add(f.Name); //if (comboBox4.Text == "") comboBox4.Text = f.Name; } for (int j = 0; j < filters.AudioInputDevices.Count; j++) { f = filters.AudioInputDevices[j]; comboBox6.Items.Add(f.Name); //if (comboBox6.Text == "") comboBox6.Text = f.Name; } } if (ini12.INIRead(sPath, "LogSearch", "TextNum", "") == "") { ini12.INIWrite(sPath, "LogSearch", "TextNum", "0"); } }