Exemplo n.º 1
0
        public ITerminologyProvider[] Browse(IWin32Window owner, ITerminologyProviderCredentialStore credentialStore)
        {
            var messageBoxService = new MessageBoxService();

            if (IATEApplication.ConnectionProvider.EnsureConnection())
            {
                var sqlDatabaseProvider = new SqliteDatabaseProvider(new PathInfo());
                var cacheProvider       = new CacheProvider(sqlDatabaseProvider);

                _settingsViewModel = new SettingsViewModel(null, IATEApplication.InventoriesProvider, cacheProvider, messageBoxService);
                _settingsWindow    = new SettingsWindow {
                    DataContext = _settingsViewModel
                };

                _settingsWindow.ShowDialog();
                if (!_settingsViewModel.DialogResult)
                {
                    return(null);
                }

                var settings = _settingsViewModel.ProviderSettings;
                var provider = new IATETerminologyProvider(settings, IATEApplication.ConnectionProvider, IATEApplication.InventoriesProvider, cacheProvider);

                return(new ITerminologyProvider[] { provider });
            }

            var exception = new Exception("Failed login!");

            _logger.Error(exception);

            throw exception;
        }
        public ITerminologyProvider CreateTerminologyProvider(Uri terminologyProviderUri, ITerminologyProviderCredentialStore credentials)
        {
            var savedSettings        = SettingsService.GetSettingsForCurrentProject();
            var savedTermTypesNumber = savedSettings?.TermTypes.Count;

            if (savedTermTypesNumber > 0 && savedTermTypesNumber > IATEApplication.InventoriesProvider.TermTypes?.Count)
            {
                var availableTermTypes = GetAvailableTermTypes(savedSettings.TermTypes);
                savedSettings.TermTypes = new List <TermTypeModel>(availableTermTypes);
            }

            if (!IATEApplication.ConnectionProvider.EnsureConnection())
            {
                var exception = new Exception("Failed login!");
                _logger.Error(exception);

                throw exception;
            }

            var sqlDatabaseProvider = new SqliteDatabaseProvider(new PathInfo());
            var cacheProvider       = new CacheProvider(sqlDatabaseProvider);

            var terminologyProvider = new IATETerminologyProvider(savedSettings,
                                                                  IATEApplication.ConnectionProvider, IATEApplication.InventoriesProvider, cacheProvider);

            return(terminologyProvider);
        }
        private ITerminologyProvider[] SetTerminologyProvider(IATETerminologyProvider provider,
                                                              SettingsModel providerSettings)
        {
            var result            = new List <ITerminologyProvider>();
            var messageBoxService = new MessageBoxService();

            _settingsViewModel = new SettingsViewModel(providerSettings, messageBoxService);
            _settingsWindow    = new SettingsWindow
            {
                DataContext = _settingsViewModel
            };

            _settingsWindow.ShowDialog();
            if (!_settingsViewModel.DialogResult)
            {
                return(null);
            }
            providerSettings = _settingsViewModel.ProviderSettings;

            if (provider is null)
            {
                provider = new IATETerminologyProvider(providerSettings);
            }
            else
            {
                provider.UpdateSettings(providerSettings);
            }

            result.Add(provider);

            return(result.ToArray());
        }
Exemplo n.º 4
0
        public ITerminologyProvider CreateTerminologyProvider(Uri terminologyProviderUri, ITerminologyProviderCredentialStore credentials)
        {
            var savedSettings = new SettingsModel(terminologyProviderUri);

            var terminologyProvider = new IATETerminologyProvider(savedSettings);

            return(terminologyProvider);
        }
        public ITerminologyProvider CreateTerminologyProvider(Uri terminologyProviderUri, ITerminologyProviderCredentialStore credentials)
        {
            var savedSettings = new SettingsModel(terminologyProviderUri);

            if (!IATEApplication.ConnectionProvider.EnsureConnection())
            {
                var exception = new Exception("Failed login!");
                _logger.Error(exception);

                throw exception;
            }

            var terminologyProvider = new IATETerminologyProvider(savedSettings,
                                                                  IATEApplication.ConnectionProvider, IATEApplication.InventoriesProvider);

            return(terminologyProvider);
        }
        public ITerminologyProvider CreateTerminologyProvider(Uri terminologyProviderUri, ITerminologyProviderCredentialStore credentials)
        {
            var settingsService  = new IateSettingsService();
            var savedSettings    = settingsService.GetProviderSettings();
            var providerSettings = new SettingsModel
            {
                Domains   = new List <DomainModel>(),
                TermTypes = new List <TermTypeModel>()
            };

            if (savedSettings != null)
            {
                providerSettings.Domains.AddRange(savedSettings.Domains);
                providerSettings.TermTypes.AddRange(savedSettings.TermTypes);
            }
            var terminologyProvider = new IATETerminologyProvider(providerSettings);

            return(terminologyProvider);
        }
Exemplo n.º 7
0
        public ITerminologyProvider[] Browse(IWin32Window owner, ITerminologyProviderCredentialStore credentialStore)
        {
            _mainWindow = IATEApplication.GetMainWindow();
            if (_mainWindow != null)
            {
                _mainWindow.ShowDialog();
                if (!_mainWindow?.DialogResult ?? true)
                {
                    return(null);
                }

                var provider = new IATETerminologyProvider(_mainWindow.ProviderSettings, IATEApplication.ConnectionProvider,
                                                           IATEApplication.InventoriesProvider, IATEApplication.CacheProvider);

                return(new ITerminologyProvider[] { provider });
            }

            var exception = new Exception("Failed login!");

            _logger.Error(exception);

            throw exception;
        }
 public void Initialize(ITerminologyProvider terminologyProvider, CultureInfo source, CultureInfo target)
 {
     _iateTerminologyProvider = (IATETerminologyProvider)terminologyProvider;
 }