/// <summary> /// Called when "New language pair..." menu item was clicked /// </summary> private void EditorControl_TranslateRequested(TRANSLATE_PROVIDER provider) { try { NewLanguagePairWindow win = new NewLanguagePairWindow(true); // select or create new language pair if (win.ShowDialog() == DialogResult.OK) { if (win.AddToList && LanguagePairAdded != null) { LanguagePairAdded(win.SourceLanguage, win.TargetLanguage); // add the language pair to the settings list } EditorControl_TranslateRequested(provider, win.SourceLanguage, win.TargetLanguage); // perform translation } } catch (Exception ex) { VLOutputWindow.VisualLocalizerPane.WriteException(ex); VisualLocalizer.Library.Components.MessageBox.ShowException(ex); } }
/// <summary> /// Adds new language pair by displaying dialog /// </summary> private void AddButton_Click(object sender, EventArgs e) { try { NewLanguagePairWindow win = new NewLanguagePairWindow(false); if (win.ShowDialog() == DialogResult.OK) { SettingsObject.LanguagePair newPair = new SettingsObject.LanguagePair() { FromLanguage = win.SourceLanguage, ToLanguage = win.TargetLanguage }; if (languagePairsBox.Items.Contains(newPair)) { throw new Exception("This language pair is already in the list!"); } languagePairsBox.Items.Add(newPair); } } catch (Exception ex) { VLOutputWindow.VisualLocalizerPane.WriteException(ex); VisualLocalizer.Library.Components.MessageBox.ShowException(ex); } }