Created Next button functions

This commit is contained in:
erri120 2019-10-07 20:03:29 +02:00
parent a0588bb564
commit 1ee0137800
No known key found for this signature in database
GPG Key ID: A8C0A18D8D4D3135

View File

@ -198,6 +198,47 @@ namespace Wabbajack
}
}
public ICommand SlideShowNextItem
{
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;
});
}
}
catch (Exception e) { }
}
public string _nexusSiteURL = null;
private void VisitNexusSite()