Beispiel #1
0
        /// <summary>
        /// Fired if the Spotify Track changes
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void spotHandler_TrackChanged(object sender, LibSpot.Handlers.TrackChangedEventArgs e)
        {
            try
            {
                if (!String.IsNullOrEmpty(e.track))
                {

                    SpotTrack track = LibSpot.Handlers.SpotHandler.getSpotTrackObject(e.track);

                    SpotRecorderWindow.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, TimeSpan.FromSeconds(3), new Action(
                        delegate()
                        {
                            lb_currentArtist.Content = track.Artist;
                            lb_currentTitle.Content = track.Title;
                        }
                        ));
                }
                else
                {
                    SpotRecorderWindow.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, TimeSpan.FromSeconds(3), new Action(
                        delegate()
                        {
                            lb_currentArtist.Content = "";
                            lb_currentTitle.Content = "";
                        }
                        ));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Beispiel #2
0
 /// <summary>
 /// Fired if the SpotifyRecorder has recorded a new track
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void rec_TrackRecorded(object sender, LibSpot.HelperClasses.TrackRecordedEventArgs e)
 {
     SpotRecorderWindow.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, TimeSpan.FromSeconds(3), new Action(
         delegate()
         {
             _recordedTracks.Add(RecordedTrack.convertSpotTrack(e.Track));
             new System.Threading.Thread(() => convertTrack(RecordedTrack.convertSpotTrack(e.Track))).Start();
         }
         ));
 }