private async Task <Icon> GetIconAsync(IconType iconType, int?typeId = null, string color = null) { Icon icon; var hexColor = string.Format(CultureInfo.CurrentCulture, "#{0}", color); switch (iconType) { case IconType.InstanceFolder: icon = GetDefaultIcon(ItemTypePredefined.PrimitiveFolder, hexColor); break; case IconType.Project: icon = GetDefaultIcon(ItemTypePredefined.Project, hexColor); break; case IconType.SubArtifactRoot: icon = GetDefaultIcon(ItemTypePredefined.SubArtifactGroup, hexColor); break; default: var itemTypeInfo = await GetItemTypeInfoAsync(typeId.GetValueOrDefault()); if (itemTypeInfo.HasCustomIcon) { icon = new Icon { Content = _imageService.ConvertBitmapImageToPng(itemTypeInfo.Icon, ItemTypeIconSize, ItemTypeIconSize), IsSvg = false }; } else { icon = GetDefaultIcon(itemTypeInfo.Predefined, hexColor, itemTypeInfo.IsPrimitiveType); } break; } return(icon); }