Added checkbox to enable NSFW contents in slideshow

This commit is contained in:
erri120 2019-10-07 17:52:31 +02:00
parent 3c574db51e
commit a56c773f59
No known key found for this signature in database
GPG Key ID: A8C0A18D8D4D3135
2 changed files with 29 additions and 22 deletions

View File

@ -231,6 +231,8 @@ namespace Wabbajack
private string _SplashScreenSummary;
public string SplashScreenSummary { get => _SplashScreenSummary; set => this.RaiseAndSetIfChanged(ref _SplashScreenSummary, value); }
private bool _splashShowNSFW = true;
public bool SplashShowNSFW { get => _splashShowNSFW; set => this.RaiseAndSetIfChanged(ref _splashShowNSFW, value); }
public string Error => "Error";
@ -297,29 +299,31 @@ namespace Wabbajack
try
{
var element = SlideShowElements[idx];
var data = new MemoryStream();
using (var stream = new HttpClient().GetStreamSync("asdas" + element.ImageURL))
stream.CopyTo(data);
data.Seek(0, SeekOrigin.Begin);
dispatcher.Invoke(() =>
if(!element.Adult || (element.Adult && SplashShowNSFW))
{
var bitmap = new BitmapImage();
bitmap.BeginInit();
bitmap.CacheOption = BitmapCacheOption.OnLoad;
bitmap.StreamSource = data;
bitmap.EndInit();
var data = new MemoryStream();
using (var stream = new HttpClient().GetStreamSync("asdas" + element.ImageURL))
stream.CopyTo(data);
data.Seek(0, SeekOrigin.Begin);
SplashScreenImage = bitmap;
SplashScreenModName = element.ModName;
SplashScreenAuthorName = element.AuthorName;
SplashScreenSummary = element.ModSummary;
_nexusSiteURL = element.ModURL;
_lastSlideShowUpdate = DateTime.Now;
});
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;
_lastSlideShowUpdate = DateTime.Now;
});
}
}
catch (Exception ex)
{
@ -347,7 +351,7 @@ namespace Wabbajack
SplashScreenAuthorName = modlist.Author;
_nexusSiteURL = modlist.Website;
SplashScreenSummary = modlist.Description;
//if(modlist.Image != null) SplashScreenImage = modlist.Image;
//TODO: if(modlist.Image != null) SplashScreenImage = modlist.Image;
SlideShowElements = modlist.Archives.OfType<NexusMod>().Select(m => new SlideShowItem
{
@ -356,6 +360,7 @@ namespace Wabbajack
ModSummary = NexusApiUtils.FixupSummary(m.Summary),
ImageURL = m.SlideShowPic,
ModURL = m.NexusURL,
Adult = m.Adult
}).ToList();
}

View File

@ -57,11 +57,13 @@
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding SplashScreenModName}" Grid.Row="0" FontSize="30" FontWeight="Bold"></TextBlock>
<TextBlock Text="{Binding SplashScreenAuthorName}" Grid.Row="1" FontSize="15" FontWeight="Bold"></TextBlock>
<TextBlock Text="{Binding SplashScreenSummary}" TextWrapping="Wrap" Grid.Row="2" FontSize="15" FontWeight="Bold"></TextBlock>
<Button Height="30" Grid.Row="3" Grid.Column="1" Command="{Binding VisitNexusSiteCommand}">
<CheckBox Grid.Row="3" IsChecked="{Binding SplashShowNSFW}" Name="ShowNSFWContent">Show NSFW Mods in the Slideshow</CheckBox>
<Button Height="30" Grid.Row="4" Command="{Binding VisitNexusSiteCommand}">
<TextBlock Text="View Nexus Site" FontSize="15" FontWeight="Bold"></TextBlock>
</Button>
</Grid>