private void RatingCell_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { DataGridRow row = VisualTreeExtensions.FindParent <DataGridRow>((DependencyObject)e.OriginalSource); DataGridCell cell = VisualTreeExtensions.FindParent <DataGridCell>((DependencyObject)e.OriginalSource); DataGridColumn column = cell.Column; RatingUserControl ratingUserControl = sender as RatingUserControl; MyMusicListItem musicItem = row.DataContext as MyMusicListItem; dataGrid.CommitEdit(DataGridEditingUnit.Row, true); if (this.dataGrid.SelectedItems.Count > 1) { WpfMessageBoxResult result = WPFMessageBox.Show(Window.GetWindow(this), StringTable.MultiTagEdit, StringTable.MultiTagEditWarning, "/Big3.Hitbase.SharedResources;component/Images/RenameLarge.png", WpfMessageBoxButtons.YesNo, "MultiTagEdit", false); if (result == WpfMessageBoxResult.Yes) { Field field = (Field)column.GetValue(DataGridExtensions.FieldProperty); int columnIndex = column.DisplayIndex - 1; musicItem.Items[columnIndex] = ratingUserControl.Rating; PerformMultiEdit(musicItem, field, columnIndex); } } else { Field field = (Field)column.GetValue(DataGridExtensions.FieldProperty); musicItem.Items[column.DisplayIndex - 1] = ratingUserControl.Rating; EditTrackField(column.DisplayIndex - 1, field, musicItem); } }
private void RatingUserControl_ValueChanged(object sender, EventArgs e) { RatingUserControl rc = (RatingUserControl)sender; Track track = GetTrack(rc); TrackTableAdapter ta = new TrackTableAdapter(DataBase); TrackDataSet.TrackDataTable dtTrack = ta.GetDataById(track.ID); dtTrack[0].Rating = rc.Value; ta.Update(dtTrack[0]); }
private void RatingCell_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { DataGridRow row = VisualTreeExtensions.FindParent <DataGridRow>((DependencyObject)e.OriginalSource); AlbumItem albumItem = row.DataContext as AlbumItem; RatingUserControl ratingUserControl = sender as RatingUserControl; int rating = ratingUserControl.Rating; CD cd = DataBase.GetCDById(albumItem.ID); cd.Rating = rating; cd.Save(DataBase); }
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); }