public static ImageSource Convert(CellType type)
        {
            if (!cache.TryGetValue(type, out ImageSource source))
            {
                source = new BitmapImage(new Uri("pack://application:,,,/" + Assembly.GetExecutingAssembly().GetName().Name + ";component/" + type.GetFileName(), UriKind.Absolute));

                cache.Add(type, source);
            }

            return(source);
        }
Example #2
0
        private static Image GetImage(CellType type)
        {
            Stream stream = Application.GetResourceStream(GetImageUri(type.GetFileName())).Stream;

            return(Image.FromStream(stream));
        }