forked from s434786/DINO_SCRUM
30 lines
853 B
C#
30 lines
853 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Media.Imaging;
|
|
|
|
namespace Magazyn.Tools
|
|
{
|
|
class CacheImage
|
|
{
|
|
static Dictionary<Uri, BitmapImage> dic = new Dictionary<Uri, BitmapImage>();
|
|
|
|
static public BitmapImage GetImageSource( Uri url )
|
|
{
|
|
if (dic.Keys.Contains<Uri>(url)) return dic[url];
|
|
else
|
|
{
|
|
BitmapImage imageSource = new BitmapImage();
|
|
imageSource.BeginInit();
|
|
imageSource.UriSource = url;
|
|
imageSource.CacheOption = BitmapCacheOption.OnLoad;
|
|
imageSource.EndInit();
|
|
dic.Add(url, imageSource);
|
|
return imageSource;
|
|
}
|
|
}
|
|
}
|
|
}
|