示例#1
0
        public QueryEvaluator(
            IFileWatcherFactory fileWatcherFactory,
            ILazyThumbnailFactory thumbnailFactory,
            IEntityManager entities,
            IExecutableQuery query)
        {
            _entities         = entities;
            _fileWatcher      = fileWatcherFactory.Create();
            _thumbnailFactory = thumbnailFactory;
            Query             = query;

            // initialize internal structures
            Cancellation = new CancellationTokenSource();
            Comparer     = new EntityViewComparer(Query.Comparer);
            _backBuffer  = new List <Group>();
            _frontBuffer = new List <Group>();

            // register event handlers
            _fileWatcher.Renamed += FileWatcherOnRenamed;
            _fileWatcher.Deleted += FileWatcherOnDeleted;
            _fileWatcher.Created += FileWatcherOnCreated;
            _entities.Deleted    += EntitiesOnDeleted;
            _entities.Changed    += EntitiesOnChanged;
            _entities.Moved      += EntitiesOnMoved;
        }
示例#2
0
 public QueryViewManager(
     IQueryViewRepository queryViews,
     IFileSystem fileSystem,
     IFileWatcherFactory fileWatcherFactory)
 {
     _queryViews           = queryViews;
     _fileSystem           = fileSystem;
     _fileWatcher          = fileWatcherFactory.Create();
     _fileWatcher.Deleted += FileWatcherOnDeleted;
     _fileWatcher.Renamed += FileWatcherOnRenamed;
     _fileWatcher.Changed += FileWatcherOnChanged;
 }
示例#3
0
        // Methods

        private void CreateFileWatcher(FileNode current)
        {
            var path    = Path.Combine(current.Directory, current.FileName);
            var watcher = _fileWatcherFactory.Create(new FileInfo(path));

            watcher.FileChanged += async(fileInfo) => await Watcher_FileChanged(fileInfo);

            _fileWatchers.Add(watcher);
            if (current.LogEntries.Count() == 0)
            {
                watcher.Initialize();
            }
        }