public AlbumGroupsViewModel(ICurrentAlbumManager currentAlbumManager, IGroupFolderViewModelFactory groupFolderFactory, IGroupCreatorViewModel groupCreator) { _currentAlbumManager = currentAlbumManager; IEnumerable <IGroupItemViewModel> groups = _currentAlbumManager.CurrentAlbum.SubFolders.Select(groupFolderFactory.Create); Groups = new ObservableCollection <IGroupItemViewModel>(groups.Concat(groupCreator)); Observable .FromEventPattern <NotifyCollectionChangedEventArgs>(Groups, nameof(Groups.CollectionChanged)) .Do(pattern => ReorderIfMovedToLast(pattern.EventArgs)) .Do(_ => ResetIndexes()) .Throttle(TimeSpan.FromMilliseconds(100)) .Subscribe(_ => UpdateCurrentAlbum()); groupCreator.GroupLogicCommand .Select(groupFolderFactory.Create) .Do(newGroup => Groups.Insert(Groups.Count - 1, newGroup)) .Subscribe(_ => SubscribeToGroupDeletion()); ResetIndexes(); SubscribeToGroupDeletion(); OpenDestinationFolderCommand = ReactiveCommand.CreateFromTask(_currentAlbumManager.LaunchAlbumDestinationFolder); CopyToGroupCommand = ReactiveCommand.Create <int>(ExecuteGroupToCopy); }
public Factory(ICurrentAlbumManager currentAlbumManager) { _currentAlbumManager = currentAlbumManager; }
private AlbumFolderViewModel(ICurrentAlbumManager currentAlbumManager, AlbumFolder albumFolder) { RelativePath = albumFolder.FullPath.Replace(currentAlbumManager.CurrentAlbum.Source, "").TrimStart('\\', '/'); Images = albumFolder.Images; }
public GroupCreatorViewModel(ICurrentAlbumManager currentAlbumManager) { GroupLogicCommand = ReactiveCommand.CreateFromTask(() => currentAlbumManager.AddAlbumFolder(NewGroupBaseName)); }