Beispiel #1
0
        public override void LocalizeText(string cultureName = "")
        {
            base.LocalizeText();

            if (!string.IsNullOrEmpty(cultureName) && !string.IsNullOrWhiteSpace(cultureName))
            {
                Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(cultureName);

                var parent = this.Owner;

                if (parent is BaseForm)
                {
                    ((BaseForm)parent).LocalizeText(cultureName);
                }
            }

            Text = Resources.LoginFormStrings.Title;

            usernameLabel.Text = Resources.LoginFormStrings.UsernameLabelText;
            passwordLabel.Text = Resources.LoginFormStrings.PasswordLabelText;
            LanguageLabel.Text = Resources.LoginFormStrings.LanguageLabelText;
            LoginButton.Text   = Resources.LoginFormStrings.LoginButtonText;

            Localizables.LocalizeAll(cultureName);
        }
Beispiel #2
0
        protected override void AttachEvents()
        {
            // Using lambda expressions to simplify event handlers due to handlers' simplicity
            LoginButton.Click += (sender, e) => Login();

            LanguageCombobox.SelectedIndexChanged += (sender, e) =>
            {
                var selectedLanguage = LanguageCombobox.SelectedValue.ToString();
                LocalizeText(selectedLanguage);
                Localizables.LocalizeAll(selectedLanguage);
            };
        }