public static async Task SetThemeAsync(ElementThemeExtended theme)
        {
            Theme = theme;

            SetRequestedTheme();
            await SaveThemeInSettingsAsync(Theme);

            OnThemeChanged(null, Theme);
        }
        private static async Task <ElementThemeExtended> LoadThemeFromSettingsAsync()
        {
            ElementThemeExtended cacheTheme = ElementThemeExtended.Default;
            string themeName = await ApplicationData.Current.LocalSettings.ReadAsync <string>(SettingsKey);

            if (!string.IsNullOrEmpty(themeName))
            {
                Enum.TryParse(themeName, out cacheTheme);
            }

            return(cacheTheme);
        }
 public static async Task InitializeAsync()
 {
     Theme = await LoadThemeFromSettingsAsync();
 }
 private static async Task SaveThemeInSettingsAsync(ElementThemeExtended theme)
 {
     await ApplicationData.Current.LocalSettings.SaveAsync(SettingsKey, theme.ToString());
 }