/// <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> public ITranslationProvider[] Browse(IWin32Window owner, LanguagePair[] languagePairs, ITranslationProviderCredentialStore credentialStore) { _logger.Trace(""); var dialog = new ProviderConfDialog(new TranslationOptions(), credentialStore, languagePairs); if (dialog.ShowDialog(owner) == DialogResult.OK) { return(new ITranslationProvider[] { new TranslationProvider(dialog.Options) }); } return(null); }
/// <summary> /// Can be used in implementations in which a user login is required, e.g. /// for connecting to an online translation provider. /// Trados Studio fires calls method when a TranslationProviderAuthenticationException is thrown (e.g. in the TranslationProviderFactory class) /// If credentials are not required simply set /// this member to return always True. /// </summary> /// <param name="owner"></param> /// <param name="translationProviderUri"></param> /// <param name="translationProviderState"></param> /// <param name="credentialStore"></param> /// <returns></returns> public bool GetCredentialsFromUser(IWin32Window owner, Uri translationProviderUri, string translationProviderState, ITranslationProviderCredentialStore credentialStore) { _logger.Trace(""); var options = new TranslationOptions(translationProviderUri); //only show controls for setting credentials, as that is the only thing that will end up getting saved var dialog = new ProviderConfDialog(options, credentialStore, null); dialog.DisplayForCredentialsOnly(); return(dialog.ShowDialog(owner) == DialogResult.OK); }
/// <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> public bool Edit( IWin32Window owner, ITranslationProvider translationProvider, LanguagePair[] languagePairs, ITranslationProviderCredentialStore credentialStore) { _logger.Trace(""); var editProvider = translationProvider as TranslationProvider; if (editProvider == null) { return(false); } var dialog = new ProviderConfDialog(editProvider.Options, credentialStore, languagePairs); if (dialog.ShowDialog(owner) == DialogResult.OK) { editProvider.Options = dialog.Options; return(true); } return(false); }