/// <summary> /// Show the plug-in settings form when the user is adding the translation provider plug-in /// through the GUI of SDL Trados Studio /// </summary> /// <param name="owner"></param> /// <param name="languagePairs"></param> /// <param name="credentialStore"></param> /// <returns></returns> #region "Browse" public ITranslationProvider[] Browse(IWin32Window owner, LanguagePair[] languagePairs, ITranslationProviderCredentialStore credentialStore) { OpusCatOptionsFormWPF dialog = new OpusCatOptionsFormWPF(new OpusCatOptions(), languagePairs, credentialStore); if (dialog.ShowDialog(owner) == DialogResult.OK) { OpusCatProvider testProvider = new OpusCatProvider(dialog.Options, credentialStore); return(new ITranslationProvider[] { testProvider }); } return(null); }
public OpusCatOptionControl(OpusCatOptionsFormWPF hostForm, OpusCatOptions options, Sdl.LanguagePlatform.Core.LanguagePair[] languagePairs) { this.DataContext = this; this.Options = options; this.projectLanguagePairs = languagePairs.Select( x => $"{x.SourceCulture.TwoLetterISOLanguageName}-{x.TargetCulture.TwoLetterISOLanguageName}").ToList(); InitializeComponent(); this.ConnectionControl.LanguagePairs = this.projectLanguagePairs; //Null indicates that all properties have changed. Populates the WPF form PropertyChanged(this, new PropertyChangedEventArgs(null)); this.hostForm = hostForm; }
/// <summary> /// If the plug-in settings can be changed by the user, /// SDL Trados Studio will display a Settings button. /// By clicking this button, users raise the plug-in user interface, /// in which they can modify any applicable settings. /// </summary> /// <param name="owner"></param> /// <param name="translationProvider"></param> /// <param name="languagePairs"></param> /// <param name="credentialStore"></param> /// <returns></returns> #region "Edit" public bool Edit(IWin32Window owner, ITranslationProvider translationProvider, LanguagePair[] languagePairs, ITranslationProviderCredentialStore credentialStore) { OpusCatProvider editProvider = translationProvider as OpusCatProvider; if (editProvider == null) { return(false); } OpusCatOptionsFormWPF dialog = new OpusCatOptionsFormWPF(editProvider.Options, languagePairs, credentialStore); if (dialog.ShowDialog(owner) == DialogResult.OK) { return(true); } return(false); }