private async void TracklistPlayer_SongChanged(object sender, SongChangedEventArgs e) { SystemMediaTransportControlsDisplayUpdater updater = this.systemMediaControls.DisplayUpdater; StorageFile file = await SongImageUtil.LoadStorageFileAsync(e.NewSong.SongId); if (file == null) { updater.Thumbnail = RandomAccessStreamReference.CreateFromUri(ImageUtil.GetAssetsImageUriByFileName("Favor.png")); } else { updater.Thumbnail = RandomAccessStreamReference.CreateFromFile(file); } Song currentSong = this.CurrentSong; updater.Type = MediaPlaybackType.Music; updater.MusicProperties.Title = currentSong.Title; updater.MusicProperties.TrackNumber = (uint)currentSong.Track; updater.MusicProperties.AlbumTitle = currentSong.Album.Name; updater.MusicProperties.AlbumArtist = currentSong.Album.Artist.Name; updater.MusicProperties.Artist = currentSong.Album.Artist.Name; updater.Update(); }
void OnMp3PlayerSongChanged(object sender, SongChangedEventArgs e) { source.Clear(); SongViewModel svm = SongViewModel.GetId(e.Id); if (svm == null) { return; } var lrcPath = Path.Combine(Global.AppSettings["DownloadFolder"], svm.FileNameBase + ".lrc"); if (!File.Exists(lrcPath)) { lrcPath = Path.Combine(Global.BasePath, "cache", e.Id + ".lrc"); } if (!File.Exists(lrcPath)) { Task.Run(async() => { var url = svm.Song.UrlLrc; if (string.IsNullOrEmpty(url)) { var json = await NetAccess.Json(XiamiUrl.url_song, "id", svm.Id); if (json.song != null) { json = json.song; } url = MusicHelper.Get(json, "lyric", "song_lrc"); if (string.IsNullOrEmpty(url)) { return; } } string lrcText = await Http.Get(url, null); File.WriteAllText(lrcPath, lrcText); var f = LyricViewModel.LoadLrcFile(lrcPath); UIHelper.RunOnUI(() => { foreach (var item in f) { source.Add(item); } timelist = source.Select(x => x.Time.TotalMilliseconds).ToArray(); }); }); return; } var s = LyricViewModel.LoadLrcFile(lrcPath); foreach (var item in s) { source.Add(item); } timelist = source.Select(x => x.Time.TotalMilliseconds).ToArray(); }
void Mp3Player_SongChanged(object sender, SongChangedEventArgs e) { _slider.Visibility = Visibility.Visible; //canReposition = SongViewModel.GetId(e.Id).Song.DownloadState == "complete"; canReposition = true; _slider.Cursor = canReposition ? System.Windows.Input.Cursors.Hand : System.Windows.Input.Cursors.No; if (_slider.Maximum != e.Total) { da.To = 0; anim.Begin(); _slider.Maximum = e.Total; } }
private void QueueControllerOnCurrentSongChangedEvent(object sender, SongChangedEventArgs e) { var song = e.CurrentSong as SpotifySong; if (song != null) { IsPlaying = true; CurrentSong = song; } else { IsPlaying = false; } }
void OnMp3PlayerSongChanged(object sender, SongChangedEventArgs e) { if (SongViewModel.NowPlaying != null) { SongViewModel.NowPlaying.IsNowPlaying = false; } SongViewModel.NowPlaying = SongViewModel.GetId(e.Id); if (SongViewModel.NowPlaying != null) { Task.Run(() => { if (!Mp3Player.IsPlaying) { return; } var id = SongViewModel.NowPlaying.Id; System.Threading.Thread.Sleep(10000); if (SongViewModel.NowPlaying.Id != id) { return; } NetAccess.Json(XiamiUrl.url_playlog, "uid", Global.AppSettings["xiami_uid"], "id", id); // XiamiClient.GetDefault().Call_xiami_api("Playlog.add", // "id=" + SongViewModel.NowPlaying.Id, // "time=" + XiamiClient.DateTimeToUnixTimestamp(DateTime.Now).ToString(), // "type=20" //); }); SongViewModel.NowPlaying.IsNowPlaying = true; var now = SongViewModel.NowPlaying; info_now.Visibility = Visibility.Visible; part_nowPlaying.DataContext = now; Title = string.Format("{0} - {1} ", now.Name, now.ArtistName); counter = 0; if (trayIcon != null && Global.AppSettings["ShowNowPlaying"] != "0" && Mp3Player.IsPlaying) { balloonTip = new MyBalloonTip(); balloonTip.ViewModel = now; trayIcon.ShowCustomBalloon(balloonTip, PopupAnimation.Fade, 3000); } } ActionBarService.Refresh(); refreshPlause(); currentList.PerformAction("选中正在播放"); }
private void QueueControllerOnCurrentSongChangedEvent(object sender, SongChangedEventArgs e) { var ySong = e.CurrentSong as YoutubeSong; if (ySong != null) { Video = ySong; Playing = true; if (ySong.Picture != null) { VideoThumbnail = new BitmapImage(ySong.Picture); } } else { Playing = false; } }
private void QueueControllerOnCurrentSongChangedEvent(object sender, SongChangedEventArgs songChangedEventArgs) { CurrenSong = songChangedEventArgs.CurrentSong; IsPlaying = CurrenSong != null; }
private void Winamp_SongChanged(object sender, SongChangedEventArgs e) { txtLog.Text = String.Concat(DateTime.Now, ": Song changed: ", e.Song.Title, "\r\n", txtLog.Text); UpdateData(e.Song); }