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

View File

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