Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            //IndexData data=new IndexData();
            //data.GetIndexData();
            var dsdasdas = MusicApi.GetIndexList();
            var fdf      = HttpClientHelper.GetAsync(dsdasdas).Result;
            var resss    = SearchApi.GetKeySuggest("李");
            var str      = MusicApi.GetKeySuggesUrl("修炼爱情");
            var ss       = HttpClientHelper.GetAsync(str).Result;
            var swe      = MusicApi.GetHotKey();
            var sdsad    = HttpClientHelper.GetAsync(swe).Result;
            var sds      = AlbumApi.InitBriefInfoAlbumAsync("2265047").Result;
            //var sss =
            //    MusicApi.GetSingerAlbum("000GGDys0yA0Nk", 0, 10);
            var     bir     = ImageHelper.DownAsync("http://y.gtimg.cn/music/photo_new/T002R500x500M000004Z9rf305fzyj.jpg").Result;
            SongApi songApi = new SongApi();

            songApi.InitAllListAsync().Wait();
            var lis = songApi.GetCover();

            foreach (var song in lis)
            {
                song.Album.GetAllInfor.BeginInvoke(string.Empty, null, null);
            }
            TopList top = new TopList();

            top.InitFromJsonAsync(4, 0, 10).Wait();
            var sss = MusicApi.GetTopList(4, 0, 30);

            var ssss = HttpClientHelper.GetAsync(sss).Result;

            JObject json = JObject.Parse(ssss);
            var     list = json["songlist"];

            foreach (var VARIABLE in list)
            {
            }

            var s = MusicApi.GetMusicianUrl(1, 200, NetMusic.Mode.MusicianType.cn_man, "L");

            var tt = HttpClientHelper.GetAsync(s).Result;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 同步方式获取首页的数据
        /// </summary>
        public void GetIndexData()
        {
            string indexUrl = MusicApi.GetIndexList();
            string indexRes = HttpClientHelper.GetAsync(indexUrl).Result;

            try
            {
                JObject resulJObject = JObject.Parse(indexRes);
                JToken  foucuses     = resulJObject["data"]["focus"];
                JToken  hotdisses    = resulJObject["data"]["hotdiss"]["list"];
                JToken  tops         = resulJObject["data"]["toplist"];
                if (foucuses != null)
                {
                    foreach (var foucuse in foucuses)
                    {
                        DispatcherHelper.CheckBeginInvokeOnUI((() =>
                        {
                            Foucuses.Add(new Focus()
                            {
                                Fid = foucuse["fid"].ToString(),
                                Id = foucuse["id"].ToString(),
                                JumpUrl = foucuse["jumpurl"].ToString(),
                                PicUrl = foucuse["pic"].ToString(),
                                Title = foucuse["title"].ToString(),
                                Type = foucuse["type"].ToString()
                            });
                        }));
                    }
                }
                if (hotdisses != null)
                {
                    foreach (var hotdiss in hotdisses)
                    {
                        DispatcherHelper.CheckBeginInvokeOnUI((() =>
                        {
                            Hotdisses.Add(new Hotdiss()
                            {
                                Author = hotdiss["author"].ToString(),
                                DissId = hotdiss["dissid"].ToString(),
                                DissName = hotdiss["dissname"].ToString(),
                                ImgUrl = hotdiss["imgurl"].ToString(),
                                ListenNum = hotdiss["listennum"].ToString()
                            });
                        }));
                    }
                }
                if (tops != null)
                {
                    foreach (var top in tops)
                    {
                        JToken      songs    = top["songlist"];
                        List <Song> songList = new List <Song>();
                        foreach (var song in songs)
                        {
                            songList.Add(new Song()
                            {
                                Singer = new Singer()
                                {
                                    Id   = song["singerid"].ToString(),
                                    Name = song["singername"].ToString(),
                                },
                                Id   = song["songid"].ToString(),
                                Name = song["songname"].ToString()
                            });
                        }
                        DispatcherHelper.CheckBeginInvokeOnUI((() =>
                        {
                            Tops.Add(new Top()
                            {
                                HeadPic_v12 = top["headPic_v12"].ToString(),
                                ListenNum = top["listennum"].ToString(),
                                ListName = top["ListName"].ToString(),
                                MacDetailPicUrl = top["MacDetailPicUrl"].ToString(),
                                ShowTime = top["showtime"].ToString(),
                                SongList = new ObservableCollection <Song>(songList)
                            });
                        }));
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }