Ejemplo n.º 1
0
        // Loads all languages
        private void InitializeLanguage()
        {
            List <ILanguage> languages = new List <ILanguage>();

            try
            {
                languages = InterfaceLoader.GetAll <ILanguage>();
                ILanguage language = languages.FirstOrDefault(x => x.Identifier == Configuration.DefaultLanguage);
                if (language is null)
                {
                    throw new Exception("Could not find languages");
                }

                Language = new Language(language.Identifier);
                language.Apply(Language);
            }
            catch
            {
                EnglishLanguage l = new EnglishLanguage();
                Language = new Language(l.Identifier);
                l.Apply(Language);
            }

            CapsLockLabel.Text      = Language.CapsLockText;
            WrongPasswordLabel.Text = Language.WrongPasswordText;

            LanguageButton.Text = Language.LanguageCode.ToUpper();

            Controls.Add(ControlFactory.CreateLanguagePanel("languagePanel", languages, LanguageButton.Location.X + LanguageButton.Width, LanguageButton.Location.Y, Language));
            Controls.Find("languagePanel", true).FirstOrDefault().Visible = false;

            foreach (ILanguage language in languages)
            {
                Controls.Find(language.Identifier + "1", true).FirstOrDefault().Click += LanguageClick;
                Controls.Find(language.Identifier + "2", true).FirstOrDefault().Click += LanguageClick;
            }
        }