public LanguageSelector()
        {
            InitializeComponent();

            if (!System.ComponentModel.DesignerProperties.GetIsInDesignMode(this))
            {
                languagesManager = new LanguagesManager();
                languagesManager.ChangeLanguage += new LanguagesManager.ChangeLanguagesEventHandler(languagesManager_ChangeLanguage);

                //this.Content = languagesManager.CurrLanguage.Name;
               // this.tbData.Text = languagesManager.CurrLanguage.Name;

                ExplorerNet.Tools.SkinManager.ChangedSkin += delegate(Object sender, string skin)
                {
                    Style stl = (Style)App.Current.Resources[typeof(Button)];

                    this.Style = stl;

                    //Style stl = new Style(this.GetType());
                    //stl.BasedOn = new Style(typeof(Button));
                    //stl.TargetType = this.GetType();

                    //this.Style = stl;

                    //this.UpdateLayout();
                };

            }
        }
Beispiel #2
0
        /// <summary>
        /// Устанавливает первоначальные значения языка в приложении. Используется при старте приложения
        /// </summary>
        public static void Init()
        {
            if (string.IsNullOrEmpty(Properties.Settings.Default.CurrLang))
            {
                CultureInfo currCulture = CultureInfo.CurrentUICulture;

                LanguagesManager lm = new LanguagesManager();

                List <OneLanguage> langs = lm.GetAllOneLanguages();

                foreach (var lang in langs)
                {
                    if (lang.Culture != null)
                    {
                        if (currCulture.Name == lang.Culture.Name)
                        {
                            lm.ChangeOneLanguage(lang);
                        }
                    }
                }
            }
            else
            {
                LanguagesManager lm = new LanguagesManager();
                lm.ChangeOneLanguage(OneLanguage.FromName(Properties.Settings.Default.CurrLang));
            }
        }
Beispiel #3
0
        /// <summary>
        /// Позволяет создать язык на основе имени. (Язык с таким именем
        /// должен быть в списке языков LanguagesManager.GetAllOneLanguages)
        /// </summary>
        /// <param name="langName"></param>
        /// <returns></returns>
        public static OneLanguage FromName(string langName)
        {
            LanguagesManager lm     = new LanguagesManager();
            var         langs       = lm.GetAllOneLanguages();
            OneLanguage oneLanguage = null;

            foreach (var lang in langs)
            {
                if (lang.Name == langName)
                {
                    oneLanguage = lang;
                }
            }

            if (oneLanguage == null)
            {
                return(lm.GetEnLenguage());
            }
            else
            {
                return(oneLanguage);
            }
        }
Beispiel #4
0
        /// <summary>
        /// Устанавливает первоначальные значения языка в приложении. Используется при старте приложения
        /// </summary>
        public static void Init()
        {
            if (string.IsNullOrEmpty(Properties.Settings.Default.CurrLang))
            {
                CultureInfo currCulture = CultureInfo.CurrentUICulture;

                LanguagesManager lm = new LanguagesManager();

                List<OneLanguage> langs = lm.GetAllOneLanguages();

                foreach (var lang in langs)
                {
                    if (lang.Culture != null)
                    {
                        if (currCulture.Name == lang.Culture.Name)
                        {
                            lm.ChangeOneLanguage(lang);
                        }
                    }
                }

            }
            else
            {
                LanguagesManager lm = new LanguagesManager();
                lm.ChangeOneLanguage(OneLanguage.FromName(Properties.Settings.Default.CurrLang));
            }
        }
Beispiel #5
0
 /// <summary>
 /// Получаем объект текущего языка приложения
 /// </summary>
 /// <returns></returns>
 public static OneLanguage GetCurrLanguage()
 {
     LanguagesManager lm = new LanguagesManager();
     return lm.CurrLanguage;
 }
Beispiel #6
0
        /// <summary>
        /// Получаем объект текущего языка приложения
        /// </summary>
        /// <returns></returns>
        public static OneLanguage GetCurrLanguage()
        {
            LanguagesManager lm = new LanguagesManager();

            return(lm.CurrLanguage);
        }
Beispiel #7
0
        /// <summary>
        /// Позволяет создать язык на основе имени. (Язык с таким именем 
        /// должен быть в списке языков LanguagesManager.GetAllOneLanguages)
        /// </summary>
        /// <param name="langName"></param>
        /// <returns></returns>
        public static OneLanguage FromName(string langName)
        {
            LanguagesManager lm = new LanguagesManager();
            var langs = lm.GetAllOneLanguages();
            OneLanguage oneLanguage = null;
            foreach (var lang in langs)
            {
                if (lang.Name == langName)
                {
                    oneLanguage = lang;
                }
            }

            if (oneLanguage == null)
            {
                return lm.GetEnLenguage();
            }
            else
            {
                return oneLanguage;
            }
        }