@@ -24,9 +24,9 @@ public static class ImageLoader
24
24
private static readonly ConcurrentDictionary < string , string > GuidToKey = new ( ) ;
25
25
private static IImageHashGenerator _hashGenerator ;
26
26
private static readonly bool EnableImageHash = true ;
27
- public static ImageSource Image { get ; } = new BitmapImage ( new Uri ( Constant . ImageIcon ) ) ;
28
- public static ImageSource MissingImage { get ; } = new BitmapImage ( new Uri ( Constant . MissingImgIcon ) ) ;
29
- public static ImageSource LoadingImage { get ; } = new BitmapImage ( new Uri ( Constant . LoadingImgIcon ) ) ;
27
+ public static ImageSource Image => ImageCache [ Constant . ImageIcon , false ] ;
28
+ public static ImageSource MissingImage => ImageCache [ Constant . MissingImgIcon , false ] ;
29
+ public static ImageSource LoadingImage => ImageCache [ Constant . LoadingImgIcon , false ] ;
30
30
public const int SmallIconSize = 64 ;
31
31
public const int FullIconSize = 256 ;
32
32
public const int FullImageSize = 320 ;
@@ -46,7 +46,7 @@ public static async Task InitializeAsync()
46
46
47
47
ImageCache . Initialize ( usage ) ;
48
48
49
- foreach ( var icon in new [ ] { Constant . DefaultIcon , Constant . MissingImgIcon } )
49
+ foreach ( var icon in new [ ] { Constant . DefaultIcon , Constant . ImageIcon , Constant . MissingImgIcon , Constant . LoadingImgIcon } )
50
50
{
51
51
ImageSource img = new BitmapImage ( new Uri ( icon ) ) ;
52
52
img . Freeze ( ) ;
@@ -163,7 +163,7 @@ private static async ValueTask<ImageResult> LoadInternalAsync(string path, bool
163
163
Log . Exception ( ClassName , $ "Failed to get thumbnail for { path } on first try", e ) ;
164
164
Log . Exception ( ClassName , $ "Failed to get thumbnail for { path } on second try", e2 ) ;
165
165
166
- ImageSource image = ImageCache [ Constant . MissingImgIcon , false ] ;
166
+ ImageSource image = MissingImage ;
167
167
ImageCache [ path , false ] = image ;
168
168
imageResult = new ImageResult ( image , ImageType . Error ) ;
169
169
}
@@ -262,7 +262,7 @@ private static ImageResult GetThumbnailResult(ref string path, bool loadFullImag
262
262
}
263
263
else
264
264
{
265
- image = ImageCache [ Constant . MissingImgIcon , false ] ;
265
+ image = MissingImage ;
266
266
path = Constant . MissingImgIcon ;
267
267
}
268
268
0 commit comments