public ITerminologyProvider CreateTerminologyProvider(Uri terminologyProviderUri,
                                                              ITerminologyProviderCredentialStore credentials)
        {
            TerminologyProviderExcel terminologyProvider;

            try
            {
                var persistenceService = new PersistenceService();

                var providerSettings = persistenceService.Load(terminologyProviderUri);

                //in case we didn't any settings stored there is no need to load the provider
                if (providerSettings == null)
                {
                    return(null);
                }

                var termSearchService = new NormalTermSeachService(providerSettings);
                terminologyProvider = new TerminologyProviderExcel(providerSettings, termSearchService);
                Task.Run(terminologyProvider.LoadEntries);
            }
            catch (Exception ex)
            {
                Log.Logger.Error($"CreateTerminologyProvider method: {ex.Message}\n {ex.StackTrace}");
                throw ex;
            }
            return(terminologyProvider);
        }
        public ITerminologyProvider[] Browse(IWin32Window owner, ITerminologyProviderCredentialStore credentialStore)
        {
            var result = new List <ITerminologyProvider>();

            try
            {
                var settingsDialog = new Settings();
                var dialogResult   = settingsDialog.ShowDialog();

                if (dialogResult == DialogResult.OK ||
                    dialogResult == DialogResult.Yes)
                {
                    var settings = settingsDialog.GetSettings();

                    var persistenceService = new PersistenceService();

                    var provider = new TerminologyProviderExcel(settings);
                    settings.Uri = provider.Uri;
                    persistenceService.AddSettings(settings);
                    var providerSettings  = persistenceService.Load(provider.Uri);
                    var termSearchService = new NormalTermSeachService(providerSettings);

                    var excelProvider = new TerminologyProviderExcel(providerSettings, termSearchService);

                    result.Add(excelProvider);
                }
            }
            catch (Exception ex)
            {
                Log.Logger.Error($"Browse method: {ex.Message}\n {ex.StackTrace}");
                throw ex;
            }
            return(result.ToArray());
        }
 public void Release()
 {
     _terminologyProvider = null;
 }
 public void Initialize(ITerminologyProvider terminologyProvider, CultureInfo source, CultureInfo target)
 {
     _terminologyProvider = (TerminologyProviderExcel)terminologyProvider;
 }