public DeepLMtTranslationProviderLanguageDirection(DeepLMtTranslationProvider deepLMtTranslationProvider, LanguagePair languageDirection, DeepLTranslationProviderConnecter connecter) { _deepLMtTranslationProvider = deepLMtTranslationProvider; _languageDirection = languageDirection; _options = deepLMtTranslationProvider.Options; _connecter = connecter; }
public ITranslationProvider[] Browse(IWin32Window owner, LanguagePair[] languagePairs, ITranslationProviderCredentialStore credentialStore) { var options = new DeepLTranslationOptions(); //get credentials var credentials = GetCredentials(credentialStore, PluginResources.DeeplTranslationProviderScheme); var dialog = new DeepLWindow(options, credentials, languagePairs); ElementHost.EnableModelessKeyboardInterop(dialog); dialog.ShowDialog(); if (dialog.DialogResult.HasValue && dialog.DialogResult.Value) { var provider = new DeepLMtTranslationProvider(options, new DeepLTranslationProviderConnecter(options.ApiKey, options.Formality), languagePairs) { Options = dialog.Options }; var apiKey = dialog.Options.ApiKey; SetDeeplCredentials(credentialStore, apiKey, true); return(new ITranslationProvider[] { provider }); } return(null); }