internal static void SetIcon(DeviceInformation deviceInterface, Action <ShellThumbnail> action) { if (deviceInterface.Properties.TryGetValue("System.Devices.Icon", out var value) && value is string path) { var iconIndex = ShellUtilities.ParseIconLocationPath(path, out var iconPath); if (iconPath != null) { action(new ShellThumbnail(DeviceClassFolder.NormalizeIconPath(iconPath), iconIndex)); } } }
public DeviceFolder(DeviceClassFolder parent, DeviceInformation device) : base(parent, new StringKeyShellItemId(device.Id)) { Device = device; DisplayName = device.Name; // we start hidden and will show if any deviceinterface is visible Attributes |= SFGAO.SFGAO_HIDDEN; // remove default columns we don't need here RemoveColumn(Props.System.ItemType); RemoveColumn(Props.System.Size); RemoveColumn(Props.System.DateModified); RemoveColumn(Props.System.PerceivedType); RemoveColumn(Props.System.Kind); // add these ones, already defined by Windows AddColumn(Props.System.Devices.InterfaceClassGuid, SHCOLSTATE.SHCOLSTATE_ONBYDEFAULT); AddColumn(Props.System.Devices.IsDefault, SHCOLSTATE.SHCOLSTATE_ONBYDEFAULT); AddColumn(Props.System.Devices.InterfaceEnabled, SHCOLSTATE.SHCOLSTATE_ONBYDEFAULT); AddColumn(Props.System.Devices.ContainerId, SHCOLSTATE.SHCOLSTATE_ONBYDEFAULT); }