Recent games: Improve UI responsiveness when disk is slow

This commit is contained in:
Sour 2019-12-05 22:21:34 -05:00
parent a74f2e30d5
commit 63b23a7b22

View file

@ -44,19 +44,19 @@ namespace Mesen.GUI.Controls
lblGameName.Text = Path.GetFileNameWithoutExtension(_recentGame.RomName);
lblSaveDate.Text = _recentGame.Timestamp.ToString();
try {
ZipArchive zip = new ZipArchive(new MemoryStream(File.ReadAllBytes(_recentGame.FileName)));
ZipArchiveEntry entry = zip.GetEntry("Screenshot.png");
if(entry != null) {
using(Stream stream = entry.Open()) {
picPreviousState.Image = Image.FromStream(stream);
Task.Run(() => {
Image img = null;
try {
ZipArchive zip = new ZipArchive(new MemoryStream(File.ReadAllBytes(_recentGame.FileName)));
ZipArchiveEntry entry = zip.GetEntry("Screenshot.png");
if(entry != null) {
using(Stream stream = entry.Open()) {
img = Image.FromStream(stream);
}
}
} else {
picPreviousState.Image = null;
}
} catch {
picPreviousState.Image = null;
}
} catch { }
picPreviousState.Image = img;
});
lblGameName.Visible = true;
lblSaveDate.Visible = true;