private async void OpenConnection(string port) { if (port == SimulatorPort) { var simulator = new SerialPortObdSimulator(); simulator.ShowLogging = false; this.lowcomConfig = simulator; } else { this.lowcomConfig = new LowLevelSerialPort(); this.lowcomConfig.PortName = port; } // if this.obdManager = new ObdManager(this.lowcomConfig); try { await this.obdManager.OpenConnection(); } catch (Exception ex) { log.Error("Unable to connect: ", ex); MessageBox.Show("Unable to connect: " + ex.Message); } // catch } // OpenConnection()
//// --------------------------------------------------------------------- #region CONSTRUCTION /// <summary> /// Initializes a new instance of the <see cref="ObdManager" /> class. /// </summary> /// <param name="lowLevelCommunication">The low level communication.</param> public ObdManager(ILowLevelCom lowLevelCommunication) : base(new ObdLowComDeviceConnection(lowLevelCommunication)) { if (lowLevelCommunication == null) { throw new ArgumentNullException("lowLevelCommunication"); } // if this.lowcom = lowLevelCommunication; } // ObdManager()
//// --------------------------------------------------------------------- #region CONSTRUCTION /// <summary> /// Initializes a new instance of the <see cref="ObdLowComDeviceConnection" /> class. /// </summary> /// <param name="connection">The connection.</param> public ObdLowComDeviceConnection(ILowLevelCom connection) { this.lowcom = connection; } // ObdManagerBase()