private void RatingUserControl_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { RatingUserControl ratingUserControl = sender as RatingUserControl; Track track = ratingUserControl.DataContext as Track; CD cd = DataBase.GetCDById(track.CDID); int trackIndex = cd.FindTrackIndexByTrackID(track.ID); cd.SetTrackValueToField(trackIndex, Field.TrackRating, ratingUserControl.Rating); Big3.Hitbase.SoundEngine.SoundFileInformation.WriteMP3Tags(cd, track.ID); Big3.Hitbase.SoundFilesManagement.SynchronizeCatalogWorker.Instance.ScanFile(cd.Tracks[trackIndex].Soundfile); }
private void EditTrackField(int column, Field field, MyMusicListItem musicItem) { #if false int cdId = DataBase.GetCDIDByTrackID(musicItem.ID); CD cd = DataBase.GetCDById(cdId); int trackIndex = cd.FindTrackIndexByTrackID(musicItem.ID); object newValue = musicItem.Items[column]; if (FieldHelper.IsCDField(field)) { cd.SetValueToField(field, newValue); } else { cd.SetTrackValueToField(trackIndex, field, newValue); } //cd.Save(DataBase, cd.Tracks[trackIndex]); Big3.Hitbase.SoundEngine.SoundFileInformation.WriteMP3Tags(cd, musicItem.ID); Big3.Hitbase.SoundFilesManagement.SynchronizeCatalogWorker.Instance.ScanFile(cd.Tracks[trackIndex].Soundfile); #endif SoundFileInformation sfi = SoundFileInformation.GetSoundFileInformation(musicItem.Soundfile); object newValue = musicItem.Items[column]; if (newValue != null) { sfi.SetField(field, newValue.ToString()); } else { sfi.SetField(field, ""); } Big3.Hitbase.SoundEngine.SoundFileInformation.WriteMP3Tags(sfi, field); Big3.Hitbase.SoundFilesManagement.SynchronizeCatalogWorker.Instance.ScanFile(musicItem.Soundfile); }
private void CommandBindingOpenTrack_Executed(object sender, ExecutedRoutedEventArgs e) { Track track = null; if (e.Parameter is int) { track = DataBase.GetTrackById((int)e.Parameter); } else { track = e.Parameter as Track; } if (track != null) { CD cd = DataBase.GetCDById(track.CDID); int trackIndex = cd.FindTrackIndexByTrackID(track.ID); WindowAlbum windowAlbum = new WindowAlbum(cd, DataBase, trackIndex); windowAlbum.Owner = Window.GetWindow(this); windowAlbum.ShowDialog(); } }