public Task <ConnectedDeviceDefinitionBase> GetConnectedDeviceDefinitionAsync() { if (_DeviceHandle == null) { throw new NotInitializedException(); } //TODO: Is this right? return(Task.Run <ConnectedDeviceDefinitionBase>(() => { return WindowsDeviceFactoryBase.GetDeviceDefinitionFromWindowsDeviceId(DeviceId, DeviceType.Usb, Logger); })); }
public static ConnectedDeviceDefinition GetDeviceInformation(wde.DeviceInformation deviceInformation, DeviceType deviceType) { var retVal = WindowsDeviceFactoryBase.GetDeviceDefinitionFromWindowsDeviceId(deviceInformation.Id, deviceType); //foreach (var keyValuePair in deviceInformation.Properties) //{ // if (keyValuePair.Key == ProductNamePropertyName) retVal.ProductName = (string)keyValuePair.Value; // System.Diagnostics.Debug.WriteLine($"{keyValuePair.Key} {keyValuePair.Value}"); //} retVal.ProductName = deviceInformation.Name; return(retVal); }
public static ConnectedDeviceDefinition GetDeviceInformation(wde.DeviceInformation deviceInformation, DeviceType deviceType, ILogger logger) { if (deviceInformation == null) { throw new ArgumentNullException(nameof(deviceInformation)); } var retVal = WindowsDeviceFactoryBase.GetDeviceDefinitionFromWindowsDeviceId(deviceInformation.Id, deviceType, logger); //foreach (var keyValuePair in deviceInformation.Properties) //{ // if (keyValuePair.Key == ProductNamePropertyName) retVal.ProductName = (string)keyValuePair.Value; // System.Diagnostics.Debug.WriteLine($"{keyValuePair.Key} {keyValuePair.Value}"); //} retVal.ProductName = deviceInformation.Name; return(retVal); }