Exemple #1
0
        public void UpdateNavigationSettings(INavigationService navigationService, Settings settings)
        {
            if (navigationService == null)
            {
                throw new ArgumentNullException("navigationService");
            }

            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            INavigatorManager        primaryNavigatorManager    = CreateNavigatorManager(settings.PrimaryNavigator, settings);
            List <INavigatorManager> supportedNavigatorManagers = CreateSupportedNavigatorManagers(settings, primaryNavigatorManager);

            navigationService.PrimaryNavigatorManager    = primaryNavigatorManager;
            navigationService.SupportedNavigatorManagers = supportedNavigatorManagers;

            CachedFileSystemParser parser = navigationService.FileSystemParser as CachedFileSystemParser;

            if (parser != null)
            {
                parser.ExcludeFolderTemplates = settings.ExcludeFolderTemplates;
                parser.FoldersToParse         = settings.FoldersToParse;
            }

            //Warming up (to fill caches, etc)
            navigationService.GetFolderMatches("temp");
        }
 public NavigationService(IFileSystemParser fileSystemParser,
     IMatchSearcher matchSearcher,
     INavigatorManager primaryNavigatorManager,
     List<INavigatorManager> supportedNavigatorManagers)
 {
     _fileSystemParser = fileSystemParser;
     _matchSearcher = matchSearcher;
     _primaryNavigatorManager = primaryNavigatorManager;
     _supportedNavigatorManagers = supportedNavigatorManagers;
 }
 public NavigationService(IFileSystemParser fileSystemParser,
                          IMatchSearcher matchSearcher,
                          INavigatorManager primaryNavigatorManager,
                          List <INavigatorManager> supportedNavigatorManagers)
 {
     _fileSystemParser           = fileSystemParser;
     _matchSearcher              = matchSearcher;
     _primaryNavigatorManager    = primaryNavigatorManager;
     _supportedNavigatorManagers = supportedNavigatorManagers;
 }
        public void SetUp()
        {
            _fileSystemParserMock = new Mock <IFileSystemParser>();
            _matchSearcherMock    = new Mock <IMatchSearcher>();
            _primaryManagerMock   = new Mock <INavigatorManager>();
            _secondaryManagerMock = new Mock <INavigatorManager>();

            _primaryManager    = _primaryManagerMock.Object;
            _secondaryManager  = _secondaryManagerMock.Object;
            _supportedManagers = new List <INavigatorManager> {
                _primaryManager, _secondaryManager
            };

            _navigationService = new NavigationService(_fileSystemParserMock.Object,
                                                       _matchSearcherMock.Object,
                                                       _primaryManager,
                                                       _supportedManagers);
        }
Exemple #5
0
        public INavigationService BuildNavigationService(Settings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            IFileSystemParser parser = CreateParser(settings);

            INavigatorManager        primaryNavigatorManager    = CreateNavigatorManager(settings.PrimaryNavigator, settings);
            List <INavigatorManager> supportedNavigatorManagers = CreateSupportedNavigatorManagers(settings, primaryNavigatorManager);

            INavigationService navigationAssistant = new NavigationService(parser,
                                                                           new MatchSearcher(),
                                                                           primaryNavigatorManager,
                                                                           supportedNavigatorManagers);

            //Warming up (to fill caches, etc)
            navigationAssistant.GetFolderMatches("temp");

            return(navigationAssistant);
        }
        public void SetUp()
        {
            _fileSystemParserMock = new Mock<IFileSystemParser>();
            _matchSearcherMock = new Mock<IMatchSearcher>();
            _primaryManagerMock = new Mock<INavigatorManager>();
            _secondaryManagerMock = new Mock<INavigatorManager>();

            _primaryManager = _primaryManagerMock.Object;
            _secondaryManager = _secondaryManagerMock.Object;
            _supportedManagers = new List<INavigatorManager> {_primaryManager, _secondaryManager};

            _navigationService = new NavigationService(_fileSystemParserMock.Object,
                                                       _matchSearcherMock.Object,
                                                       _primaryManager,
                                                       _supportedManagers);
        }
        private static List<INavigatorManager> CreateSupportedNavigatorManagers(Settings settings, INavigatorManager primaryNavigatorManager)
        {
            List<Navigators> additionalNavigators = new List<Navigators>(settings.SupportedNavigators);
            additionalNavigators.Remove(settings.PrimaryNavigator);

            List<INavigatorManager> supportedNavigatorManagers =
                additionalNavigators
                    .Select(navigator => CreateNavigatorManager(navigator, settings))
                    .ToList();

            supportedNavigatorManagers.Add(primaryNavigatorManager);

            return supportedNavigatorManagers;
        }
Exemple #8
0
        private static List <INavigatorManager> CreateSupportedNavigatorManagers(Settings settings, INavigatorManager primaryNavigatorManager)
        {
            List <Navigators> additionalNavigators = new List <Navigators>(settings.SupportedNavigators);

            additionalNavigators.Remove(settings.PrimaryNavigator);

            List <INavigatorManager> supportedNavigatorManagers =
                additionalNavigators
                .Select(navigator => CreateNavigatorManager(navigator, settings))
                .ToList();

            supportedNavigatorManagers.Add(primaryNavigatorManager);

            return(supportedNavigatorManagers);
        }