//---------------------------------------------------------------------------------------------------------------------- public void NewPlayList() { string newListMame = "List" + (TrakLists.Count + 1).ToString(); TrackList tl = new TrackList() { ListName = newListMame }; TrackListViewModel tlv = new TrackListViewModel(tl); TrakLists.Add(tlv); CurrentList = tlv; }
//---------------------------------------------------------------------------------------------------------------------- public MediaDataViewModel(MediaData pData) { data = pData; foreach (var l in Data.TrakLists) { var tlv = new TrackListViewModel(l); TrakLists.Add(tlv); tlv.CurrentTrackChanged += () => OnCurrentTrackChanged(); } CurrentList = TrakLists.FirstOrDefault(t => object.ReferenceEquals(Data.CurrentTrackList, t.TrackList)); if (CurrentList == null && TrakLists.Count > 0) { CurrentList = TrakLists[0]; } // if (CurrentList == null ) // OnCurrentListChanged(CurrentList); //TrackCollectionViewSource = new CollectionViewSource(); //if (CurrentList != null) // TrackCollectionViewSource.Source = CurrentList.Traks; PropertyChanged += MediaDataViewModel_PropertyChanged; TrakLists.CollectionChanged += TrakLists_CollectionChanged; }