private void OnPlayerPositionChanged(PlayerPositionChangedMessage message) { if (message.NewPosition.TotalSeconds >= 3) { if (!_artRequested) { CancelAsync(); _artRequested = true; GetArtistImage(_cancellationToken.Token); } } }
private async void OnPlayerPositionChanged(PlayerPositionChangedMessage message) { RaisePropertyChanged("CurrentAudioPosition"); RaisePropertyChanged("CurrentAudioPositionSeconds"); RaisePropertyChanged("CurrentAudioDuration"); if (message.NewPosition.TotalSeconds >= 3) { if (!_statusUpdated) { if (Settings.Instance.EnableStatusBroadcasting) { _statusUpdated = true; try { await DataService.SetMusicStatus(CurrentAudio); } catch (VkAccessDeniedException ex) { //ViewModelLocator.AuthService.LogOutVk(); LoggingService.Log(ex); } catch (VkStatusBroadcastDisabledException ex) { LoggingService.Log(ex); } catch (Exception ex) { LoggingService.Log(ex); } } } if (!_nowPlayingUpdated && EnableScrobbling) { _nowPlayingUpdated = true; try { await DataService.UpdateNowPlaying(CurrentAudio); } catch (Exception ex) { Debug.WriteLine(ex); } } if (!_artRequested) { CancelArt(); _artRequested = true; GetArtistImage(_artCancellationToken.Token); } } if (CurrentAudio != null && message.NewPosition.TotalSeconds >= CurrentAudio.Duration.TotalSeconds / 3) { if (!_scrobbled && EnableScrobbling) { _scrobbled = true; try { await DataService.Scrobble(CurrentAudio); } catch (Exception ex) { Debug.WriteLine(ex); } } } }