private void OnJumpToPlayingTrack(object o, EventArgs args) { ITrackModelSource track_src = ServiceManager.PlaybackController.Source; Source src = track_src as Source; if (track_src != null && src != null) { int i = track_src.TrackModel.IndexOf(ServiceManager.PlaybackController.CurrentTrack); if (i != -1) { // TODO clear the search/filters if there are any, since they might be hiding the currently playing item? // and/or switch to the track's primary source? what if it's been removed from the library all together? IListView <TrackInfo> track_list = src.Properties.Get <IListView <TrackInfo> > ("Track.IListView"); if (track_list != null) { ServiceManager.SourceManager.SetActiveSource(src); track_src.TrackModel.Selection.Clear(false); track_src.TrackModel.Selection.Select(i); track_src.TrackModel.Selection.FocusedIndex = i; track_list.CenterOn(i); track_list.GrabFocus(); } } } }