public CenteredAlbumViewModel(IList<IAlbum> iAlbums, IMusicSession isession) { Albums = iAlbums; AlbumDistanceComparerFactory adcf = new AlbumDistanceComparerFactory(isession); _OrderByAfinity = new AfinityCollection<IAlbum>(this.Albums, al => adcf.GetComparer(al), 50); AffinityOrderedCollection = _OrderByAfinity.Collection; //CenterAlbum = Albums.MaxBy(isession.AlbumSorter.Sorter); _OrderByAfinity.Reference = Albums.MaxBy(isession.AlbumSorter.Sorter); ChangeArtist = RelayCommand.Instanciate(DoChangeArtist); ChangeGenre = RelayCommand.Instanciate(DoChangeGenre); Random = RelayCommand.Instanciate(DoRandom); ChangeAlbum = RelayCommand.Instanciate(DoChangeAlbum); Center = RelayCommand.Instanciate<IAlbum>(al => CenterAlbum = al); }
internal ArtistGrouped(IList<IAlbum> albums) { var Int = albums.LiveSelectManyTuple((a) => a.Artists); var Int2 = Int.LiveToLookUp((t) => t.Item2, (t) => t.Item1); _Coll = Int2.LiveOrderBy((a) => a.Key.Name).LiveSelect(el => new ComposedObservedCollection<IArtist, IAlbum>(el.Key, el.Collection)); _ToClean = Int; _ToClean2 = Int2; }
internal GenreGrouped(IList<IAlbum> albums) { var Int = albums.LiveToLookUp((al) => al.MainGenre); _Coll = Int.LiveOrderBy((g) => g.Key.FullName).LiveSelect(el => new ComposedObservedCollection<IGenre, IAlbum>(el.Key, el.Collection)); _ToClean = Int; }
public void SU() { _Collection = new ObservableCollection<MyObject>(); _Target = _Collection.LiveSelectMany(s => s.MyFriends); _Expected = _Collection.SelectMany(s => s.MyFriends); }