/// <summary> /// Item type enum /// </summary> /// <param name="type"></param> /// <returns></returns> public static string GetItemNameFromEnum(this ItemTypeEnum type) { try { var field = type.GetType().GetField(type.ToString()); var customAttr = field.GetCustomAttributes(typeof(DescriptionAttribute), false); if (customAttr.Length > 0) { return((customAttr[0] as DescriptionAttribute).Description); } return(type.ToString()); } catch (Exception) { throw; } }
public BitmapImage?imageSourceForItemType(ItemTypeEnum itemType) { var name = itemType.ToString(); var folderPath = folderPathForItemType(itemType); if (folderPath == null) { return(_backupResolver.imageSourceForItemType(itemType)); } var filename = string.Format("T_{0}_Icon_inventory", name); var path = Path.Combine(folderPath !, name, filename).Replace('\\', '/'); var fullPath = "/" + path; return(imageSource(fullPath) ?? _backupResolver.imageSourceForItemType(itemType)); }