예제 #1
0
        public async void LoadRanks()
        {
            try
            {
                loading = true;
                IHttpResults re = await Api.Ranks().Request();

                if (!re.status)
                {
                    Utils.ShowMessageToast(re.message);
                    return;
                }
                var data = re.GetJson <ApiParseModel <List <RankModel> > >();
                if (data.code != 0)
                {
                    Utils.ShowMessageToast(data.msg + data.message);
                    return;
                }
                ranks = data.data;
            }
            catch (Exception ex)
            {
                Utils.ShowMessageToast("加载榜单失败");
                LogHelper.Log("加载榜单失败", LogType.ERROR, ex);
            }
            finally
            {
                loading = false;
            }
        }
예제 #2
0
        /// <summary>
        /// 收藏歌单
        /// </summary>
        /// <param name="menuId"></param>
        public async void CancelCollectMenu()
        {
            try
            {
                loading = true;
                IHttpResults re = await Api.CancelMenuCollect(menuId).Request();

                if (!re.status)
                {
                    Utils.ShowMessageToast(re.message);
                    return;
                }
                var data = re.GetJson <ApiParseModel <object> >();

                if (data.code != 0)
                {
                    Utils.ShowMessageToast(data.msg + data.message);
                    return;
                }
                Datas.menusRespones.collected = 0;
                Utils.ShowMessageToast("已经取消收藏");
                MessageCenter.GetMainInfo().Logined();
            }
            catch (Exception ex)
            {
                Utils.ShowMessageToast("读取歌单信息失败");
                LogHelper.Log("读取歌单信息失败", LogType.ERROR, ex);
            }
            finally
            {
                loading = false;
            }
        }
예제 #3
0
        public async void SearchMusician()
        {
            var page    = 1;
            var maxPage = 1;

            if (searchAuthors != null)
            {
                page    = searchAuthors.page + 1;
                maxPage = searchAuthors.num_pages;
            }
            if (page > maxPage)
            {
                Utils.ShowMessageToast("已经加载完了...");
                return;
            }
            try
            {
                loading = true;
                IHttpResults re = await Api.Search(SearchMode.musician.ToString(), keyword, page).Request();

                if (!re.status)
                {
                    Utils.ShowMessageToast(re.message);
                    return;
                }
                var data = re.GetJson <ApiParseModel <SearchModel <SearchAuthorResultModel> > >();
                if (data.code != 0 || data.data.code != "0")
                {
                    Utils.ShowMessageToast("搜索单曲失败");
                    return;
                }
                if (searchAuthors == null)
                {
                    searchAuthors = data.data;
                }
                else
                {
                    searchAuthors.page = data.data.page;
                    foreach (var item in data.data.result)
                    {
                        searchAuthors.result.Add(item);
                    }
                }
            }
            catch (Exception ex)
            {
                Utils.ShowMessageToast("搜索歌单失败");
                LogHelper.Log($"搜索歌单失败,关键词:{keyword}", LogType.ERROR, ex);
            }
            finally
            {
                loading = false;
            }
        }
예제 #4
0
 private async void Collction()
 {
     try
     {
         List <int> menus = new List <int>();
         foreach (MyCreateMenuItemModel item in list.SelectedItems)
         {
             menus.Add(item.id);
         }
         IHttpResults re = null;
         if (songId != 0)
         {
             re = await Api.CollectSong(songId, menus).Request();
         }
         else
         {
             re = await Api.CollectSong(songIds, menus).Request();
         }
         if (!re.status)
         {
             Utils.ShowMessageToast(re.message);
             return;
         }
         var data = re.GetJson <ApiParseModel <object> >();
         if (data.code != 0)
         {
             Utils.ShowMessageToast(data.msg + data.message);
             return;
         }
         Utils.ShowMessageToast("操作完成");
     }
     catch (Exception ex)
     {
         Utils.ShowMessageToast("收藏歌曲失败");
         LogHelper.Log("收藏歌曲失败", LogType.ERROR, ex);
     }
 }