예제 #1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            IList <ITranslationProviderWinFormsUI> uis = TranslationProviderManager.GetTranslationProviderWinFormsUIs();

            var mtProvidersUri       = _controlledMTProvider.GetAllMtProvidersUri();
            var selectedProvidersUri = _controlledMTProvider.GetSelectedMtProvidersUri();

            foreach (ITranslationProviderWinFormsUI ui in uis)
            {
                if (mtProvidersUri.Any(x => ui.SupportsTranslationProviderUri(x)))
                {
                    var isChecked = selectedProvidersUri.Any(x => ui.SupportsTranslationProviderUri(x));
                    clbProviders.Items.Add(new ProviderItem {
                        Provider = ui
                    }, isChecked);
                }
            }

            clbProviders.SelectedIndex = 0;
        }
예제 #2
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            IList <ITranslationProviderWinFormsUI> uis = TranslationProviderManager.GetTranslationProviderWinFormsUIs();
            var selectedMtProviders   = _controlledMtProvider.GetSelectedMtProvidersUri();
            var defaultMtProvidersUri = _controlledMtProvider.GetDefaultMtProvidersUri();


            foreach (ITranslationProviderWinFormsUI ui in uis)
            {
                //exclude the default MT providers
                if (!CheckIfDefaultMTProvider(ui, defaultMtProvidersUri) &&
                    !ui.SupportsTranslationProviderUri(new Uri(ControlledMtProvidersProvider.ProviderUri)))
                {
                    var isChecked = IsMTProviderChecked(ui, selectedMtProviders);
                    clbProviders.Items.Add(new ProviderItem {
                        Provider = ui
                    }, isChecked);
                }
            }

            clbProviders.SelectedIndex = 0;
        }