示例#1
0
 /// <summary>
 /// Вызывается при изменении идентификатора текущего трека.
 /// </summary>
 private async void PlayerService_TrackIDChanged(object sender, int e)
 {
     await CoreHelper.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         _isPopSended    = false;
         _currentTrackID = e;
         var track       = Tracks[_currentTrackID];
         if (CurrentTrack == track)
         {
             return;
         }
         CurrentTrack = track;
         ShowTrackLyrics.RaiseCanExecuteChanged();
         DownloadTrack.RaiseCanExecuteChanged();
         LoadTrackInfo(CurrentTrack);
     });
 }
示例#2
0
        /// <summary>
        /// Воспроизвести трек по его идентификатору в плейлисте.
        /// </summary>
        /// <param name="trackID">Идентификатор трека.</param>
        private void PlayTrackFromID(int trackID)
        {
            if (trackID == -1)
            {
                return;
            }
            CurrentTrack = Tracks[trackID];
            ShowTrackLyrics.RaiseCanExecuteChanged();
            DownloadTrack.RaiseCanExecuteChanged();

            if (_isOnView)
            {
                _timer.Stop();
            }
            ServiceHelper.PlayerService.PlayFromID(trackID);

            DurationStart = TimeSpan.FromSeconds(0);

            //_timer.Start();
            LoadTrackInfo(CurrentTrack);
        }