示例#1
0
        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;
        }
示例#2
0
        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())));
        }
示例#3
0
        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;
        }
示例#4
0
 public static string ConvertAppAccentToString(AppAccent appAccent)
 {
     return(appAccent.ToString());
 }
示例#5
0
 private void SelectAppTheme(AppAccent accent)
 {
     ChangeAppStyle(ModuleSettings.AppAccent, accent.Value);
 }