Re-add mediaelement and fix bugs from rebase

This commit is contained in:
Caeden Statia 2020-02-19 20:30:06 -08:00
parent e9ca17cfc9
commit b884f8da75
2 changed files with 15 additions and 10 deletions

View file

@ -307,20 +307,24 @@ namespace ModAssistant
private static void ApplyWaifus()
{
Waifus waifus = loadedThemes[LoadedTheme].Waifus;
ApplyImageToBrush(ref MainWindow.Instance.BackgroundImage, waifus?.Background);
ApplyImageToBrush(ref MainWindow.Instance.SideImage, waifus?.Background);
}
private static void ApplyImageToBrush(ref ImageBrush brush, BitmapImage image)
{
if (image is null)
if (waifus?.Background is null)
{
brush.Opacity = 0;
MainWindow.Instance.BackgroundImage.Opacity = 0;
}
else
{
brush.Opacity = 1;
brush.ImageSource = image;
MainWindow.Instance.BackgroundImage.Opacity = 1;
MainWindow.Instance.BackgroundImage.ImageSource = waifus.Background;
}
if (waifus?.Sidebar is null)
{
MainWindow.Instance.SideImage.Visibility = Visibility.Hidden;
}
else
{
MainWindow.Instance.SideImage.Visibility = Visibility.Visible;
MainWindow.Instance.SideImage.Source = waifus.Sidebar;
}
}

View file

@ -16,6 +16,7 @@
<ImageBrush x:Name="BackgroundImage" Stretch="{DynamicResource BackgroundImageStretch}"/>
</Rectangle.Fill>
</Rectangle>
<MediaElement Visibility="Hidden" LoadedBehavior="Manual" Name="BackgroundVideo"/>
<Image x:Name="SideImage" UseLayoutRounding="True" SnapsToDevicePixels="True" HorizontalAlignment="Left" VerticalAlignment="{DynamicResource SideImageYPosition}" Width="{Binding RelativeSource={RelativeSource Self}, Path=Source.PixelWidth}" Height="{Binding RelativeSource={RelativeSource Self}, Path=Source.PixelHeight}" Stretch="Fill"/>
<Grid Margin="10">
<Grid.RowDefinitions>