} // end method GetProductVersion #endregion Public Methods #region Private Methods /// <summary> /// Apply corresponding theme settings. /// </summary> private static void ApplyTheme() { if (ShSzStockHelper.Properties.Settings.Default.AppTheme == (int) VisualStyles.MaterialDark) { var darkThemeSettings = new MaterialDarkThemeSettings { BodyAltFontSize = ShSzStockHelper.Properties.Settings.Default.ContentTextFontSize, BodyFontSize = ShSzStockHelper.Properties.Settings.Default.PrimaryTextFontSize, FontFamily = new FontFamily(ShSzStockHelper.Properties.Settings.Default.DisplayFontFamilyName), SubTitleFontSize = ShSzStockHelper.Properties.Settings.Default.PrimaryTextFontSize, TitleFontSize = ShSzStockHelper.Properties.Settings.Default.PrimaryTextFontSize }; SfSkinManager.RegisterThemeSettings("MaterialDark", darkThemeSettings); Current.Resources.MergedDictionaries.Add((ResourceDictionary)LoadComponent(new Uri("Resources/MaterialDark.xaml", UriKind.Relative))); } else { var lightThemeSettings = new MaterialLightThemeSettings { BodyAltFontSize = ShSzStockHelper.Properties.Settings.Default.ContentTextFontSize, BodyFontSize = ShSzStockHelper.Properties.Settings.Default.PrimaryTextFontSize, FontFamily = new FontFamily(ShSzStockHelper.Properties.Settings.Default.DisplayFontFamilyName), SubTitleFontSize = ShSzStockHelper.Properties.Settings.Default.PrimaryTextFontSize, TitleFontSize = ShSzStockHelper.Properties.Settings.Default.PrimaryTextFontSize }; SfSkinManager.RegisterThemeSettings("MaterialLight", lightThemeSettings); Current.Resources.MergedDictionaries.Add((ResourceDictionary)LoadComponent(new Uri("Resources/MaterialLight.xaml", UriKind.Relative))); } // end if...else } // end method ApplyTheme
private static IThemeSetting GetThemeSetting(string themeName) { FontFamily fontFamily = new FontFamily("Microsoft YaHei"); int bodyfontSize = 14; IThemeSetting theme = null; switch (themeName) { case "FluentLight": theme = new FluentLightThemeSettings() { FontFamily = fontFamily, BodyFontSize = bodyfontSize, }; break; case "MaterialLight": theme = new MaterialLightThemeSettings() { FontFamily = fontFamily, BodyFontSize = bodyfontSize, }; break; case "MaterialLightBlue": theme = new MaterialLightBlueThemeSettings() { FontFamily = fontFamily, BodyFontSize = bodyfontSize, }; break; case "Office2019White": theme = new Office2019WhiteThemeSettings() { FontFamily = fontFamily, BodyFontSize = bodyfontSize, }; break; case "FluentDark": theme = new FluentDarkThemeSettings() { FontFamily = fontFamily, BodyFontSize = bodyfontSize, }; break; case "MaterialDark": theme = new MaterialDarkThemeSettings() { FontFamily = fontFamily, BodyFontSize = bodyfontSize, }; break; case "MaterialDarkBlue": theme = new MaterialDarkBlueThemeSettings() { FontFamily = fontFamily, BodyFontSize = bodyfontSize, }; break; case "Office2019Black": theme = new Office2019BlackThemeSettings() { FontFamily = fontFamily, BodyFontSize = bodyfontSize, }; break; } return(theme); }