public ITranslationProvider CreateTranslationProvider(Uri translationProviderUri, string translationProviderState, ITranslationProviderCredentialStore credentialStore)
        {
            if (!SupportsTranslationProviderUri(translationProviderUri))
            {
                throw new Exception("Cannot handle URI.");
            }

            TartuNLPProvider tp = new TartuNLPProvider(new TartuNLPOptions(translationProviderUri));

            return(tp);
        }
 public ITranslationProvider[] Browse(IWin32Window owner, LanguagePair[] languagePairs, ITranslationProviderCredentialStore credentialStore)
 {
     if (languagePairs.Length > 0)
     {
         TartuNLPConfigForm dialog = new TartuNLPConfigForm(new TartuNLPOptions(), languagePairs);
         if (dialog.ShowDialog(owner) == DialogResult.OK)
         {
             TartuNLPProvider testProvider = new TartuNLPProvider(dialog.Options);
             return(new ITranslationProvider[] { testProvider });
         }
     }
     else
     {
         MessageBox.Show("Please configure at least one language pair before setting up the plugin", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     return(null);
 }
        public bool Edit(IWin32Window owner, ITranslationProvider translationProvider, LanguagePair[] languagePairs, ITranslationProviderCredentialStore credentialStore)
        {
            TartuNLPProvider editProvider = translationProvider as TartuNLPProvider;

            if (editProvider == null)
            {
                return(false);
            }

            TartuNLPConfigForm dialog = new TartuNLPConfigForm(editProvider.Options, languagePairs);

            if (dialog.ShowDialog(owner) == DialogResult.OK)
            {
                editProvider.Options = dialog.Options;
                return(true);
            }
            return(false);
        }
 public TartuNLPProviderLanguageDirection(TartuNLPProvider provider, LanguagePair languages)
 {
     _provider          = provider;
     _languageDirection = languages;
     _options           = _provider.Options;
 }