private async void PlaybackService_PlaybackSuccess(object sender, PlaybackSuccessEventArgs e)
        {
            if (this.SignInState == SignInState.SignedIn)
            {
                // As soon as a track starts playing, send a Now Playing request.
                this.trackStartTime = DateTime.Now;
                this.canScrobble    = true;
                string artist     = this.playbackService.CurrentTrack.Value.ArtistName != Defaults.UnknownArtistText ? this.playbackService.CurrentTrack.Value.ArtistName : string.Empty;
                string trackTitle = this.playbackService.CurrentTrack.Value.TrackTitle;
                string albumTitle = this.playbackService.CurrentTrack.Value.AlbumTitle != Defaults.UnknownAlbumText ? this.playbackService.CurrentTrack.Value.AlbumTitle : string.Empty;

                if (!string.IsNullOrEmpty(artist) && !string.IsNullOrEmpty(trackTitle))
                {
                    try
                    {
                        bool isSuccess = await LastfmApi.TrackUpdateNowPlaying(this.sessionKey, artist, trackTitle, albumTitle);

                        if (isSuccess)
                        {
                            LogClient.Info("Successfully updated Now Playing for track '{0} - {1}'", artist, trackTitle);
                        }
                        else
                        {
                            LogClient.Error("Could not update Now Playing for track '{0} - {1}'", artist, trackTitle);
                        }
                    }
                    catch (Exception ex)
                    {
                        LogClient.Error("Could not update Now Playing for track '{0} - {1}'. Exception: {2}", artist, trackTitle, ex.Message);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void PlaybackService_PlaybackSuccess(object sender, PlaybackSuccessEventArgs e)
        {
            if (!this.followAlbumCoverColor)
            {
                return;
            }

            this.ApplyColorSchemeAsync(string.Empty, this.followWindowsColor, this.followAlbumCoverColor);
        }
Ejemplo n.º 3
0
        private void PlaybackService_PlaybackSuccess(object sender, PlaybackSuccessEventArgs e)
        {
            if (!this.followAlbumCoverColor)
            {
                return;
            }

#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
            this.ApplyColorSchemeAsync(string.Empty, this.followWindowsColor, this.followAlbumCoverColor);
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
        }
Ejemplo n.º 4
0
 public void OnPlaybackStarted(object sender, PlaybackSuccessEventArgs e)
 {
     PopulateWithTrack();
     PopulateTimestamps();
     PushState();
 }
Ejemplo n.º 5
0
 private void PlaybackSuccessCallback(object sender, PlaybackSuccessEventArgs e)
 {
     ProxyMethod(nameof(IExternalControlServerCallback.RaiseEventPlaybackSuccessAsync));
 }
Ejemplo n.º 6
0
        private static void PlaybackService_PlaybackSuccess(object sender, PlaybackSuccessEventArgs e)
        {
            TrackViewModel track = m_playbackService.CurrentTrack;

            TrackControlTopic.g.CurrentTrack(track.TrackTitle, track.ArtistName, track.AlbumTitle);
        }