static FieldInfo GetField(FluentIconKey iconKey) { if (!infos.ContainsKey(iconKey)) { infos[iconKey] = infoType.GetField($"{iconKey}"); } return(infos[iconKey]); }
public static ImageSource Create(FluentIconKey iconKey, Brush brush) { var geometry = FluentIconInfoAttribute.GetPathData(iconKey) ?? Geometry.Empty; var visual = new DrawingVisual(); using (var dc = visual.RenderOpen()) dc.DrawGeometry(brush, null, geometry); return(new DrawingImage(visual.Drawing)); }
public static string GetCategory(FluentIconKey iconKey) { if (iconKey == FluentIconKey.None) { return(null); } if (!(GetCustomAttribute(GetField(iconKey), type) is FluentIconInfoAttribute pathAttribute)) { return(null); } return(pathAttribute.name); }
public static Geometry GetPathData(FluentIconKey iconKey) { if (iconKey == FluentIconKey.None) { return(null); } if (geometries.ContainsKey(iconKey)) { return(geometries[iconKey]); } if (!(GetCustomAttribute(GetField(iconKey), type) is FluentIconInfoAttribute pathAttribute)) { return(null); } geometries[iconKey] = Geometry.Parse(pathAttribute.path); return(geometries[iconKey]); }
public IconInfo(FluentIconKey key) { Key = key; Name = FluentIconInfoAttribute.GetCategory(key) ?? "None"; }