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; private string _SplashScreenSummary;
public string SplashScreenSummary { get => _SplashScreenSummary; set => this.RaiseAndSetIfChanged(ref _SplashScreenSummary, value); } 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"; public string Error => "Error";
@ -297,7 +299,8 @@ namespace Wabbajack
try try
{ {
var element = SlideShowElements[idx]; var element = SlideShowElements[idx];
if(!element.Adult || (element.Adult && SplashShowNSFW))
{
var data = new MemoryStream(); var data = new MemoryStream();
using (var stream = new HttpClient().GetStreamSync("asdas" + element.ImageURL)) using (var stream = new HttpClient().GetStreamSync("asdas" + element.ImageURL))
stream.CopyTo(data); stream.CopyTo(data);
@ -321,6 +324,7 @@ namespace Wabbajack
_lastSlideShowUpdate = DateTime.Now; _lastSlideShowUpdate = DateTime.Now;
}); });
} }
}
catch (Exception ex) catch (Exception ex)
{ {
} }
@ -347,7 +351,7 @@ namespace Wabbajack
SplashScreenAuthorName = modlist.Author; SplashScreenAuthorName = modlist.Author;
_nexusSiteURL = modlist.Website; _nexusSiteURL = modlist.Website;
SplashScreenSummary = modlist.Description; 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 SlideShowElements = modlist.Archives.OfType<NexusMod>().Select(m => new SlideShowItem
{ {
@ -356,6 +360,7 @@ namespace Wabbajack
ModSummary = NexusApiUtils.FixupSummary(m.Summary), ModSummary = NexusApiUtils.FixupSummary(m.Summary),
ImageURL = m.SlideShowPic, ImageURL = m.SlideShowPic,
ModURL = m.NexusURL, ModURL = m.NexusURL,
Adult = m.Adult
}).ToList(); }).ToList();
} }

View File

@ -57,11 +57,13 @@
<RowDefinition Height="Auto"></RowDefinition> <RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition> <RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition> <RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock Text="{Binding SplashScreenModName}" Grid.Row="0" FontSize="30" FontWeight="Bold"></TextBlock> <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 SplashScreenAuthorName}" Grid.Row="1" FontSize="15" FontWeight="Bold"></TextBlock>
<TextBlock Text="{Binding SplashScreenSummary}" TextWrapping="Wrap" Grid.Row="2" 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> <TextBlock Text="View Nexus Site" FontSize="15" FontWeight="Bold"></TextBlock>
</Button> </Button>
</Grid> </Grid>