Exemplo n.º 1
0
        public void LoadPlayingFile(HyPlayItem mpi)
        {
            if (mpi == null)
            {
                return;
            }

            MediaItemDisplayProperties dp = mpi.MediaItem.GetDisplayProperties();
            AudioInfo ai = mpi.AudioInfo;

            Invoke((() =>
            {
                TbSingerName.Text = ai.Artist;
                TbSongName.Text = ai.SongName;
                AlbumImage.Source = mpi.ItemType == HyPlayItemType.Local ? ai.BitmapImage : new BitmapImage(new Uri(ai.Picture));
                SliderAudioRate.Value = HyPlayList.Player.Volume * 100;
                SliderProgress.Minimum = 0;
                SliderProgress.Maximum = ai.LengthInMilliseconds;
                if (mpi.isOnline)
                {
                    BtnLike.IsChecked = Common.LikedSongs.Contains(mpi.NcPlayItem.sid);
                }

                ListBoxPlayList.SelectedIndex = HyPlayList.NowPlaying;
            }));
        }
Exemplo n.º 2
0
        public void LoadPlayingFile(HyPlayItem mpi)
        {
            if (mpi == null)
            {
                return;
            }
            AudioInfo ai = mpi.AudioInfo;

            Invoke((async() =>
            {
                TbSingerName.Text = ai.Artist;
                TbSongName.Text = ai.SongName;
                if (mpi.ItemType == HyPlayItemType.Local)
                {
                    BitmapImage img = new BitmapImage();
                    await img.SetSourceAsync((await mpi.AudioInfo.LocalSongFile.GetThumbnailAsync(ThumbnailMode.MusicView, 9999)));
                    AlbumImage.Source = img;
                }
                else
                {
                    AlbumImage.Source = new BitmapImage(new Uri(mpi.AudioInfo.Picture));
                }
                SliderAudioRate.Value = HyPlayList.Player.Volume * 100;
                SliderProgress.Minimum = 0;
                SliderProgress.Maximum = ai.LengthInMilliseconds;
                if (mpi.isOnline)
                {
                    BtnLike.IsChecked = Common.LikedSongs.Contains(mpi.NcPlayItem.sid);
                }
                ListBoxPlayList.SelectedIndex = HyPlayList.NowPlaying;
                TbSongTag.Text = HyPlayList.NowPlayingItem.AudioInfo.tag;
            }));
        }
Exemplo n.º 3
0
 public void RefreshSongList(HyPlayItem hpi)
 {
     try
     {
         ObservableCollection <ListViewPlayItem> Contacts = new ObservableCollection <ListViewPlayItem>();
         for (int i = 0; i < HyPlayList.List.Count; i++)
         {
             Contacts.Add(new ListViewPlayItem(HyPlayList.List[i].Name, i, HyPlayList.List[i].AudioInfo.Artist));
         }
         ListBoxPlayList.ItemsSource   = Contacts;
         ListBoxPlayList.SelectedIndex = HyPlayList.NowPlaying;
     }
     catch { }
 }
Exemplo n.º 4
0
 public void OnSongChange(HyPlayItem mpi)
 {
     if (mpi != null)
     {
         Invoke((() =>
         {
             try
             {
                 ImageAlbum.Source = mpi.ItemType == HyPlayItemType.Local ? mpi.AudioInfo.BitmapImage : new BitmapImage(new Uri(mpi.AudioInfo.Picture));
                 TextBlockSinger.Text = mpi.AudioInfo.Artist;
                 TextBlockSongTitle.Text = mpi.AudioInfo.SongName;
                 Background = new ImageBrush()
                 {
                     ImageSource = ImageAlbum.Source, Stretch = Stretch.UniformToFill
                 };
                 ProgressBarPlayProg.Maximum = mpi.AudioInfo.LengthInMilliseconds;
                 SliderVolumn.Value = HyPlayList.Player.Volume * 100;
             }
             catch (Exception) { }
             ;
         }));
     }
 }
Exemplo n.º 5
0
 private void HyPlayList_OnPlayListAdd(HyPlayItem playItem)
 {
     RefreshSongList(playItem);
 }
