/// <summary> /// Adds more resource files into the standard themes available /// through the theme settings interface. /// </summary> /// <param name="themeName"></param> /// <param name="additionalResource"></param> /// <param name="themes"></param> public void AddThemeResources(string themeName , List <Uri> additionalResource , IThemeInfos themes) { var theme = themes.GetThemeInfo(themeName); theme.AddResources(additionalResource); _defaultTheme = themes.GetThemeInfo("Dark"); }
/// <summary> /// This function assumes that themes and their resources have /// been added, previously. /// /// Use this method to define a default theme which can always be /// used as a backup whenever a certain theme is not defined etc... /// </summary> /// <param name="Themes"></param> /// <param name="defaultThemeName"></param> public void SetDefaultTheme(IThemeInfos Themes , string defaultThemeName) { var theme = Themes.GetThemeInfo(defaultThemeName); if (theme == null) { throw new System.ArgumentOutOfRangeException(defaultThemeName); } _defaultTheme = theme; }
/// <summary> /// Set the current theme as a selection of the settings service properties. /// </summary> /// <param name="Themes">Collections of themes to select the new theme from.</param> /// <param name="themeName">Name od the theme to be set (e.g.: Dark, Light)</param> /// <param name="AccentColor">Apply this accent color /// (can be Windows default or custom accent color). /// Accent Color in UI elements is invisible if this is null.</param> public void SetTheme(IThemeInfos Themes , string themeName , Color AccentColor) { var theme = Themes.GetThemeInfo(themeName); if (theme == null) { theme = GetDefaultTheme(); } SetTheme(theme, AccentColor); }
/// <summary> /// Resets the standard themes available through the theme settings interface. /// </summary> /// <param name="themes"></param> public void SetDefaultThemes(IThemeInfos themes) { themes.RemoveAllThemeInfos(); // Add theming models themes.AddThemeInfo("Dark", new List <Uri> { new Uri("/Mlib;component/Themes/DarkTheme.xaml", UriKind.RelativeOrAbsolute) }); themes.AddThemeInfo("Light", new List <Uri> { new Uri("/Mlib;component/Themes/LightTheme.xaml", UriKind.RelativeOrAbsolute) }); _defaultTheme = themes.GetThemeInfo("Dark"); }