示例#1
0
        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);
        }
示例#3
0
        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);
        }