preload animate bar

This commit is contained in:
Tsanie Lily 2020-05-15 09:27:53 +08:00
parent 2fe66d4f8d
commit bfc348d7e2
2 changed files with 6 additions and 7 deletions

View File

@ -131,6 +131,7 @@ namespace Pixiview.Illust
if (illust != null)
{
IsAnimateSliderVisible = illust.IsAnimeVisible;
LoadIllust(illust);
}
}
@ -352,9 +353,6 @@ namespace Pixiview.Illust
}
}
var isAnime = illustItem.IllustType == IllustType.Anime;
IsAnimateSliderVisible = isAnime;
Task.Run(() => DoLoadImage(0, true));
if (items.Length > 1)
{
@ -363,7 +361,7 @@ namespace Pixiview.Illust
DoLoadImage(i);
});
}
else if (isAnime)
else if (illustItem.IsAnimeVisible)
{
// anime
ugoiraData = Stores.LoadIllustUgoiraData(illustItem.Id);

View File

@ -299,7 +299,7 @@ namespace Pixiview.Utils
private readonly IllustUgoiraBody ugoira;
private readonly IllustDetailItem detailItem;
private readonly ImageSource[] frames;
private readonly Timer timer;
private Timer timer;
private int index = 0;
public bool IsPlaying { get; private set; }
@ -329,6 +329,7 @@ namespace Pixiview.Utils
if (timer != null)
{
timer.Dispose();
timer = null;
}
}
@ -336,7 +337,7 @@ namespace Pixiview.Utils
{
lock (sync)
{
if (IsPlaying == flag)
if (timer == null || IsPlaying == flag)
{
return;
}
@ -409,7 +410,7 @@ namespace Pixiview.Utils
index = i;
lock (sync)
{
if (IsPlaying)
if (timer != null && IsPlaying)
{
timer.Change(info.delay, Timeout.Infinite);
}