/// <summary> /// Scan for any available ADCP and set the selected ADCP options. /// </summary> private void ScanForAdcp() { CommPortList = SerialOptions.PortOptions; List <AdcpSerialPort.AdcpSerialOptions> serialConnOptions = _adcpConnection.ScanSerialConnection(); // Set the first serial port to the ADCP selected options if (serialConnOptions.Count > 0) { SelectedAdcpCommPort = serialConnOptions[0].SerialOptions.Port; SelectedAdcpBaudRate = serialConnOptions[0].SerialOptions.BaudRate; // Set the ADCP serial options if (_pm.IsProjectSelected) { _pm.SelectedProject.Configuration.AdcpSerialOptions = serialConnOptions[0]; } } }
/// <summary> /// Find the ADCP connected. /// </summary> private void FindAdcp() { // Clear the current list Application.Current.Dispatcher.BeginInvoke(new System.Action(() => AdcpList.Clear())); // Find any ADCP List <AdcpSerialPort.AdcpSerialOptions> list = _adcpConn.ScanSerialConnection(); foreach (var adcp in list) { Adcps item = new Adcps(); item.SerialOptions = adcp.SerialOptions; item.Port = adcp.SerialOptions.Port; item.Baud = adcp.SerialOptions.BaudRate.ToString(); item.SerialNumber = adcp.SerialNumber.ToString(); item.Firmware = adcp.Firmware.ToString(); item.Hardware = adcp.Hardware; Application.Current.Dispatcher.BeginInvoke(new System.Action(() => { AdcpList.Add(item); AdcpList.Last().ConnectCommand.Execute(null); })); } }