public FolderListupPageViewModel( BookmarkManager bookmarkManager, ImageCollectionManager imageCollectionManager, SourceStorageItemsRepository sourceStorageItemsRepository, PathReferenceCountManager PathReferenceCountManager, SecondaryTileManager secondaryTileManager, FolderLastIntractItemManager folderLastIntractItemManager, FolderListingSettings folderListingSettings, OpenPageCommand openPageCommand, OpenFolderItemCommand openFolderItemCommand, OpenImageViewerCommand openImageViewerCommand, OpenFolderListupCommand openFolderListupCommand, OpenWithExplorerCommand openWithExplorerCommand, SecondaryTileAddCommand secondaryTileAddCommand, SecondaryTileRemoveCommand secondaryTileRemoveCommand ) { _bookmarkManager = bookmarkManager; _imageCollectionManager = imageCollectionManager; _sourceStorageItemsRepository = sourceStorageItemsRepository; _PathReferenceCountManager = PathReferenceCountManager; SecondaryTileManager = secondaryTileManager; _folderLastIntractItemManager = folderLastIntractItemManager; _folderListingSettings = folderListingSettings; OpenPageCommand = openPageCommand; OpenFolderItemCommand = openFolderItemCommand; OpenImageViewerCommand = openImageViewerCommand; OpenFolderListupCommand = openFolderListupCommand; OpenWithExplorerCommand = openWithExplorerCommand; SecondaryTileAddCommand = secondaryTileAddCommand; SecondaryTileRemoveCommand = secondaryTileRemoveCommand; FolderItems = new ObservableCollection <StorageItemViewModel>(); ArchiveFileItems = new ObservableCollection <StorageItemViewModel>(); EBookFileItems = new ObservableCollection <StorageItemViewModel>(); ImageFileItems = new ObservableCollection <StorageItemViewModel>(); FileItemsView = new AdvancedCollectionView(ImageFileItems); SelectedFileSortType = new ReactivePropertySlim <FileSortType>(FileSortType.TitleAscending); FileDisplayMode = _folderListingSettings.ToReactivePropertyAsSynchronized(x => x.FileDisplayMode); FolderLastIntractItem = new ReactivePropertySlim <StorageItemViewModel>(); ImageLastIntractItem = new ReactivePropertySlim <int>(); /* * _currentQueryOptions = Observable.CombineLatest( * SelectedFolderViewFirstSort, * (queryType, sort) => (queryType, sort) * ) * .Select(_ => * { * var options = new QueryOptions(); * options.FolderDepth = FolderDepth.Shallow; * options.SetPropertyPrefetch(Windows.Storage.FileProperties.PropertyPrefetchOptions.ImageProperties, Enumerable.Empty<string>()); * return options; * }) * .ToReadOnlyReactivePropertySlim(); */ }
public SearchResultPageViewModel( StorageItemSearchManager storageItemSearchManager, SourceStorageItemsRepository sourceStorageItemsRepository, PathReferenceCountManager PathReferenceCountManager, FolderListingSettings folderListingSettings, BookmarkManager bookmarkManager, ThumbnailManager thumbnailManager, SecondaryTileManager secondaryTileManager, OpenFolderItemCommand openFolderItemCommand, OpenImageViewerCommand openImageViewerCommand, OpenFolderListupCommand openFolderListupCommand, OpenWithExplorerCommand openWithExplorerCommand, SecondaryTileAddCommand secondaryTileAddCommand, SecondaryTileRemoveCommand secondaryTileRemoveCommand ) { _storageItemSearchManager = storageItemSearchManager; _sourceStorageItemsRepository = sourceStorageItemsRepository; _PathReferenceCountManager = PathReferenceCountManager; _folderListingSettings = folderListingSettings; _bookmarkManager = bookmarkManager; _thumbnailManager = thumbnailManager; SecondaryTileManager = secondaryTileManager; OpenFolderItemCommand = openFolderItemCommand; OpenImageViewerCommand = openImageViewerCommand; OpenFolderListupCommand = openFolderListupCommand; OpenWithExplorerCommand = openWithExplorerCommand; SecondaryTileAddCommand = secondaryTileAddCommand; SecondaryTileRemoveCommand = secondaryTileRemoveCommand; }
public SourceStorageItemsPageViewModel( IEventAggregator eventAggregator, FolderListingSettings folderListingSettings, BookmarkManager bookmarkManager, ThumbnailManager thumbnailManager, PathReferenceCountManager PathReferenceCountManager, SourceStorageItemsRepository sourceStorageItemsRepository, RecentlyAccessManager recentlyAccessManager, SecondaryTileManager secondaryTileManager, SourceChoiceCommand sourceChoiceCommand, OpenFolderItemCommand openFolderItemCommand, OpenImageViewerCommand openImageViewerCommand, OpenFolderListupCommand openFolderListupCommand, OpenWithExplorerCommand openWithExplorerCommand, SecondaryTileAddCommand secondaryTileAddCommand, SecondaryTileRemoveCommand secondaryTileRemoveCommand ) { Folders = new ObservableCollection <StorageItemViewModel>(); RecentlyItems = new ObservableCollection <StorageItemViewModel>(); OpenFolderItemCommand = openFolderItemCommand; SourceChoiceCommand = sourceChoiceCommand; _sourceStorageItemsRepository = sourceStorageItemsRepository; _recentlyAccessManager = recentlyAccessManager; SecondaryTileManager = secondaryTileManager; _eventAggregator = eventAggregator; OpenImageViewerCommand = openImageViewerCommand; OpenFolderListupCommand = openFolderListupCommand; OpenWithExplorerCommand = openWithExplorerCommand; SecondaryTileAddCommand = secondaryTileAddCommand; SecondaryTileRemoveCommand = secondaryTileRemoveCommand; _bookmarkManager = bookmarkManager; _thumbnailManager = thumbnailManager; _PathReferenceCountManager = PathReferenceCountManager; _folderListingSettings = folderListingSettings; Groups = new[] { new SourceItemsGroup { GroupId = "Folders", Items = Folders, }, new SourceItemsGroup { GroupId = "RecentlyUsedFiles", Items = RecentlyItems, }, }; _eventAggregator.GetEvent <SourceStorageItemsRepository.AddedEvent>() .Subscribe(args => { var existInFolders = Folders.FirstOrDefault(x => x.Token == args.Token); if (existInFolders != null) { Folders.Remove(existInFolders); } var existInFiles = RecentlyItems.FirstOrDefault(x => x.Token == args.Token); if (existInFiles != null) { RecentlyItems.Remove(existInFiles); } var storageItemImageSource = new StorageItemImageSource(args.StorageItem, _thumbnailManager); if (storageItemImageSource.ItemTypes == Models.Domain.StorageItemTypes.Folder) { // 追加用ボタンの次に配置するための 1 Folders.Insert(1, new StorageItemViewModel(storageItemImageSource, args.Token, _sourceStorageItemsRepository, _folderListingSettings, _bookmarkManager)); } else if (storageItemImageSource.ItemTypes == Models.Domain.StorageItemTypes.Image || storageItemImageSource.ItemTypes == Models.Domain.StorageItemTypes.Archive || storageItemImageSource.ItemTypes == Models.Domain.StorageItemTypes.EBook ) { RecentlyItems.Insert(0, new StorageItemViewModel(storageItemImageSource, args.Token, _sourceStorageItemsRepository, _folderListingSettings, _bookmarkManager)); } }) .AddTo(_disposables); _eventAggregator.GetEvent <SourceStorageItemsRepository.RemovedEvent>() .Subscribe(args => { var existInFolders = Folders.FirstOrDefault(x => x.Token == args.Token); if (existInFolders != null) { Folders.Remove(existInFolders); } var existInFiles = RecentlyItems.Where(x => x.Token == args.Token).ToList(); foreach (var item in existInFiles) { RecentlyItems.Remove(item); } }) .AddTo(_disposables); }