예제 #1
0
        public async Task GetFollows()
        {
            try
            {
                LoadingFollow = true;
                var results = await followAPI.MyFollowCinema().Request();

                if (results.status)
                {
                    var data = await results.GetJson <ApiResultModel <JObject> >();

                    if (data.success)
                    {
                        Follows = await data.result["follow_list"].ToString().DeserializeJson <ObservableCollection <FollowSeasonModel> >();
                    }
                    else
                    {
                        Utils.ShowMessageToast(data.message);
                    }
                }
                else
                {
                    Utils.ShowMessageToast(results.message);
                }
            }
            catch (Exception ex)
            {
                var handel = HandelError <AnimeHomeModel>(ex);
                Utils.ShowMessageToast(handel.message);
            }
            finally
            {
                LoadingFollow = false;
            }
        }
예제 #2
0
        public async Task LoadFollows()
        {
            try
            {
                Loading      = true;
                Nothing      = false;
                ShowLoadMore = false;
                var api = followAPI.MyFollowBangumi(page: Page, status: Status);
                if (!isAnime)
                {
                    api = followAPI.MyFollowCinema(page: Page, status: Status);
                }
                var results = await api.Request();

                if (results.status)
                {
                    var data = await results.GetJson <ApiResultModel <JObject> >();

                    if (data.success)
                    {
                        if (data.result["has_next"].ToInt32() == 1)
                        {
                            ShowLoadMore = true;
                        }
                        if (!data.result.ContainsKey("follow_list"))
                        {
                            if (Page == 1)
                            {
                                Nothing = true;
                                Follows = new ObservableCollection <FollowSeasonModel>();
                            }
                            else
                            {
                                Utils.ShowMessageToast("全部加载完了...");
                            }
                            return;
                        }
                        var ls = await data.result["follow_list"].ToString().DeserializeJson <ObservableCollection <FollowSeasonModel> >();
                        if (ls != null && ls.Count != 0)
                        {
                            foreach (var item in ls)
                            {
                                item.status = Status;
                                item.CancelFollowCommand = CancelFollowCommand;
                                item.SetWantWatchCommand = SetWantWatchCommand;
                                item.SetWatchedCommand   = SetWatchedCommand;
                                item.SetWatchingCommand  = SetWatchingCommand;
                            }
                            if (Page == 1)
                            {
                                Follows = ls;
                            }
                            else
                            {
                                foreach (var item in ls)
                                {
                                    Follows.Add(item);
                                }
                            }
                            Page++;
                        }
                    }
                    else
                    {
                        Utils.ShowMessageToast(data.message);
                    }
                }
                else
                {
                    Utils.ShowMessageToast(results.message);
                }
            }
            catch (Exception ex)
            {
                var handel = HandelError <AnimeHomeModel>(ex);
                Utils.ShowMessageToast(handel.message);
            }
            finally
            {
                Loading = false;
            }
        }