Exemplo n.º 6
0
        public void OnSongChange(HyPlayItem mpi)
        {
            if (mpi != null)
            {
                Invoke((async() =>
                {
                    try
                    {
                        if (mpi.ItemType == HyPlayItemType.Local)
                        {
                            BitmapImage img = new BitmapImage();
                            await img.SetSourceAsync((await mpi.AudioInfo.LocalSongFile.GetThumbnailAsync(ThumbnailMode.MusicView, 9999)));
                            ImageAlbum.ImageSource = img;
                        }
                        else
                        {
                            ImageAlbum.ImageSource = new BitmapImage(new Uri(mpi.AudioInfo.Picture));
                        }

                        TextBlockSinger.Text = mpi.AudioInfo.Artist;
                        TextBlockSongTitle.Text = mpi.AudioInfo.SongName;
                        Background = new ImageBrush()
                        {
                            ImageSource = ImageAlbum.ImageSource, Stretch = Stretch.UniformToFill
                        };
                        ProgressBarPlayProg.Maximum = mpi.AudioInfo.LengthInMilliseconds;
                        SliderVolumn.Value = HyPlayList.Player.Volume * 100;

                        if (lastlrcid != HyPlayList.NowPlayingItem.GetHashCode())
                        {
                            //歌词加载中提示
                            double blanksize = (LyricBoxContainer.ViewportHeight / 2);
                            if (double.IsNaN(blanksize) || blanksize == 0)
                            {
                                blanksize = Window.Current.Bounds.Height / 3;
                            }
                            LyricBox.Children.Clear();
                            LyricBox.Children.Add(new Grid()
                            {
                                Height = blanksize
                            });
                            LyricItem lrcitem = new LyricItem(SongLyric.LoadingLyric)
                            {
                                Width = LyricWidth
                            };
                            LyricList = new List <LyricItem>()
                            {
                                lrcitem
                            };
                            LyricBox.Children.Add(lrcitem);
                            LyricBox.Children.Add(new Grid()
                            {
                                Height = blanksize
                            });
                        }
                    }
                    catch (Exception) { }
                    ;
                }));
            }
        }
Exemplo n.º 7
0
 private static void HyPlayList_OnMediaEnd(HyPlayItem hpi)
 {
     LoadNextFM();
 }
Exemplo n.º 8
0
        public void LoadPlayingFile(HyPlayItem mpi)
        {
            if (Common.GLOBAL["PERSONALFM"].ToString() == "true")
            {
                IconPrevious.Glyph = "\uE7E8";
                IconPlayType.Glyph = "\uE107";
            }
            else
            {
                IconPrevious.Glyph = "\uE892";
                switch (HyPlayList.NowPlayType)
                {
                case PlayMode.Shuffled:
                    //随机
                    IconPlayType.Glyph = "\uE14B";
                    break;

                case PlayMode.SinglePlay:
                    //单曲
                    IconPlayType.Glyph = "\uE1CC";
                    break;

                case PlayMode.DefaultRoll:
                    //顺序
                    IconPlayType.Glyph = "\uE169";
                    break;
                }
            }

            if (mpi == null)
            {
                return;
            }
            AudioInfo ai = mpi.AudioInfo;

            Common.Invoke((async() =>
            {
                TbSingerName.Text = ai.Artist;
                TbSongName.Text = ai.SongName;
                if (mpi.ItemType == HyPlayItemType.Local)
                {
                    BitmapImage img = new BitmapImage();
                    await img.SetSourceAsync((await mpi.AudioInfo.LocalSongFile.GetThumbnailAsync(ThumbnailMode.SingleItem, 9999)));
                    AlbumImage.Source = img;
                }
                else
                {
                    AlbumImage.Source = new BitmapImage(new Uri(mpi.AudioInfo.Picture));
                }
                SliderAudioRate.Value = HyPlayList.Player.Volume * 100;
                SliderProgress.Minimum = 0;
                SliderProgress.Maximum = ai.LengthInMilliseconds;
                if (mpi.isOnline)
                {
                    BtnLike.IsChecked = Common.LikedSongs.Contains(mpi.NcPlayItem.sid);
                }
                ListBoxPlayList.SelectedIndex = HyPlayList.NowPlaying;
                TbSongTag.Text = HyPlayList.NowPlayingItem.AudioInfo.tag;
                Btn_Share.IsEnabled = HyPlayList.NowPlayingItem.isOnline;
            }));
        }