/// <summary> /// Send the list of commands to the ADCP. /// </summary> public void SendCommandSetCommand() { if (_serialPort != null && _serialPort.IsAvailable()) { Task.Run(() => { // Check if a conneciton could be made if (_serialPort == null || !_serialPort.IsAvailable()) { DisplayConnectionError(); } else { // Verify there are any commands if (!string.IsNullOrEmpty(_AdcpCommandSet)) { string[] result = _AdcpCommandSet.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries); // Remove all line feed, carrage returns, new lines and tabs for (int x = 0; x < result.Length; x++) { result[x] = result[x].Replace("\n", String.Empty); result[x] = result[x].Replace("\r", String.Empty); result[x] = result[x].Replace("\t", String.Empty); } _serialPort.SendCommands(result.ToList()); } } }); } else { DisplayConnectionError(); } }