Exemplo n.º 1
0
 /// <summary>
 /// Load last used culture from application settings.
 /// </summary>
 private static void LoadCulture()
 {
     if (IsolatedStorageSettings.ApplicationSettings.Contains("CurrentCulture"))
     {
         // Load previously saved culture from app settings
         var savedCulture = (string)IsolatedStorageSettings.ApplicationSettings["CurrentCulture"];
         CurrentCulture = SupportedCultures.SingleOrDefault(info => info.ToString() == savedCulture);
     }
     else
     {
         // Determine user's current culture setting and if it is in the supported list - use it, or fallback to default culture
         var culture =
             SupportedCultures.FirstOrDefault(info => info.TwoLetterISOLanguageName == CurrentCulture.TwoLetterISOLanguageName);
         CurrentCulture = culture ?? DefaultCulture;
     }
 }