예제 #1
0
        private void LanguageBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            int    oldSel     = SelectedStringInd;
            int    index      = LanguageBox.SelectedIndex;
            string chosenName = STR.LanguageSetNames[index];
            bool   langExists = false;

            Content.Content.Get().Changes.BlockingResMod(new ResAction(() =>
            {
                langExists = ActiveString.IsSetInit((STRLangCode)(index + 1));
            }, ActiveString));

            if (!langExists)
            {
                var result = MessageBox.Show("This language has not been initialized for this string resource yet. Initialize '" + chosenName + "'?",
                                             "Language not initialized!", MessageBoxButtons.YesNo);
                if (result == DialogResult.Yes)
                {
                    Content.Content.Get().Changes.BlockingResMod(new ResAction(() =>
                    {
                        ActiveString.InitLanguageSet((STRLangCode)(index + 1));
                    }, ActiveString));
                }
                else
                {
                    LanguageBox.SelectedIndex = 0;
                    return;
                }
            }
            ActiveLanguage = (STRLangCode)(index + 1);
            UpdateStrings();
            SelectedStringInd = oldSel;
        }