private void AccentSplitButton_Click(object sender, RoutedEventArgs e) { int currentAccentIndex = AccentSplitButton.SelectedIndex; int newAccentIndex; if (currentAccentIndex == AppAccents.Count - 1) { newAccentIndex = 0; } else { newAccentIndex = currentAccentIndex + 1; } Enum.TryParse(AppAccents[newAccentIndex], out AppAccent appAccent); if (appAccent == CurrentAppAccent) { return; } AppThemeAndAccentControlsGrid.IsEnabled = false; Appearance.ChangeAppAccent(appAccent); SettingsHandler.AppAccent = appAccent; CurrentAppAccent = appAccent; AccentSplitButton.SelectedIndex = newAccentIndex; AppThemeAndAccentControlsGrid.IsEnabled = true; }
public static void ChangeAppAccent(AppAccent newAppAccent) { ThemeManager.ChangeAppStyle(Application.Current, ThemeManager.GetAccent(SettingsHandler.ConvertAppAccentToString(newAppAccent)), ThemeManager.GetAppTheme(SettingsHandler.GetAppThemeAsString())); Application.Current.MainWindow.Icon = new BitmapImage( new Uri(String.Format("pack://application:,,,/Assets/Icons/{0}.ico", newAppAccent.ToString()))); }
private void AccentSplitButton_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (IsInitLaunch) { return; } string newAccent = AccentSplitButton.SelectedItem as string; Enum.TryParse(newAccent, out AppAccent appAccent); if (appAccent == CurrentAppAccent) { return; } AppThemeAndAccentControlsGrid.IsEnabled = false; Appearance.ChangeAppAccent(appAccent); SettingsHandler.AppAccent = appAccent; CurrentAppAccent = appAccent; AppThemeAndAccentControlsGrid.IsEnabled = true; }
public static string ConvertAppAccentToString(AppAccent appAccent) { return(appAccent.ToString()); }
private void SelectAppTheme(AppAccent accent) { ChangeAppStyle(ModuleSettings.AppAccent, accent.Value); }