Exemplo n.º 1
0
        public void SpotClient_OnTrackChange(object sender, SpotifyAPI.Local.TrackChangeEventArgs e)
        {
            if (!UserPreferences.Default.showTrackArtistOnChange)
            {
                Console.WriteLine("ShowTrackArtist is disabled in user preferences.");
                return;
            }

            if (e.NewTrack == null || e.NewTrack.TrackResource == null ||
                e.NewTrack.TrackResource.Name == null || e.NewTrack.AlbumResource.Name == null)
            {
                return;
            }
            string trackName  = e.NewTrack.TrackResource.Name;
            string artistName = e.NewTrack.ArtistResource.Name;

            Console.WriteLine("Show New track name: " + trackName);
            myOleCommand.Text = String.Format("{0} - {1}", trackName, artistName);
            Microsoft.VisualStudio.Shell.ServiceProvider serviceProvider = new Microsoft.VisualStudio.Shell.ServiceProvider(((EnvDTE.DTE)Microsoft.VisualStudio.Shell.ServiceProvider.GlobalProvider.GetService(typeof(EnvDTE.DTE))) as Microsoft.VisualStudio.OLE.Interop.IServiceProvider);
            IVsUIShell uiShell = serviceProvider.GetService(typeof(SVsUIShell)) as IVsUIShell;

            uiShell.UpdateCommandUI(0);
            if (timer != null)
            {
                timer.Stop();
                timer.Start();
            }
            else
            {
                timer = new System.Timers.Timer()
                {
                    Interval = kSHOW_TRACK_INTERVAL
                };
                //timer.AutoReset = false;
                timer.Elapsed += TrackChangeTimerTick;
                timer.Start();
            }
        }
Exemplo n.º 2
0
        public void SpotClient_OnTrackChange(object sender, SpotifyAPI.Local.TrackChangeEventArgs e)
        {
            string trackName  = e.NewTrack.TrackResource.Name;
            string artistName = e.NewTrack.ArtistResource.Name;

            Console.WriteLine("Show New track name: " + trackName);
            myOleCommand.Text = String.Format("{0} - {1}", trackName, artistName);
            if (timer != null)
            {
                timer.Stop();
                timer.Start();
            }
            else
            {
                timer = new System.Timers.Timer()
                {
                    Interval = kSHOW_TRACK_INTERVAL
                };
                //timer.AutoReset = false;
                timer.Elapsed += TrackChangeTimerTick;
                timer.Start();
            }
        }
Exemplo n.º 3
0
 void OnSpotifyTrackChange(object sender, SpotifyAPI.Local.TrackChangeEventArgs e)
 {
     SpotifyClientTrackChange?.Invoke(this, e);
 }
Exemplo n.º 4
0
 // INTERNAL.
 private void SpotClient_OnTrackChangeInternal(object sender, SpotifyAPI.Local.TrackChangeEventArgs e)
 {
     Debug.WriteLine("SotifyManager:: OnTrackChange");
     OnSpotifyTrackChange(this, e);
 }
Exemplo n.º 5
0
 private void SpotifyClientTrackChange(object sender, SpotifyAPI.Local.TrackChangeEventArgs e)
 {
     m_trackChangeAnimator.StartTrackChange(e.NewTrack);
 }