public static async void ChangeTheme(AppTheme newAppTheme)
        {
            switch (newAppTheme)
            {
            case AppTheme.Donker:
                App.Current.Resources["backgroundColor"] = Color.FromHex("#212121");
                App.Current.Resources["lineTextColor"]   = Color.White;
                App.Current.Resources["tabBarColor"]     = Color.FromHex("#464448");
                break;

            case AppTheme.Licht:
                App.Current.Resources["backgroundColor"] = Color.FromHex("#B2DFDB");
                App.Current.Resources["lineTextColor"]   = Color.Black;
                App.Current.Resources["tabBarColor"]     = Color.FromHex("#E0F2F1");
                break;

            default:
                break;
            }

            App.Preferences.AppTheme = newAppTheme;
            await App.Database.SavePreferencesAsync(App.Preferences);

            AppThemePickerVar.SelectedItem = newAppTheme.ToString();
        }
Пример #2
0
 private static void changeTheme(AppTheme theme)
 {
     ThemeManager.ChangeAppStyle(Application.Current,
                                 ThemeManager
                                 .GetAccent(AppColors
                                            .CurrentAppAccent.ToString()),
                                 ThemeManager
                                 .GetAppTheme(theme.ToString()));
 }
Пример #3
0
        public void SetTheme(AppTheme theme)
        {
            if (theme == AppTheme.Default)
            {
                ThemeManager.Current.ThemeSyncMode = ThemeSyncMode.SyncAll;
                ThemeManager.Current.SyncTheme();
            }
            else
            {
                ThemeManager.Current.ThemeSyncMode = ThemeSyncMode.SyncWithHighContrast;
                ThemeManager.Current.SyncTheme();
                ThemeManager.Current.ChangeTheme(Application.Current, $"{theme}.Blue", SystemParameters.HighContrast);
            }

            App.Current.Properties["Theme"] = theme.ToString();
        }
Пример #4
0
 private static void changeTheme(AppTheme theme)
 {
     try
     {
         ThemeManager.ChangeAppStyle(Application.Current,
                                     ThemeManager
                                     .GetAccent(AppColors
                                                .CurrentAppAccent.ToString()),
                                     ThemeManager
                                     .GetAppTheme(theme.ToString()));
     }
     catch (Exception ex)
     {
         App.SendException(ex);
     }
 }
Пример #5
0
        public void SetTheme(AppTheme theme)
        {
            if (theme == AppTheme.Default)
            {
                ThemeManager.Current.ThemeSyncMode = ThemeSyncMode.SyncAll;
                ThemeManager.Current.SyncTheme();
            }
            else
            {
                ThemeManager.Current.ThemeSyncMode = ThemeSyncMode.SyncWithHighContrast;
                ThemeManager.Current.SyncTheme();
                // ThemeManager.Current.ChangeThemeBaseColor(Application.Current, theme.ToString());
                ThemeManager.Current.ChangeTheme(Application.Current, $"{theme}.Blue", IsHighContrastActive);
            }

            App.Current.Properties["Theme"] = theme.ToString();
        }
Пример #6
0
 public static string CovertAppThemeToString(AppTheme appTheme)
 {
     return("Base" + appTheme.ToString());
 }
Пример #7
0
 /// <summary>
 /// Method to translate <see cref="AppTheme"/>.
 /// </summary>
 /// <param name="appTheme"><see cref="AppTheme"/>.</param>
 /// <returns>Translated <see cref="AppTheme"/>.</returns>
 public string Translate(AppTheme appTheme)
 {
     return(Translate(appTheme.ToString()));
 }
Пример #8
0
        void OnRequestedThemeChanged(object sender, AppThemeChangedEventArgs e)
        {
            AppTheme requestedTheme = e.RequestedTheme;

            ThemeLabel.Text = requestedTheme.ToString();
        }