Exemple #1
0
        public ApplicationDataUpdateWhenPathReferenceCountChanged(
            IEventAggregator eventAggregator,
            RecentlyAccessManager recentlyAccessManager,
            BookmarkManager bookmarkManager,
            StorageItemSearchManager storageItemSearchManager,
            FolderContainerTypeManager folderContainerTypeManager,
            ThumbnailManager thumbnailManager,
            SecondaryTileManager secondaryTileManager,
            FolderLastIntractItemManager folderLastIntractItemManager
            )
        {
            _eventAggregator              = eventAggregator;
            _recentlyAccessManager        = recentlyAccessManager;
            _bookmarkManager              = bookmarkManager;
            _storageItemSearchManager     = storageItemSearchManager;
            _folderContainerTypeManager   = folderContainerTypeManager;
            _thumbnailManager             = thumbnailManager;
            _folderLastIntractItemManager = folderLastIntractItemManager;
            _eventAggregator.GetEvent <PathReferenceCountManager.PathReferenceAddedEvent>()
            .Subscribe(args =>
            {
            }
                       , keepSubscriberReferenceAlive: true
                       )
            .AddTo(_disposables);

            _eventAggregator.GetEvent <PathReferenceCountManager.PathReferenceRemovedEvent>()
            .Subscribe(async args =>
            {
                _recentlyAccessManager.Delete(args.Path);
                _bookmarkManager.RemoveBookmark(args.Path);
                _storageItemSearchManager.Remove(args.Path);
                _folderContainerTypeManager.Delete(args.Path);
                _folderLastIntractItemManager.Remove(args.Path);
                await _thumbnailManager.DeleteFromPath(args.Path);
                await secondaryTileManager.RemoveSecondaryTile(args.Path);
            }
                       , keepSubscriberReferenceAlive: true
                       )
            .AddTo(_disposables);
        }