コード例 #1
0
        private void comboLanguage_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (ComboLanguage.Text == "Add another language...")
            {
                if (addLanguage == null || addLanguage.IsDisposed)
                {
                    addLanguage      = new formAddLanguage();
                    addLanguage.main = this;
                }

                addLanguage.Show();

                ComboLanguage.Text = Profile;
            }
            else if (ComboLanguage.SelectedIndex != -1)
            {
                string flagPath;
                if (ComboLanguage.Text == "English")
                {
                    flagPath = Application.StartupPath + "\\languages\\flags\\en.png";
                }
                else
                {
                    flagPath = Application.StartupPath + "\\languages\\flags\\" + Languages[ComboLanguage.Text] + ".png";
                }

                if (File.Exists(flagPath))
                {
                    picFlag.ImageLocation = flagPath;
                }
                else
                {
                    picFlag.ImageLocation = "";
                }

                Profile = ComboLanguage.Text;

                if (Profile == "English")
                {
                    buttNewWotD.Visible = prefs.NewWotDs;
                }
                else
                {
                    loadExtraForeignWords();
                    buttNewWotD.Visible = false;
                }
            }
        }
コード例 #2
0
ファイル: formMain.cs プロジェクト: Winterstark/Wordy
        private void comboLanguage_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (ComboLanguage.Text == "Add another language...")
            {
                if (addLanguage == null || addLanguage.IsDisposed)
                {
                    addLanguage = new formAddLanguage();
                    addLanguage.main = this;
                }

                addLanguage.Show();

                ComboLanguage.Text = Profile;
            }
            else if (ComboLanguage.SelectedIndex != -1)
            {
                Profile = ComboLanguage.Text;

                //change active flag
                if (picLanguageFlags != null)
                    foreach (var pic in picLanguageFlags)
                        if (pic.Tag.ToString() == ComboLanguage.Text)
                            pic.Image = languageFlags[pic.Tag.ToString()].Item1;
                        else
                            pic.Image = languageFlags[pic.Tag.ToString()].Item2;

                //show new WotDs button if English is active
                if (Profile == "English")
                    buttNewWotD.Visible = prefs.NewWotDs;
                else
                {
                    loadExtraForeignWords();
                    buttNewWotD.Visible = false;
                }
            }
        }