Exemple #1
0
        private async void GetTopMusic(string type)
        {
            NewMusicList.Clear();
            var temp = string.IsNullOrEmpty(type) ? 1 : int.Parse(type);
            var netWorkDataResult = await this._netWorkServices.GetAsync <Music[]>("FindMusic", "TopMusics", new { Type = temp });

            if (netWorkDataResult.Successed)
            {
                await NewMusicList.AddRangeAsync(netWorkDataResult.Data);
            }
            else
            {
                //todo 网络提示
            }
            //await NewMusicList.AddRangeAsync(JsonConvert.DeserializeObject<Global.Model.Music[]>(json));
        }
Exemple #2
0
        /// <summary>
        /// 加载的时候获取数据
        /// </summary>
        private async void InitData()
        {
            var netWorkDataResult = await this._netWorkServices.GetAsync <PersonalityRecommend>("FindMusic", "PersonalityRecommend", new { limit = 10 });

            if (!netWorkDataResult.Successed)
            {
                //todo 网络提示信息
                return;
            }
            var temp = netWorkDataResult.Data;

            if (temp?.RecommendList != null)
            {
                // RecommendList.Clear();
                //RecommendList.AddRange(temp.RecommendList.Select(x => new PlayListModel(x)));
                await RecommendList.AddRangeAsync(temp.RecommendList);
            }
            if (temp?.AnchorRadioList != null)
            {
                //AnchorRadioList.Clear();
                //AnchorRadioList.AddRange(temp.AnchorRadioList.Select(x => new RadioModel(x)));
                await AnchorRadioList.AddRangeAsync(temp.AnchorRadioList);
            }
            if (temp?.RecommendMvList != null)
            {
                await RecommendMvList.AddRangeAsync(temp.RecommendMvList);
            }
            if (temp?.NewMusicList != null)
            {
                //NewMusicList.Clear();
                //NewMusicList.AddRange(temp.NewMusicList);
                await NewMusicList.AddRangeAsync(temp.NewMusicList);
            }
            if (temp?.PrivateContentList != null)
            {
                await ExclusiveDeliveryList.AddRangeAsync(temp.PrivateContentList);
            }
            if (temp?.BannerList != null)
            {
                //BannerList.Clear();
                //BannerList.AddRange(temp.BannerList.Select(x => new BannerModel { Image = x.Pic }));
                await BannerList.AddRangeAsync(temp.BannerList);
            }
        }