private void SetupBus() { if (_bus != null) { Disconnect(); _bus.PropertyChanged -= BusPropertyChanged; _bus.DeviceUpdate -= BusDeviceUpdated; _bus.ResponseReceived -= BusResponseReceived; } if (_comPort != null && _comPort.Length > 0) { switch (_type) { case EosBusType.BusMaster: _bus = new EosBusMaster(_comPort, 250000); break; case EosBusType.BusInterface: _bus = new EosBusInterfaceSerial(_comPort, 250000); break; } IsScanning = true; _bus.PropertyChanged += BusPropertyChanged; _bus.DeviceUpdate += BusDeviceUpdated; _bus.ResponseReceived += BusResponseReceived; } }