예제 #1
0
        public SearchUserPage()
        {
            InitializeComponent();

            statuses.load = async(c) =>
            {
                if (statuses.Count > 0)
                {
                    try
                    {
                        var list = await FanfouAPI.FanfouAPI.Instance.SearchUserTimeline(search.Text, user.id, c, max_id : statuses.Last().id);

                        if (list.Count == 0)
                        {
                            statuses.HasMoreItems = false;
                        }
                        Utils.StatusesReform.append(statuses, list);
                        return(list.Count);
                    }
                    catch (Exception)
                    {
                        Utils.ToastShow.ShowInformation("加载失败,请检查网络");
                        return(0);
                    }
                }
                return(0);
            };

            navigationHelper            = new NavigationHelper(this);
            navigationHelper.LoadState += NavigationHelper_LoadState;
            navigationHelper.SaveState += NavigationHelper_SaveState;
        }
예제 #2
0
        public UserPage()
        {
            InitializeComponent();

            navigationHelper            = new NavigationHelper(this);
            navigationHelper.LoadState += NavigationHelper_LoadState;
            navigationHelper.SaveState += NavigationHelper_SaveState;

            App.RootFrame.SizeChanged += RootFrame_SizeChanged;

            statuses.load = async(c) =>
            {
                if (statuses.Count > 0)
                {
                    try
                    {
                        var list = await FanfouAPI.FanfouAPI.Instance.StatusUserTimeline(user.id, c, max_id : statuses.Last().id);

                        if (list.Count == 0)
                        {
                            statuses.HasMoreItems = false;
                        }
                        Utils.StatusesReform.append(statuses, list);
                        return(list.Count);
                    }
                    catch (Exception)
                    {
                        Utils.ToastShow.ShowInformation("加载失败,请检查网络");
                        return(0);
                    }
                }
                return(0);
            };

            favorites.load = async(c) =>
            {
                if (favorites.Count > 0)
                {
                    try
                    {
                        var result =
                            await FanfouAPI.FanfouAPI.Instance.FavoritesId(user.id, SettingStorage.Instance.messageSize, ++favoritePage);

                        if (result.Count == 0)
                        {
                            favorites.HasMoreItems = false;
                        }
                        StatusesReform.append(favorites, result);

                        return(result.Count);
                    }
                    catch (Exception)
                    {
                        return(0);
                    }
                }
                return(0);
            };


            friends.load = async(c) =>
            {
                if (friends.Count > 0)
                {
                    try
                    {
                        var result =
                            await FanfouAPI.FanfouAPI.Instance.UsersFriends(user.id, SettingStorage.Instance.messageSize, ++friendsPage);

                        if (result.Count == 0)
                        {
                            friends.HasMoreItems = false;
                        }

                        foreach (User i in result)
                        {
                            friends.Add(i);
                        }

                        return(result.Count);
                    }
                    catch (Exception)
                    {
                        Utils.ToastShow.ShowInformation("加载失败,请检查网络");
                        return(0);
                    }
                }
                return(0);
            };

            followers.load = async(c) =>
            {
                if (followers.Count > 0)
                {
                    try
                    {
                        var result =
                            await FanfouAPI.FanfouAPI.Instance.UsersFollowers(user.id, SettingStorage.Instance.messageSize, ++followersPage);

                        if (result.Count == 0)
                        {
                            followers.HasMoreItems = false;
                        }

                        foreach (User i in result)
                        {
                            followers.Add(i);
                        }

                        return(result.Count);
                    }
                    catch (Exception)
                    {
                        Utils.ToastShow.ShowInformation("加载失败,请检查网络");
                        return(0);
                    }
                }
                return(0);
            };
        }
예제 #3
0
        public HomePage()
        {
            InitializeComponent();

            statuses = cache.statuses;
            mentions = cache.mentions;

            mentions.load = async(c) =>
            {
                if (mentions.Count > 0)
                {
                    try
                    {
                        var result =
                            await FanfouAPI.FanfouAPI.Instance.StatusMentionTimeline(c, max_id : mentions.Last().id);

                        if (result.Count == 0)
                        {
                            mentions.HasMoreItems = false;
                        }
                        Utils.StatusesReform.append(mentions, result);
                        return(result.Count);
                    }
                    catch (Exception)
                    {
                        Utils.ToastShow.ShowInformation("加载失败,请检查网络");
                        return(0);
                    }
                }
                return(0);
            };
            statuses.load = async(c) =>
            {
                if (statuses.Count > 0)
                {
                    try
                    {
                        var result =
                            await FanfouAPI.FanfouAPI.Instance.StatusHomeTimeline(c, max_id : statuses.Last().id);

                        if (result.Count == 0)
                        {
                            statuses.HasMoreItems = false;
                        }
                        Utils.StatusesReform.append(statuses, result);
                        return(result.Count);
                    }
                    catch (Exception)
                    {
                        Utils.ToastShow.ShowInformation("加载失败,请检查网络");
                        return(0);
                    }
                }
                return(0);
            };

            navigationHelper            = new NavigationHelper(this);
            navigationHelper.LoadState += NavigationHelper_LoadState;
            navigationHelper.SaveState += NavigationHelper_SaveState;
        }