示例#1
0
        private void localeComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            Logger.Trace(System.Reflection.MethodBase.GetCurrentMethod().Name);
            if (!loadingForm)
            {
                //forcing the loadingForm flag to prevent that this event is fired multiple times ultil it's finished
                loadingForm = true;

                // saving current locale code and index
                if (localeComboBox.SelectedIndex >= 0)
                {
                    MainForm.optionsData.selectedLocaleIndex = localeComboBox.SelectedIndex;
                    MainForm.optionsData.selectedLocale      = MainForm.optionsData.localeList[MainForm.optionsData.selectedLocaleIndex].localeCode;
                }
                localeManager.SaveOldLocaleLabels();
                localeManager.SetLocale(this);

                // setting again the defaults data refreshing the localization
                MainForm.optionsData.SetDefault();

                // restoring the combobox index
                if (MainForm.optionsData.selectedLocaleIndex >= 0)
                {
                    localeComboBox.SelectedIndex = MainForm.optionsData.selectedLocaleIndex;
                }
                //Console.WriteLine("MainForm.optionsData.lastVersionFound: " + MainForm.optionsData.lastVersionFound);
                localeManager.UpdateNewLocaleLabels();

                // update the labels
                UpdateLabels();
                loadingForm = false;
            }
        }