optimize<Avatar>: cache downloading failed avatars

This commit is contained in:
leo 2021-04-04 13:48:27 +08:00
parent fa3ff6f2db
commit f4ab97c088

View file

@ -190,15 +190,20 @@ namespace SourceGit.Helpers {
reader.CopyTo(writer);
}
if (requesting.ContainsKey(email)) {
Dispatcher.Invoke(() => {
var img = new BitmapImage(new Uri(filePath));
loaded[email] = img;
loaded.Add(email, img);
if (requesting.ContainsKey(email)) {
foreach (var one in requesting[email]) one.Source = img;
}
});
} else {
loaded.Add(email, null);
}
} catch {
loaded.Add(email, null);
}
} catch { }
requesting.Remove(email);
};