live update newly downloaded and cached images
This commit is contained in:
parent
80b0ef600d
commit
b0139c47be
2 changed files with 39 additions and 4 deletions
|
|
@ -38,6 +38,8 @@ namespace FileManager
|
|||
timer.Elapsed += (_, __) => timerDownload();
|
||||
}
|
||||
|
||||
public static event EventHandler<string> PictureCached;
|
||||
|
||||
private static Dictionary<PictureDefinition, byte[]> cache { get; } = new Dictionary<PictureDefinition, byte[]>();
|
||||
public static (bool isDefault, byte[] bytes) GetPicture(PictureDefinition def)
|
||||
{
|
||||
|
|
@ -86,6 +88,8 @@ namespace FileManager
|
|||
var bytes = downloadBytes(def);
|
||||
saveFile(def, bytes);
|
||||
cache[def] = bytes;
|
||||
|
||||
PictureCached?.Invoke(nameof(PictureStorage), def.PictureId);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue