private void okButton_Click(object sender, EventArgs e) { string oldLocale = Localization.currentLocale; string languageCode = Localization.languageCodes[comboBox1.SelectedIndex]; if (languageCode != oldLocale) { Localization.currentLocale = languageCode; if (AppContext.notifyIcon == null) // Has UI been loaded yet? { Localization.LoadLocaleFromFile(); } JsonConfig.settings.language = languageCode; JsonConfig.settings.poeditorApiToken = null; if (AppContext.notifyIcon != null) { DialogResult result = MessageDialog.ShowQuestion(_("WinDynamicDesktop needs " + "to restart for the language to change. Do you want to restart the app " + "now?"), _("Question")); if (result == DialogResult.Yes) { JsonConfig.EnablePendingRestart(); } } } this.Close(); }
private void okButton_Click(object sender, EventArgs e) { string oldLocaleName = Localization.currentLocale; string localeName = Localization.localeNames[comboBox1.SelectedIndex]; if (localeName != oldLocaleName) { Localization.currentLocale = localeName; if (AppContext.notifyIcon == null) // Has UI been loaded yet? { Localization.LoadLocaleFromFile(); } JsonConfig.settings.language = localeName; if (AppContext.notifyIcon != null) { DialogResult result = MessageBox.Show(_("WinDynamicDesktop needs to restart " + "for the language to change. Do you want to restart the app now?"), _("Question"), MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { JsonConfig.EnablePendingRestart(); } } } this.Close(); }