コード例 #1
0
        void GlobalizationUtilities_IsSelectedChanged(object sender, EventArgs e)
        {
            SupportedCulture culture = sender as SupportedCulture;

            if (culture.IsSelected)
            {
                SelectCulture(culture);
            }
        }
コード例 #2
0
        // Konstruktor. Einrichten der verfügbaren Kulturen
        public GlobalizationUtilities()
        {
            SupportedCultures = new List <SupportedCulture>();
            SupportedCultures.Add(new SupportedCulture("de-DE", GlobalizationUtilities_IsSelectedChanged));
            SupportedCultures.Add(new SupportedCulture("en-GB", GlobalizationUtilities_IsSelectedChanged));
            SupportedCultures.Add(new SupportedCulture("en-US", GlobalizationUtilities_IsSelectedChanged));
            SupportedCultures.Add(new SupportedCulture("fr-FR", GlobalizationUtilities_IsSelectedChanged));
            SupportedCultures.Add(new SupportedCulture("fa-IR", GlobalizationUtilities_IsSelectedChanged));

            this.SelectedCulture = SupportedCultures.FirstOrDefault();
        }
コード例 #3
0
        private void SelectCulture(SupportedCulture culture)
        {
            foreach (var c in SupportedCultures)
            {
                if (c != culture)
                {
                    c.IsSelected = false;
                }
            }
            SelectedCulture = culture;

            Thread.CurrentThread.CurrentCulture   = culture.CultureInfo;
            Thread.CurrentThread.CurrentUICulture = culture.CultureInfo;

            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(null));
            }
            if (SelectedCultureChanged != null)
            {
                SelectedCultureChanged(this, EventArgs.Empty);
            }
        }