private void comboBoxHelpLanguage_SelectedIndexChanged(object sender, EventArgs e) { if (0 <= comboBoxHelpLanguage.SelectedIndex && comboBoxHelpLanguage.SelectedIndex < comboBoxHelpLanguage.Items.Count) { HelpLanguage helpLanguage = (HelpLanguage)comboBoxHelpLanguage.Items[comboBoxHelpLanguage.SelectedIndex]; comboBoxHelpEntries.Items.Clear(); comboBoxHelpEntries.Items.AddRange(helpLanguage.Items); if (0 < helpLanguage.Items.Length) { comboBoxHelpEntries.SelectedIndex = 0; } } }
// // Public members: // // Internal members: internal MainForm() { InitializeComponent(); this.Icon = Program.Icon; this.pictureBoxHelp.Image = SystemIcons.Information.ToBitmap(); this.Text = L10n._p("Main window", "Half-Life Advanced Effects"); this.fileToolStripMenuItem.Text = L10n._p("Main window | menu", "File"); this.menuLaunchCSGO.Text = L10n._p("Main window | menu | File", "Launch CS:GO"); this.launchGoldSrcToolStripMenuItem.Text = L10n._p("Main window | menu | File", "Launch GoldSrc"); this.menuExit.Text = L10n._p("Main window | menu | File", "Exit"); this.viewToolStripMenuItem.Text = L10n._p("Main Window | menu", "View"); this.menuStatusBar.Text = L10n._p("Main window | menu | View", "Status Bar"); this.toolsToolStripMenuItem.Text = L10n._p("Main window | menu", "Tools"); this.calculatorsToolStripMenuItem.Text = L10n._p("Main window | menu | Tools", "Calculators"); this.menuFileSize.Text = L10n._p("Main window | menu | Tools | Calculators", "File Size"); this.menuAfxRgbaLut.Text = L10n._p("Main window | menu | Tools", "Color Lookup Tables"); this.menuVoronoi.Text = L10n._p("Main window | menu | Tools | Color Lookup Tables", "Voronoi"); this.goldSrcToolStripMenuItem.Text = L10n._p("Main window | menu | Tools", "GoldSrc"); this.demoToolsToolStripMenuItem.Text = L10n._p("Main window | menu | Tools | GoldSrc", "Demo Tools"); this.skyManagerToolStripMenuItem.Text = L10n._p("Main window | menu | Tools | GoldSrc", "Sky Manager"); this.developerToolStripMenuItem.Text = L10n._p("Main window | menu | Tools", "Developer"); this.menuCustomLoader.Text = L10n._p("Main window | menu | Tools | Developer", "Custom Loader"); this.menuGuidToClipBoard.Text = L10n._p("Main window | menu | Tools | Developer", "Own GUID to ClipBoard"); this.menuNewGuidToClipBoard.Text = L10n._p("Main window | menu | Tools | Developer", "New GUID to ClipBoard"); this.helpToolStripMenuItem.Text = L10n._p("Main window | menu", "Help"); this.checkForUpdatesToolStripMenuItem.Text = L10n._p("Main window | menu | Help", "Check for Updates"); this.menuAutoUpdateCheck.Text = L10n._p("Main window | menu | Help | Check for Updates", "Auto Check"); this.checkNowToolStripMenuItem.Text = L10n._p("Main window | menu | Help | Check for Updates", "Check Now"); this.menuAdvancedFxOrg.Text = L10n._p("Main window | menu | Help", "Official Website"); this.donateToolStripMenuItem.Text = L10n._p("Main window | menu", "Donate"); this.checkUpdatesLabel.Text = L10n._p("Main window | check updates strip", "Check for updates automatically?"); this.statusLabelAutoYes.Text = L10n._p("Main window | check updates strip", "Yes"); this.statusLabelAutoNo.Text = L10n._p("Main window | check updates strip", "No"); this.statusLabelIgnore.Text = L10n._p("Main window | update status strip", "Ignore"); this.statusLabelHide.Text = L10n._p("Main window | update status strip", "OK"); this.statusLabelUpdate.Text = L10n._p("Main window | update status strip | label", "Update status unknown"); this.menuContact.Text = L10n._("Contact / Privacy Policy / Imprint (advancedfx.org)"); this.groupBoxHelp.Text = L10n._("Help"); this.labelHelpLanguage.Text = L10n._("Language:"); this.labelHelpSelection.Text = L10n._("Selection:"); { HelpEntry officialEnglishSupportPage = new HelpEntry(L10n._("Official support page (English)"), "https://www.advancedfx.org/support/"); HelpEntry chinesePage = new HelpEntry(L10n._("HLAE Chinese Station"), "https://hlae.site/"); helpLanguages = new HelpLanguage[] { new HelpLanguage("en", L10n._p("Language", "English (en)"), new HelpEntry[] { officialEnglishSupportPage }), new HelpLanguage("zh-CN", L10n._p("Language", "Chinese (zh-CN)"), new HelpEntry[] { chinesePage }) }; this.comboBoxHelpLanguage.Items.AddRange(helpLanguages); string ietfLanguageTag = System.Globalization.CultureInfo.CurrentUICulture.IetfLanguageTag; string twoLetterIsoLanguageName = System.Globalization.CultureInfo.CurrentUICulture.TwoLetterISOLanguageName; // Select a default language: int selectIndex = -1; int curIndex = 0; foreach (HelpLanguage helpLanguage in helpLanguages) { if (helpLanguage.Code.Equals(ietfLanguageTag)) { selectIndex = curIndex; break; } ++curIndex; } if (selectIndex == -1) { curIndex = 0; foreach (HelpLanguage helpLanguage in helpLanguages) { if (helpLanguage.Code.Equals(twoLetterIsoLanguageName)) { selectIndex = curIndex; break; } ++curIndex; } } if (selectIndex == -1 && 0 < helpLanguages.Length) { selectIndex = 0; } if (selectIndex != -1) { comboBoxHelpLanguage.SelectedIndex = selectIndex; } } m_UpdateCheckNotification = new UpdateCheckNotificationTarget(this, new UpdateCheckedDelegate(OnUpdateChecked)); }
// // Public members: // // Internal members: internal MainForm() { InitializeComponent(); this.Icon = Program.Icon; this.pictureBoxHelp.Image = SystemIcons.Information.ToBitmap(); this.pictureBoxPathError.Image = SystemIcons.Warning.ToBitmap(); this.Text = L10n._p("Window title, args: {0} - version", "Half-Life Advanced Effects {0}", System.Diagnostics.FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).FileVersion); this.fileToolStripMenuItem.Text = L10n._p("Main window | menu", "File"); this.menuLaunchCSGO.Text = L10n._p("Main window | menu | File", "Launch CS:GO"); this.launchGoldSrcToolStripMenuItem.Text = L10n._p("Main window | menu | File", "Launch GoldSrc"); this.menuExit.Text = L10n._p("Main window | menu | File", "Exit"); this.viewToolStripMenuItem.Text = L10n._p("Main Window | menu", "View"); this.menuStatusBar.Text = L10n._p("Main window | menu | View", "Status Bar"); this.toolsToolStripMenuItem.Text = L10n._p("Main window | menu", "Tools"); this.calculatorsToolStripMenuItem.Text = L10n._p("Main window | menu | Tools", "Calculators"); this.menuFileSize.Text = L10n._p("Main window | menu | Tools | Calculators", "File Size"); this.menuAfxRgbaLut.Text = L10n._p("Main window | menu | Tools", "Color Lookup Tables"); this.menuVoronoi.Text = L10n._p("Main window | menu | Tools | Color Lookup Tables", "Voronoi"); this.goldSrcToolStripMenuItem.Text = L10n._p("Main window | menu | Tools", "GoldSrc"); this.demoToolsToolStripMenuItem.Text = L10n._p("Main window | menu | Tools | GoldSrc", "Demo Tools"); this.skyManagerToolStripMenuItem.Text = L10n._p("Main window | menu | Tools | GoldSrc", "Sky Manager"); this.developerToolStripMenuItem.Text = L10n._p("Main window | menu | Tools", "Developer"); this.menuCustomLoader.Text = L10n._p("Main window | menu | Tools | Developer", "Custom Loader"); this.menuGuidToClipBoard.Text = L10n._p("Main window | menu | Tools | Developer", "Own GUID to ClipBoard"); this.menuNewGuidToClipBoard.Text = L10n._p("Main window | menu | Tools | Developer", "New GUID to ClipBoard"); this.helpToolStripMenuItem.Text = L10n._p("Main window | menu", "Help"); this.checkForUpdatesToolStripMenuItem.Text = L10n._p("Main window | menu | Help", "Check for Updates"); this.menuAutoUpdateCheck.Text = L10n._p("Main window | menu | Help | Check for Updates", "Auto Check"); this.checkNowToolStripMenuItem.Text = L10n._p("Main window | menu | Help | Check for Updates", "Check Now"); this.menuAdvancedFxOrg.Text = L10n._p("Main window | menu | Help", "Official Website"); this.donateToolStripMenuItem.Text = L10n._p("Main window | menu", "Donate"); this.checkUpdatesLabel.Text = L10n._p("Main window | check updates strip", "Check for updates automatically?"); this.statusLabelAutoYes.Text = L10n._p("Main window | check updates strip", "Yes"); this.statusLabelAutoNo.Text = L10n._p("Main window | check updates strip", "No"); this.statusLabelIgnore.Text = L10n._p("Main window | update status strip", "Ignore"); this.statusLabelHide.Text = L10n._p("Main window | update status strip", "OK"); this.statusLabelUpdate.Text = L10n._p("Main window | update status strip | label", "Update status unknown"); this.menuContact.Text = L10n._("Contact / Privacy Policy / Imprint (advancedfx.org)"); this.groupBoxHelp.Text = L10n._("Help"); this.labelHelpLanguage.Text = L10n._("Language:"); this.labelHelpSelection.Text = L10n._("Selection:"); { HelpEntry officialEnglishSupportPage = new HelpEntry(L10n._("Official support page (English)"), "https://www.advancedfx.org/support/"); HelpEntry chinesePage = new HelpEntry(L10n._("HLAE Chinese Station"), "https://hlae.site/"); helpLanguages = new HelpLanguage[] { new HelpLanguage("en", L10n._p("Language", "English (en)"), new HelpEntry[] { officialEnglishSupportPage }), new HelpLanguage("zh-CN", L10n._p("Language", "Chinese (zh-CN)"), new HelpEntry[] { chinesePage }) }; this.comboBoxHelpLanguage.Items.AddRange(helpLanguages); string ietfLanguageTag = System.Globalization.CultureInfo.CurrentUICulture.IetfLanguageTag; string twoLetterIsoLanguageName = System.Globalization.CultureInfo.CurrentUICulture.TwoLetterISOLanguageName; // Select a default language: int selectIndex = -1; int curIndex = 0; foreach (HelpLanguage helpLanguage in helpLanguages) { if (helpLanguage.Code.Equals(ietfLanguageTag)) { selectIndex = curIndex; break; } ++curIndex; } if (selectIndex == -1) { curIndex = 0; foreach (HelpLanguage helpLanguage in helpLanguages) { if (helpLanguage.Code.Equals(twoLetterIsoLanguageName)) { selectIndex = curIndex; break; } ++curIndex; } } if (selectIndex == -1 && 0 < helpLanguages.Length) { selectIndex = 0; } if (selectIndex != -1) { comboBoxHelpLanguage.SelectedIndex = selectIndex; } } bool bHlaePathOk = System.Text.RegularExpressions.Regex.IsMatch(Program.BaseDir, "^\\p{IsBasicLatin}*$"); this.groupBoxPathError.Visible = !bHlaePathOk; this.groupBoxPathError.Enabled = !bHlaePathOk; this.groupBoxPathError.Text = L10n._("HLAE path error"); this.labelHlaePath.Text = L10n._("HLAE path:"); this.textBoxHlaePath.Text = Program.BaseDir; this.labelHlaePathError.Text = L10n._("Warning: Your HLAE path shown above contains non-basic latin characters (meaning characters outside the 7-bit ASCII range), which will lead to multiple problems in-game if not fixed!"); m_UpdateCheckNotification = new UpdateCheckNotificationTarget(this, new UpdateCheckedDelegate(OnUpdateChecked)); }