private void InnerInitialize() { AppearanceManager.Current.Initialize(); AppearanceManager.Current.ThemeObsolete += OnThemeObsolete; var theme = ValuesStorage.GetString(KeyTheme); InitializeThemesList(); SelectedTheme = Themes.OfType <ThemeLink>().GetByIdOrDefault(theme) ?? Themes.OfType <ThemeLink>().FirstOrDefault(); try { _loading = true; AccentColor = ValuesStorage.GetColor(KeyAccentColor, AccentColors.First()); if (AccentColor.A == 0) { AccentColor = AccentColors.First(); } AccentDisplayColor = ValuesStorage.GetString(KeyAccentDisplayColor); IdealFormattingMode = ValuesStorage.GetBool(KeyIdealFormattingMode, OptionIdealFormattingModeDefaultValue); SmallFont = ValuesStorage.GetBool(KeySmallFont); BitmapScalingMode = ValuesStorage.GetEnum(KeyBitmapScaling, BitmapScalingMode.HighQuality); LargeSubMenuFont = ValuesStorage.GetBool(KeyLargeSubMenuFont); ShowSubMenuDraggableIcons = ValuesStorage.GetBool(KeyShowSubMenuDraggableIcons, true); PopupToolBars = ValuesStorage.GetBool(KeyPopupToolBars); FrameAnimation = FrameAnimations.FirstOrDefault(x => x.Id == ValuesStorage.GetString(KeyFrameAnimation)) ?? FrameAnimations.First(); } finally { _loading = false; } }
public void Apply(ApplicationDesign design) { try { design.AccentColor.ApplyTheme(); } catch (Exception) { design.AccentColor = AccentColors.First(x => x.Name == "Blue"); design.AccentColor.ApplyTheme(); } try { design.AppTheme.ApplyTheme(); } catch (Exception) { design.AppTheme = AppThemes.First(); design.AppTheme.ApplyTheme(); } if (design.AudioVisualisation != null) { design.AudioVisualisation.AudioVisualisationPlugin.Refresh(); } }
public SettingsWindowViewModel() : base() { AccentColors = ThemeManager.Current.Themes .GroupBy(x => x.ColorScheme) .OrderBy(a => a.Key) .Select(a => new AccentColorMenuData { Name = a.Key, ColorBrush = a.First().ShowcaseBrush }) .ToList(); AccentColor = AccentColors.First(x => x.Name == App.Theme.ColorScheme); AppThemes = ThemeManager.Current.Themes .GroupBy(x => x.BaseColorScheme) .Select(x => x.First()) .Select(a => new AppThemeMenuData { Name = a.BaseColorScheme, BorderColorBrush = a.Resources["MahApps.Brushes.ThemeForeground"] as Brush, ColorBrush = a.Resources["MahApps.Brushes.ThemeBackground"] as Brush }) .ToList(); AppTheme = AppThemes.First(x => x.Name == App.Theme.BaseColorScheme); var resources = App.Theme.LibraryThemes.First(x => x.Origin == "MahApps.Metro").Resources.MergedDictionaries.First(); Colors = typeof(Colors).GetProperties(BindingFlags.Public | BindingFlags.Static) .Where(x => x.Name != "Transparent") .Select(x => new AccentColorMenuData { Name = x.Name, ColorBrush = new SolidColorBrush((Color)x.GetValue(null)) }) .ToList(); }
public SettingsVM() { AccentColors = ThemeManager.Accents.Select(a => new AccentColorMenuData { Name = a.Name, ColorBrush = a.Resources["AccentColorBrush"] as Brush }).ToList(); SelectedAccentColor = AccentColors.First(x => x.Name == Settings.Default.AccentColorName); SelectedIndexTheme = Settings.Default.ThemeIndex; ShowPreviewOnSelect = Settings.Default.ActivatePreviewOnSelect; }
public SettingsVM() { AccentColors = ThemeManager.Current.Themes .GroupBy(x => x.ColorScheme) .OrderBy(x => x.Key) .Select(a => new AccentColorMenuData { Name = a.Key, ColorBrush = a.First().ShowcaseBrush }).ToList(); SelectedAccentColor = AccentColors.First(x => x.Name == Settings.Default.AccentColorName); SelectedIndexTheme = Settings.Default.ThemeIndex; ShowPreviewOnSelect = Settings.Default.ActivatePreviewOnSelect; PathOverrides = Settings.Default.PathOverrides; }
public SettingsViewModel(MusicDataManager musicDataManager, Action refreshViewAction) { MusicDataManager = musicDataManager; _refreshViewAction = refreshViewAction; SelectedSoundOutDevice = musicDataManager.MusicManager.AudioEngine.SoundOutProvider.CurrentSoundOutDevice; AccentColors = ThemeManager.Accents.Select( x => new AccentColorData { ColorBrush = x.Resources["AccentColorBrush"] as Brush, Key = x.Name, AccentColor = x }) .ToList(); Themes = ThemeManager.AppThemes.Select(x => new ThemeData { Key = x.Name, Theme = x }).ToList(); SelectedTheme = Themes.FirstOrDefault(x => x.Key == _settings.Theme) ?? Themes.First(); SelectedAccentColor = AccentColors.FirstOrDefault(x => x.Key == _settings.AccentColor) ?? AccentColors.First(); }