/// <summary> /// 获取上一次播放的信息 /// </summary> async void GetLastPlayingInfo() { ChangeImage(); PlayingService.PlayingAlbumBitmapImage = await FileHelper.ReadLoaclBitmapImage(ConfigService.ImageFilename); if (await PlayingService.Load()) { Slider_Volume.Value = PlayingService.Volume * 100; if (PlayingService.IsPlayingSong) { if (PlayingService.PlayingSong != null) { ChangePlayBar(PlayingService.PlayingSong, PlayingService.PlayingAlbumBitmapImage, PlayingService.PlayingSong.Name, PlayingService.PlayingSong.ar.First().name, PlayingService.PlayingSong.al.name, PlayingService.PlayingSong.dt / 1000, false); } } else { if (PlayingService.PlayingRadio != null) { ChangePlayBar(PlayingService.PlayingAlbumBitmapImage, PlayingService.PlayingRadio.Name, PlayingService.PlayingRadio.Dj.Nickname, PlayingService.PlayingRadio.Name, PlayingService.PlayingRadio.MainSong.Duration / 1000); } } UpDatePlayOrderStateIcon(); if (PlayingService.PlayingSongUrlRoot != null) { SongUrlRoot songUrlRoot = SongService.GetMusicUrl(PlayingService.PlayingSongUrlRoot.data.First().id); //_mediaSource = await Task.Run(() => MediaSource.CreateFromUri(new Uri(PlayingService.PlayingSongUrlRoot.data.First().url))); _mediaSource = await Task.Run(() => MediaSource.CreateFromUri(new Uri(songUrlRoot.data.First().url))); _mediaSource.OpenOperationCompleted += _mediaSource_OpenOperationCompleted; _mediaSource.StateChanged += _mediaSource_StateChanged; _mediaPlaybackItem = new MediaPlaybackItem(_mediaSource); _mediaPlayer.Source = _mediaPlaybackItem; } } }