Rewrote next button to incorporate new slideshow system

This commit is contained in:
erri120 2019-10-08 16:21:51 +02:00
parent 651ca26ef9
commit d5669e8661
No known key found for this signature in database
GPG Key ID: A8C0A18D8D4D3135

View File

@ -203,42 +203,12 @@ namespace Wabbajack
{
get
{
return new LambdaCommand(() => true, () => NextSlideshowItem());
}
}
private void NextSlideshowItem()
{
var idx = _random.Next(0, SlideShowElements.Count);
try
{
var element = SlideShowElements[idx];
if (!element.Adult || (element.Adult && SplashShowNSFW))
{
var data = new MemoryStream();
using (var stream = new HttpClient().GetStreamSync(element.ImageURL))
stream.CopyTo(data);
data.Seek(0, SeekOrigin.Begin);
dispatcher.Invoke(() =>
{
var bitmap = new BitmapImage();
bitmap.BeginInit();
bitmap.CacheOption = BitmapCacheOption.OnLoad;
bitmap.StreamSource = data;
bitmap.EndInit();
SplashScreenImage = bitmap;
SplashScreenModName = element.ModName;
SplashScreenAuthorName = element.AuthorName;
SplashScreenSummary = element.ModSummary;
_nexusSiteURL = element.ModURL;
return new LambdaCommand(() => true, () => {
UpdateSlideShowItem();
QueueRandomSlide();
});
}
}
catch (Exception e) { }
}
public string _nexusSiteURL = null;