mirror of
https://github.com/knah/VRCMelonAssistant.git
synced 2024-05-29 08:41:21 +12:00
Fix sidebar fucking up if the theme doesn't style it
This commit is contained in:
parent
35b995e6f0
commit
c67c6094c8
|
@ -11,6 +11,9 @@
|
|||
<!-- Swapped i88n Definitions -->
|
||||
<ResourceDictionary Source="Localisation/en-US.xaml" />
|
||||
|
||||
<!-- Load default sidebar theme, in case LoadedTheme doesn't have Sidebar properties applied. -->
|
||||
<ResourceDictionary x:Name="DefaultSidebarTheme" Source="Themes/Default_Sidebar.xaml"/>
|
||||
|
||||
<!-- Load default theme. Currently it's Dark, not sure if you want to change it to Light. -->
|
||||
<ResourceDictionary x:Name="LoadedTheme" Source="Themes/Dark.xaml"/>
|
||||
|
||||
|
|
|
@ -23,6 +23,8 @@ namespace ModAssistant
|
|||
private static Dictionary<string, Theme> loadedThemes = new Dictionary<string, Theme>();
|
||||
private static List<string> preInstalledThemes = new List<string> { "Light", "Dark", "Light Pink" }; //These themes will always be available to use.
|
||||
|
||||
private static readonly int LOADEDTHEME_INDEX = 3;
|
||||
|
||||
/// <summary>
|
||||
/// Load all themes from local Themes subfolder and from embedded resources.
|
||||
/// This also refreshes the Themes dropdown in the Options screen.
|
||||
|
@ -109,8 +111,8 @@ namespace ModAssistant
|
|||
MainWindow.Instance.BackgroundVideo.Visibility = Visibility.Hidden;
|
||||
if (newTheme.ThemeDictionary != null)
|
||||
{
|
||||
Application.Current.Resources.MergedDictionaries.RemoveAt(2); //We might want to change this to a static integer or search by name.
|
||||
Application.Current.Resources.MergedDictionaries.Insert(2, newTheme.ThemeDictionary); //Insert our new theme into the same spot as last time.
|
||||
Application.Current.Resources.MergedDictionaries.RemoveAt(LOADEDTHEME_INDEX); //We might want to change this to a static integer or search by name.
|
||||
Application.Current.Resources.MergedDictionaries.Insert(LOADEDTHEME_INDEX, newTheme.ThemeDictionary); //Insert our new theme into the same spot as last time.
|
||||
}
|
||||
Properties.Settings.Default.SelectedTheme = theme;
|
||||
Properties.Settings.Default.Save();
|
||||
|
@ -238,6 +240,11 @@ namespace ModAssistant
|
|||
return theme;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Modifies an already existing theme, or adds the theme if it doesn't exist
|
||||
/// </summary>
|
||||
/// <param name="name">Name of the theme.</param>
|
||||
/// <param name="theme">Theme to modify/apply</param>
|
||||
private static void AddOrModifyTheme(string name, Theme theme)
|
||||
{
|
||||
if (loadedThemes.TryGetValue(name, out _))
|
||||
|
@ -246,9 +253,13 @@ namespace ModAssistant
|
|||
{
|
||||
loadedThemes[name].ThemeDictionary = theme.ThemeDictionary;
|
||||
}
|
||||
if (theme.Waifus != null)
|
||||
if (theme.Waifus?.Background != null)
|
||||
{
|
||||
loadedThemes[name].Waifus = theme.Waifus;
|
||||
loadedThemes[name].Waifus.Background = theme.Waifus.Background;
|
||||
}
|
||||
if (theme.Waifus?.Sidebar != null)
|
||||
{
|
||||
loadedThemes[name].Waifus.Sidebar = theme.Waifus.Sidebar;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(theme.VideoLocation))
|
||||
{
|
||||
|
|
|
@ -193,6 +193,10 @@
|
|||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Themes\Default_Sidebar.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Themes\Light.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
|
17
ModAssistant/Themes/Default_Sidebar.xaml
Normal file
17
ModAssistant/Themes/Default_Sidebar.xaml
Normal file
|
@ -0,0 +1,17 @@
|
|||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<!-- This is a default theme for the Sidebars, in case the provided Theme doesn't have these in it..-->
|
||||
|
||||
<!-- Scroll Bars -->
|
||||
<SolidColorBrush x:Key="ScrollBarBackground" Color="{DynamicResource ResourceKey=StandardSecondary}"/>
|
||||
<SolidColorBrush x:Key="ScrollBarBorder" Color="{DynamicResource ResourceKey=StandardBorder}"/>
|
||||
<SolidColorBrush x:Key="ScrollBarTextColor" Color="{DynamicResource ResourceKey=StandardPrimary}"/>
|
||||
<SolidColorBrush x:Key="ScrollBarDisabled" Color="{DynamicResource ResourceKey=StandardSecondary}"/>
|
||||
<SolidColorBrush x:Key="ScrollBarArrowColor" Color="{DynamicResource ResourceKey=StandardActive}"/>
|
||||
<SolidColorBrush x:Key="ScrollBarArrowClicked" Color="{DynamicResource ResourceKey=StandardPrimary}"/>
|
||||
<SolidColorBrush x:Key="ScrollBarArrowHovered" Color="{DynamicResource ResourceKey=StandardHighlight}"/>
|
||||
<SolidColorBrush x:Key="ScrollBarHandle" Color="{DynamicResource ResourceKey=StandardPrimary}"/>
|
||||
<SolidColorBrush x:Key="ScrollBarHandleHovered" Color="{DynamicResource ResourceKey=StandardHighlight}"/>
|
||||
<SolidColorBrush x:Key="ScrollBarHandleClick" Color="{DynamicResource ResourceKey=StandardBorder}"/>
|
||||
<GridLength x:Key="ScrollBarButtonHeight">0</GridLength>
|
||||
</ResourceDictionary>
|
Loading…
Reference in a new issue