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); reader.CopyTo(writer);
} }
if (requesting.ContainsKey(email)) { Dispatcher.Invoke(() => {
Dispatcher.Invoke(() => { var img = new BitmapImage(new Uri(filePath));
var img = new BitmapImage(new Uri(filePath)); loaded.Add(email, img);
loaded[email] = img;
if (requesting.ContainsKey(email)) {
foreach (var one in requesting[email]) one.Source = img; foreach (var one in requesting[email]) one.Source = img;
}); }
} });
} else {
loaded.Add(email, null);
} }
} catch { } } catch {
loaded.Add(email, null);
}
requesting.Remove(email); requesting.Remove(email);
}; };