Пример #1
0
        public LibraryView(ITagCache tags, IPathsCache paths, IBinariesCache binaries, Dispatcher dispatcher, ILibraryOperations libraryOps, IErrorHandler errorHandler, IFileValidator fileValidator, IEventAggregator eventAggregator)
        {
            _tags            = tags;
            _paths           = paths;
            _binariesCache   = binaries;
            _dispatcher      = dispatcher;
            _eventAggregator = eventAggregator;
            _sourceNodes     = new ObservableCollection <LibraryViewNode>();
            _nodeViewer      = new PropertyOrderedObservableCollectionViewer <LibraryViewNode>(_dispatcher);
            _nodeViewer.SetMediator(this);
            _nodeViewer.Attach(_sourceNodes);
            _nodeViewer.OrderBy(f => f.Name, new [] { "Name" }, false);

            _eventAggregator.AddListener(this, _dispatcher);
            LoadedBinariesCache = new LoadedBinaryCache(100, binaries);

            Operations = new LibraryContentOperations(libraryOps, this, errorHandler, fileValidator, _dispatcher, _eventAggregator);

            _dispatcher.BeginInvoke(new Action(PerformLoad));
        }
Пример #2
0
        public void SetUp()
        {
            _dataCache = new MockBinaryDataCache();
            _binaries  = new MockBinariesCache(_dataCache);

            var random = new Random();

            _bytes = new byte[BinaryDataStorageClass.MaxBufferSize * 2];
            random.NextBytes(_bytes);

            _items = Enumerable.Range(0, 40).Select(i => new BinaryStorageClass {
                Id = Guid.NewGuid()
            }).ToList();

            foreach (var bsc in _items)
            {
                _binaries.Add(bsc, _bytes);
            }

            _cache = new LoadedBinaryCache(CacheCapacity, _binaries);
        }
Пример #3
0
 public DisplayVm(LoadedBinaryCache binariesCache)
 {
     _binariesCache = binariesCache;
 }