Beispiel #1
0
        public ITranslationProvider[] Browse(IWin32Window owner, LanguagePair[] languagePairs, ITranslationProviderCredentialStore credentialStore)
        {
            List <ITranslationProvider>   mtProviders          = new List <ITranslationProvider>();
            ControlledMtProvidersProvider controlledMTProvider = new ControlledMtProvidersProvider();

            using (MTProvidersDialog pd = new MTProvidersDialog(controlledMTProvider))
            {
                DialogResult result = pd.ShowDialog(owner);

                if (result != DialogResult.OK)
                {
                    return(null);
                }

                var mtProvidersUi = pd.SelectedTranslationProvidersWinformsUI;

                if (mtProvidersUi.Count == 0)
                {
                    return(null);
                }
                foreach (var mtProviderUi in mtProvidersUi)
                {
                    var innerProviders = mtProviderUi.Browse(owner, languagePairs, credentialStore);
                    if (innerProviders != null && innerProviders.All(x => x.TranslationMethod == TranslationMethod.MachineTranslation))
                    {
                        mtProviders.AddRange(innerProviders);
                    }
                }
            }

            return(new ITranslationProvider[] { new ControlledMtProvidersProvider(mtProviders) });
        }
        public ITranslationProvider[] Browse(IWin32Window owner, LanguagePair[] languagePairs, ITranslationProviderCredentialStore credentialStore)
        {
            List<ITranslationProvider> mtProviders = new List<ITranslationProvider>();
            ControlledMtProvidersProvider controlledMTProvider = new ControlledMtProvidersProvider();

            using (MTProvidersDialog pd = new MTProvidersDialog(controlledMTProvider))
            {
                DialogResult result = pd.ShowDialog(owner);

                if(result != DialogResult.OK)
                {
                    return null;
                }

                var mtProvidersUi = pd.SelectedTranslationProvidersWinformsUI;

                if (mtProvidersUi.Count == 0) return null;
                foreach (var mtProviderUi in mtProvidersUi)
                {
                    var innerProviders = mtProviderUi.Browse(owner, languagePairs, credentialStore);
                    if (innerProviders != null && innerProviders.All(x => x.TranslationMethod == TranslationMethod.MachineTranslation))
                    {
                        mtProviders.AddRange(innerProviders);
                    }
                }
            }

            return new ITranslationProvider[] { new ControlledMtProvidersProvider(mtProviders) };
        }
Beispiel #3
0
 public CascadeLanguageDirection(ControlledMtProvidersProvider provider, LanguagePair languagePair)
 {
     _provider     = provider;
     _languagePair = languagePair;
 }
 public CascadeLanguageDirection(ControlledMtProvidersProvider provider,LanguagePair languagePair)
 {
     _provider = provider;
     _languagePair = languagePair;
 }