//---------------------------------------------------------------------------------------------------------------------- protected void OnCurrentListChanged(TrackListViewModel pList) { //if (pList.CurrentTrack != null) //{ // int i = pList.Traks.IndexOf(pList.CurrentTrack); // if (i >= 0) // pList.SelectedIndex = i; //} //Action<TrackListViewModel> handler = CurrentListChanged; //if (handler != null) // handler(pList); }
//---------------------------------------------------------------------------------------------------------------------- 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; }
//---------------------------------------------------------------------------------------------------------------------- private void MediaDataOnCurrentListChanged(TrackListViewModel pList) { OnListChangeQuery(pList, pList.SelectedTrack); }