public void GetDeviceListHandler(GetDeviceList get) { try { List<usbWrapper.DeviceListItem> devices = Usc.getConnectedDevices(); var response = new GetDeviceListResponseType(); response.Devices = new DeviceListItem[devices.Count]; for (int i = 0; i < devices.Count; i++) { response.Devices[i] = new DeviceListItem { DisplayName = devices[i].text, SerialNumber = devices[i].serialNumber, ProductId = devices[i].productId, Guid = devices[i].guid }; } get.ResponsePort.Post(response); } catch (Exception ex) { LogError("Error reading device list", ex); throw; } }
public void UpdateDeviceList(GetDeviceListResponseType deviceList) { var temp = DeviceSerialNumber; Devices = new ObservableCollection<DeviceListItem>(); Devices.Add(new DeviceListItem{DisplayName = "(none)"}); foreach (var item in deviceList.Devices) Devices.Add(item); DeviceSerialNumber = temp; }