コード例 #1
0
 /// <summary>
 /// Thread-safe access to the AvailableCultures list.
 /// </summary>
 /// <param name="c">The CultureInfo.</param>
 protected void AddCulture(CultureInfo c)
 {
     lock (AvailableCultureListLock)
     {
         if (!AvailableCultures.Contains(c))
         {
             AvailableCultures.Add(c);
         }
     }
 }
コード例 #2
0
 public static void ChangeCulture(CultureInfo culture)
 {
     if (AvailableCultures.Contains(culture))
     {
         Resources.Culture = culture;
         ResourceProvider.Refresh();
     }
     else
     {
         System.Diagnostics.Debug.WriteLine(string.Format("Culture [{0}] not available", culture));
     }
 }
コード例 #3
0
ファイル: App.xaml.cs プロジェクト: webmaster442/TCPlayer
 internal static void SetAppCulture()
 {
     if (TCPlayer.Properties.Settings.Default.CultureOverride != null)
     {
         try
         {
             CultureInfo @override = TCPlayer.Properties.Settings.Default.CultureOverride;
             if (AvailableCultures.Contains(@override))
             {
                 TCPlayer.Properties.Resources.Culture = @override;
             }
             else
             {
                 TCPlayer.Properties.Settings.Default.CultureOverride = CultureInfo.InvariantCulture;
             }
         }
         catch (Exception)
         {
             TCPlayer.Properties.Settings.Default.CultureOverride = CultureInfo.InvariantCulture;
         }
     }
 }