private NanoDeviceBase FindNanoFrameworkDevice(string deviceId) { if (deviceId != null) { // usbMatch.Device.DeviceInformation return(NanoFrameworkDevices.FirstOrDefault(d => ((d as NanoDevice <NanoUsbDevice>).Device.DeviceInformation as UsbDeviceInformation).DeviceInformation.Id == deviceId)); } return(null); }
private NanoDeviceBase FindNanoFrameworkDevice(string deviceId) { if (deviceId != null) { // SerialMatch.Device.DeviceInformation return(NanoFrameworkDevices.FirstOrDefault(d => ((d as NanoDevice <NanoSerialDevice>).DeviceId) == deviceId)); } return(null); }
public override void DisposeDevice(string instanceId) { var deviceToDispose = NanoFrameworkDevices.FirstOrDefault(nanoDevice => ((NanoDevice <NanoSerialDevice>)nanoDevice).DeviceId == instanceId); if (deviceToDispose != null) { Task.Run(() => { ((NanoDevice <NanoSerialDevice>)deviceToDispose).Dispose(); }); } }
private NanoDeviceBase FindNanoFrameworkDevice(string deviceId) { if (deviceId != null) { // SerialMatch.Device.DeviceInformation var device = NanoFrameworkDevices.FirstOrDefault(d => ((d as NanoDevice <NanoSerialDevice>).Device.DeviceInformation as SerialDeviceInformation).DeviceInformation.Id == deviceId); if (device == null) { // try now in tentative list return(_tentativeNanoFrameworkDevices.FirstOrDefault(d => ((d as NanoDevice <NanoSerialDevice>).Device.DeviceInformation as SerialDeviceInformation).DeviceInformation.Id == deviceId)); } else { return(device); } } return(null); }