コード例 #1
0
        public void LoadTheme()
        {
            // Add custom accent resource dictionary to the ThemeManager, contains default color values
            MahAppsThemeManager.AddAccent(CustomAccentKey, new Uri("pack://application:,,,/neo-gui;component/ResourceDictionaries/CustomAccentThemeResources.xaml"));


            // Try load custom theme
            var themeJson = settingsManager.AppTheme;

            // Check if theme JSON has been set
            if (string.IsNullOrEmpty(themeJson))
            {
                SetThemeToDefault();
                return;
            }

            var theme = Theme.ImportFromJson(themeJson);

            if (theme == null)
            {
                theme = Theme.Default;
            }

            this.SetTheme(theme);
        }