Beispiel #1
0
 public async void LoadRanklist()
 {
     await Task.Run((() =>
     {
         Invoke((async() =>
         {
             (bool isOk, JObject json) = await Common.ncapi.RequestAsync(CloudMusicApiProviders.Toplist);
             if (isOk)
             {
                 foreach (JToken PlaylistItemJson in json["list"].ToArray())
                 {
                     NCPlayList ncp = new NCPlayList()
                     {
                         cover = PlaylistItemJson["coverImgUrl"].ToString(),
                         creater = new NCUser()
                         {
                             avatar = "https://p1.music.126.net/KxePid7qTvt6V2iYVy-rYQ==/109951165050882728.jpg",
                             id = PlaylistItemJson["userId"].ToString(),
                             name = PlaylistItemJson["updateFrequency"].ToString(),
                             signature = "网易云音乐官方帐号"
                         },
                         plid = PlaylistItemJson["id"].ToString(),
                         name = PlaylistItemJson["name"].ToString(),
                         desc = PlaylistItemJson["description"].ToString()
                     };
                     RankList.Children.Add(new PlaylistItem(ncp));
                 }
             }
         }));
     }));
 }
Beispiel #2
0
 public PlaylistItem(NCPlayList playList)
 {
     InitializeComponent();
     this.playList = playList;
     Task.Run(() =>
     {
         Common.Invoke(() =>
         {
             ImageRect.ImageSource  = new BitmapImage(new Uri(playList.cover + "?param=" + StaticSource.PICSIZE_PLAYLIST_ITEM_COVER));
             TextBlockPLName.Text   = playList.name;
             TextBlockPLAuthor.Text = playList.creater.name;
         });
     });
 }
Beispiel #3
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            playList = (NCPlayList)e.Parameter;
            Task.Run((() =>
            {
                Invoke(() =>
                {
                    LoadSongListDetail();
                    LoadSongListItem();
                });
            }));
            ConnectedAnimation anim = ConnectedAnimationService.GetForCurrentView().GetAnimation("SongListExpand");

            anim?.TryStart(RectangleImage);
        }
Beispiel #4
0
 public async void LoadRcmdSonglist()
 {
     await Task.Run((() =>
     {
         Invoke((async() =>
         {
             (bool isOk, JObject json) = await Common.ncapi.RequestAsync(CloudMusicApiProviders.RecommendResource);
             if (isOk)
             {
                 NCPlayList dayly = new NCPlayList()
                 {
                     cover = "https://gitee.com/kengwang/HyPlayer/raw/master/HyPlayer/Assets/icon.png",
                     creater = new NCUser()
                     {
                         avatar = "https://p1.music.126.net/KxePid7qTvt6V2iYVy-rYQ==/109951165050882728.jpg",
                         id = "1",
                         name = "网易云音乐",
                         signature = "网易云音乐官方账号 "
                     },
                     plid = "-666",
                     name = "每日歌曲推荐",
                     desc = "根据你的口味生成,每天6:00更新"
                 };
                 RcmdSongList.Children.Add(new PlaylistItem(dayly));
                 foreach (JToken PlaylistItemJson in json["recommend"].ToArray())
                 {
                     NCPlayList ncp = new NCPlayList()
                     {
                         cover = PlaylistItemJson["picUrl"].ToString(),
                         creater = new NCUser()
                         {
                             avatar = PlaylistItemJson["creator"]["avatarUrl"].ToString(),
                             id = PlaylistItemJson["creator"]["userId"].ToString(),
                             name = PlaylistItemJson["creator"]["nickname"].ToString(),
                             signature = PlaylistItemJson["creator"]["signature"].ToString()
                         },
                         plid = PlaylistItemJson["id"].ToString(),
                         name = PlaylistItemJson["name"].ToString(),
                         desc = PlaylistItemJson["copywriter"].ToString()
                     };
                     RcmdSongList.Children.Add(new PlaylistItem(ncp));
                 }
             }
         }));
     }));
 }
        public async void LoadList()
        {
            try
            {
                (bool isok, JObject json) = await Common.ncapi.RequestAsync(CloudMusicApiProviders.UserPlaylist,
                                                                            new Dictionary <string, object> {
                    ["uid"] = uid
                });

                if (isok)
                {
                    foreach (JToken PlaylistItemJson in json["playlist"].ToArray())
                    {
                        NCPlayList ncp = new NCPlayList()
                        {
                            cover   = PlaylistItemJson["coverImgUrl"].ToString(),
                            creater = new NCUser()
                            {
                                avatar    = PlaylistItemJson["creator"]["avatarUrl"].ToString(),
                                id        = PlaylistItemJson["creator"]["userId"].ToString(),
                                name      = PlaylistItemJson["creator"]["nickname"].ToString(),
                                signature = PlaylistItemJson["creator"]["signature"].ToString()
                            },
                            plid = PlaylistItemJson["id"].ToString(),
                            name = PlaylistItemJson["name"].ToString(),
                            desc = PlaylistItemJson["description"].ToString()
                        };
                        GridContainer.Children.Add(new PlaylistItem(ncp));
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            _ = Task.Run((() =>
            {
                Common.Invoke(() =>
                {
                    try
                    {
                        ConnectedAnimation anim = ConnectedAnimationService.GetForCurrentView().GetAnimation("SongListExpand");
                        ConnectedAnimation anim1 = ConnectedAnimationService.GetForCurrentView().GetAnimation("SongListExpandAcrylic");
                        anim1?.TryStart(GridPersonalInformation);
                        anim?.TryStart(RectangleImage);
                    }
                    catch { }
                });
            }));
            await Task.Run((() =>
            {
                Common.Invoke(async() =>
                {
                    if (e.Parameter != null)
                    {
                        if (e.Parameter is NCPlayList)
                        {
                            playList = (NCPlayList)e.Parameter;
                        }
                        else
                        {
                            string pid = e.Parameter.ToString();

                            (bool isok, var json) = await Common.ncapi.RequestAsync(CloudMusicApiProviders.PlaylistDetail,
                                                                                    new Dictionary <string, object>()
                            {
                                { "id", pid }
                            });
                            if (isok)
                            {
                                NCUser user;
                                if (!json["playlist"]["creator"].HasValues)
                                {
                                    user = Common.LoginedUser;
                                }
                                else
                                {
                                    user = new NCUser()
                                    {
                                        avatar = json["playlist"]["creator"]["avatarUrl"].ToString(),
                                        id = json["playlist"]["creator"]["userId"].ToString(),
                                        name = json["playlist"]["creator"]["nickname"].ToString(),
                                        signature = json["playlist"]["creator"]["signature"].ToString()
                                    };
                                }
                                playList = new NCPlayList()
                                {
                                    cover = json["playlist"]["coverImgUrl"].ToString(),
                                    creater = user,
                                    desc = json["playlist"]["description"].ToString(),
                                    name = json["playlist"]["name"].ToString(),
                                    plid = json["playlist"]["id"].ToString()
                                };
                            }
                        }
                    }
                    LoadSongListDetail();
                    LoadSongListItem();
                });
            }));
        }